Skip to contentSkip to conversation

rtc: isl1208: avoid possible sysfs race

PATCH In review Alexandre Belloni 2 participants 3 messages Sep 15, 2018 – Sep 25, 2018 Real time clock (RTC)

lore
Share & tools
lore

Alexandre Belloni

author maintainer
#0 lore raw

PATCH 1/1 rtc: isl1208: avoid possible sysfs race

Use rtc_add_group to add the common sysfs group to avoid a possible race condition.

---
 drivers/rtc/rtc-isl1208.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/rtc/rtc-isl1208.c +1 -10
index ea18a8f4bce0..e1e9434c9972 100644
@@ -804,7 +804,7 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		evdet_irq = of_irq_get_byname(np, "evdet");
 	}
 
-	rc = sysfs_create_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
+	rc = rtc_add_group(rtc, &isl1208_rtc_sysfs_files);
 	if (rc)
 		return rc;
 
@@ -821,14 +821,6 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	return rtc_register_device(rtc);
 }
 
-static int
-isl1208_remove(struct i2c_client *client)
-{
-	sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
-
-	return 0;
-}
-
 static const struct i2c_device_id isl1208_id[] = {
 	{ "isl1208", TYPE_ISL1208 },
 	{ "isl1218", TYPE_ISL1218 },
@@ -851,7 +843,6 @@ static struct i2c_driver isl1208_driver = {
 		.of_match_table = of_match_ptr(isl1208_of_match),
 	},
 	.probe = isl1208_probe,
-	.remove = isl1208_remove,
 	.id_table = isl1208_id,
 };
 
Signature · 1 line
2.19.0
#1 lore raw

Hi,

just for clarification:
This changes user-space representation from /sys/class/rtc/rtcN/device/{atrim,dtrim,usr}
to
/sys/class/rtc/rtcN/{atrim,dtrim,usr}
and fixes the "mistake made back in 2006" you mention in
https://patchwork.ozlabs.org/patch/881397/
correct?

Regards Denis

Am Samstag, den 15.09.2018, 13:43 +0200 schrieb Alexandre Belloni:

Quoted 43 lines

Use rtc_add_group to add the common sysfs group to avoid a possible race condition.

---
 drivers/rtc/rtc-isl1208.c | 11 +----------

 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/rtc/rtc-isl1208.c +0 -0
index ea18a8f4bce0..e1e9434c9972 100644
@@ -804,7 +804,7 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
  		evdet_irq = of_irq_get_byname(np, "evdet");
  	}

drivers/rtc/rtc-isl1208.c +1 -1
-	rc = sysfs_create_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
+	rc = rtc_add_group(rtc, &isl1208_rtc_sysfs_files);

  if (rc)
  return rc;

drivers/rtc/rtc-isl1208.c +0 -0
@@ -821,14 +821,6 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
  	return rtc_register_device(rtc);
  }

drivers/rtc/rtc-isl1208.c +0 -8
-static int
-isl1208_remove(struct i2c_client *client)
-{
-	sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
-
-	return 0;
-}
-

 static const struct i2c_device_id isl1208_id[] = { { "isl1208", TYPE_ISL1208 },
  { "isl1218", TYPE_ISL1218 },

drivers/rtc/rtc-isl1208.c +0 -1
@@ -851,7 +843,6 @@ static struct i2c_driver isl1208_driver = {
  		.of_match_table = of_match_ptr(isl1208_of_match),
  	},
  	.probe = isl1208_probe,
-	.remove = isl1208_remove,
  	.id_table = isl1208_id,
  };
Quoted 1 line

Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht Nürnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.

author maintainer
#2 lore raw
Quoted 11 lines · Denis OSTERLAND

Hi,

just for clarification:
This changes user-space representation from /sys/class/rtc/rtcN/device/{atrim,dtrim,usr}
to
/sys/class/rtc/rtcN/{atrim,dtrim,usr}
and fixes the "mistake made back in 2006" you mention in
https://patchwork.ozlabs.org/patch/881397/
correct?

This is correct. At some point, it would also be great to move from atrim/dtrim to offset

Quoted 59 lines

Regards Denis

Am Samstag, den 15.09.2018, 13:43 +0200 schrieb Alexandre Belloni:

Quoted 43 lines

Use rtc_add_group to add the common sysfs group to avoid a possible race condition.

---
 drivers/rtc/rtc-isl1208.c | 11 +----------

 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/rtc/rtc-isl1208.c +0 -0
index ea18a8f4bce0..e1e9434c9972 100644
@@ -804,7 +804,7 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
  		evdet_irq = of_irq_get_byname(np, "evdet");
  	}

drivers/rtc/rtc-isl1208.c +1 -1
-	rc = sysfs_create_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
+	rc = rtc_add_group(rtc, &isl1208_rtc_sysfs_files);

  if (rc)
  return rc;

drivers/rtc/rtc-isl1208.c +0 -0
@@ -821,14 +821,6 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
  	return rtc_register_device(rtc);
  }

drivers/rtc/rtc-isl1208.c +0 -8
-static int
-isl1208_remove(struct i2c_client *client)
-{
-	sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
-
-	return 0;
-}
-

 static const struct i2c_device_id isl1208_id[] = { { "isl1208", TYPE_ISL1208 },
  { "isl1218", TYPE_ISL1218 },

drivers/rtc/rtc-isl1208.c +0 -1
@@ -851,7 +843,6 @@ static struct i2c_driver isl1208_driver = {
  		.of_match_table = of_match_ptr(isl1208_of_match),
  	},
  	.probe = isl1208_probe,
-	.remove = isl1208_remove,
  	.id_table = isl1208_id,
  };
Quoted 1 line

Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht Nürnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com