Skip to contentSkip to conversation

hwmon: (s3c) Initialize sysfs attributes

PATCH Applied Guenter Roeck 2 participants 3 messages May 24, 2011 – Jun 11, 2011 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 hwmon: (s3c) Initialize sysfs attributes

Initialize dynamically allocated sysfs attributes before device_create_file() call to suppress lockdep_init_map() warning if lockdep debugging is enabled.

---
Compile tested only.

 drivers/hwmon/s3c-hwmon.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/hwmon/s3c-hwmon.c +1 -0
index 92b42db..731d1f3 100644
@@ -232,6 +232,7 @@ static int s3c_hwmon_create_attr(struct device *dev,
 
 	attr = &attrs->in;
 	attr->index = channel;
+	sysfs_attr_init(&attr->dev_attr.attr);
 	attr->dev_attr.attr.name  = attrs->in_name;
 	attr->dev_attr.attr.mode  = S_IRUGO;
 	attr->dev_attr.show = s3c_hwmon_ch_show;
Signature · 7 lines
1.7.3.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 5/5
#1 lore raw

Re: [lm-sensors] [PATCH 5/5] hwmon: (s3c) Initialize sysfs

Hi Guenter,

Quoted 6 lines · Guenter Roeck

Initialize dynamically allocated sysfs attributes before device_create_file() call to suppress lockdep_init_map() warning if lockdep debugging is enabled.

---
Compile tested only.

Seems incomplete to me...

Quoted 9 lines
 drivers/hwmon/s3c-hwmon.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/hwmon/s3c-hwmon.c +0 -0
index 92b42db..731d1f3 100644

drivers/hwmon/s3c-hwmon.c static int s3c_hwmon_create_attr(struct device *dev, · line 238

Quoted 7 lines
drivers/hwmon/s3c-hwmon.c +1 -0
@@ -232,6 +232,7 @@ static int s3c_hwmon_create_attr(struct device *dev,
 
 	attr = &attrs->in;
 	attr->index = channel;
+	sysfs_attr_init(&attr->dev_attr.attr);
 	attr->dev_attr.attr.name  = attrs->in_name;
 	attr->dev_attr.attr.mode  = S_IRUGO;
 	attr->dev_attr.show = s3c_hwmon_ch_show;

A few lines below, a second optional attribute is used for the label. So you also need:

drivers/hwmon/s3c-hwmon.c +1 -0
@@ -250,6 +250,7 @@ static int s3c_hwmon_create_attr(struct
 
 		attr = &attrs->label;
 		attr->index = channel;
+		sysfs_attr_init(&attr->dev_attr.attr);
 		attr->dev_attr.attr.name  = attrs->label_name;
 		attr->dev_attr.attr.mode  = S_IRUGO;
 		attr->dev_attr.show = s3c_hwmon_label_show;

(Not even build-tested, but that should work.)

With this change added:

Thanks for finally fixing all these warnings, BTW, they've been there for quite some time...

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw

Re: [lm-sensors] [PATCH 5/5] hwmon: (s3c) Initialize sysfs

In reply to Guenter Roeck
Quoted 43 lines · Jean Delvare

Hi Guenter,

Quoted 6 lines · Guenter Roeck

Initialize dynamically allocated sysfs attributes before device_create_file() call to suppress lockdep_init_map() warning if lockdep debugging is enabled.

---
Compile tested only.

Seems incomplete to me...

Quoted 9 lines
 drivers/hwmon/s3c-hwmon.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/hwmon/s3c-hwmon.c +0 -0
index 92b42db..731d1f3 100644

drivers/hwmon/s3c-hwmon.c static int s3c_hwmon_create_attr(struct device *dev, · line 238

Quoted 7 lines
drivers/hwmon/s3c-hwmon.c +1 -0
@@ -232,6 +232,7 @@ static int s3c_hwmon_create_attr(struct device *dev,
 
 	attr = &attrs->in;
 	attr->index = channel;
+	sysfs_attr_init(&attr->dev_attr.attr);
 	attr->dev_attr.attr.name  = attrs->in_name;
 	attr->dev_attr.attr.mode  = S_IRUGO;
 	attr->dev_attr.show = s3c_hwmon_ch_show;

A few lines below, a second optional attribute is used for the label. So you also need:

drivers/hwmon/s3c-hwmon.c +1 -0
@@ -250,6 +250,7 @@ static int s3c_hwmon_create_attr(struct
 
 		attr = &attrs->label;
 		attr->index = channel;
+		sysfs_attr_init(&attr->dev_attr.attr);
 		attr->dev_attr.attr.name  = attrs->label_name;
 		attr->dev_attr.attr.mode  = S_IRUGO;
 		attr->dev_attr.show = s3c_hwmon_label_show;
Quoted 6 lines

(Not even build-tested, but that should work.)

With this change added:

Good catch, fixed, applied, and added Cc: for stable.

Quoted 3 lines

Thanks for finally fixing all these warnings, BTW, they've been there for quite some time...

Yes, I figured since I was looking into the problem anyway after it was found in the coretemp driver, I should spend the time to track it down everywhere ... I just hope I found all instances.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors