hwmon: (ads7871) Add 'name' sysfs attribute
Guenter Roeck
maintainerPATCH 3/4 hwmon: (ads7871) Add 'name' sysfs attribute
The 'name' sysfs attribute is mandatory for hwmon devices, but was missing in this driver.
---
Candidate for -stable
drivers/hwmon/ads7871.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/hwmon/ads7871.c +9 -0
@@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev, } } +static ssize_t ads7871_show_name (struct device *dev, +struct device_attribute *devattr,char *buf) +{ +return sprintf (buf,"%s\n" ,to_spi_device (dev)->modalias); +} + static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);
@@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5); static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); +static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL); +static struct attribute *ads7871_attributes[] = { &sensor_dev_attr_in0_input.dev_attr.attr, &sensor_dev_attr_in1_input.dev_attr.attr,
@@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = { &sensor_dev_attr_in5_input.dev_attr.attr, &sensor_dev_attr_in6_input.dev_attr.attr, &sensor_dev_attr_in7_input.dev_attr.attr, + &dev_attr_name.attr, NULL };
Signature · 7 lines
1.7.9.7 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerping
Quoted 49 lines · Guenter Roeck
The 'name' sysfs attribute is mandatory for hwmon devices, but was missing in this driver.
Cc Paul Thomas <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
Candidate for -stabledrivers/hwmon/ads7871.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/hwmon/ads7871.c +9
-0@@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev, } } +static ssize_t ads7871_show_name (struct device *dev, +struct device_attribute *devattr,char *buf) +{ +return sprintf (buf,"%s\n" ,to_spi_device (dev)->modalias); +} + static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);@@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5); static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); +static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL); +static struct attribute *ads7871_attributes[] = { &sensor_dev_attr_in0_input.dev_attr.attr, &sensor_dev_attr_in1_input.dev_attr.attr,@@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = { &sensor_dev_attr_in5_input.dev_attr.attr, &sensor_dev_attr_in6_input.dev_attr.attr, &sensor_dev_attr_in7_input.dev_attr.attr, + &dev_attr_name.attr, NULL };Signature · 1 line
1.7.9.7
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 38 lines · Guenter Roeck
The 'name' sysfs attribute is mandatory for hwmon devices, but was missing in this driver.
Cc Paul Thomas <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
Candidate for -stabledrivers/hwmon/ads7871.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/hwmon/ads7871.c +8
-0@@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev, } } +static ssize_t ads7871_show_name (struct device *dev, +struct device_attribute *devattr,char *buf) +{ +return sprintf (buf,"%s\n" ,to_spi_device (dev)->modalias); +} + static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);@@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5); static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); +static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL); +static struct attribute *ads7871_attributes[] = { &sensor_dev_attr_in0_input.dev_attr.attr, &sensor_dev_attr_in1_input.dev_attr.attr,
drivers/hwmon/ads7871.c static struct attribute *ads7871_attributes[] = { · line 171
Quoted 7 lines
drivers/hwmon/ads7871.c +1
-0@@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = { &sensor_dev_attr_in5_input.dev_attr.attr, &sensor_dev_attr_in6_input.dev_attr.attr, &sensor_dev_attr_in7_input.dev_attr.attr, + &dev_attr_name.attr, NULL };
Good catch.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 48 lines · Guenter Roeck
The 'name' sysfs attribute is mandatory for hwmon devices, but was missing in this driver.
Cc Paul Thomas <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
Candidate for -stabledrivers/hwmon/ads7871.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/hwmon/ads7871.c +6
-0@@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev, } } +static ssize_t ads7871_show_name (struct device *dev, +struct device_attribute *devattr,char *buf) +{ +return sprintf (buf,"%s\n" ,to_spi_device (dev)->modalias); +} + static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1);static
SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);drivers/hwmon/ads7871.c +2
-0@@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5); static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); +static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL); +static struct attribute *ads7871_attributes[] = { &sensor_dev_attr_in0_input.dev_attr.attr,&sensor_dev_attr_in1_input.dev_attr.attr,
drivers/hwmon/ads7871.c +1
-1@@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = { &sensor_dev_attr_in5_input.dev_attr.attr, &sensor_dev_attr_in6_input.dev_attr.attr, &sensor_dev_attr_in7_input.dev_attr.attr, + &dev_attr_name.attr, NULL }; --
Quoted 3 lines
1.7.9.7
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors