diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2012-09-11 16:39:08 -0400 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2012-09-17 17:29:20 -0400 |
| commit | 4e21f4eaa49f78d3e977e316514c941053871c76 (patch) | |
| tree | 181afa93cd96ccc2e8f5846087f4fa9d678b8d3b | |
| parent | 5698bd757d55b1bb87edd1a9744ab09c142abfc2 (diff) | |
hwmon: (ads7871) Add 'name' sysfs attribute
The 'name' sysfs attribute is mandatory for hwmon devices, but was missing
in this driver.
Cc: Paul Thomas <pthomas8589@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Paul Thomas <pthomas8589@gmail.com>
| -rw-r--r-- | drivers/hwmon/ads7871.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c index e65c6e45d36b..7bf4ce3d405e 100644 --- a/drivers/hwmon/ads7871.c +++ b/drivers/hwmon/ads7871.c | |||
| @@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev, | |||
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | static ssize_t ads7871_show_name(struct device *dev, | ||
| 143 | struct device_attribute *devattr, char *buf) | ||
| 144 | { | ||
| 145 | return sprintf(buf, "%s\n", to_spi_device(dev)->modalias); | ||
| 146 | } | ||
| 147 | |||
| 142 | static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); | 148 | static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); |
| 143 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); | 149 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); |
| 144 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); | 150 | 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); | |||
| 148 | static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); | 154 | static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); |
| 149 | static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); | 155 | static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); |
| 150 | 156 | ||
| 157 | static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL); | ||
| 158 | |||
| 151 | static struct attribute *ads7871_attributes[] = { | 159 | static struct attribute *ads7871_attributes[] = { |
| 152 | &sensor_dev_attr_in0_input.dev_attr.attr, | 160 | &sensor_dev_attr_in0_input.dev_attr.attr, |
| 153 | &sensor_dev_attr_in1_input.dev_attr.attr, | 161 | &sensor_dev_attr_in1_input.dev_attr.attr, |
| @@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = { | |||
| 157 | &sensor_dev_attr_in5_input.dev_attr.attr, | 165 | &sensor_dev_attr_in5_input.dev_attr.attr, |
| 158 | &sensor_dev_attr_in6_input.dev_attr.attr, | 166 | &sensor_dev_attr_in6_input.dev_attr.attr, |
| 159 | &sensor_dev_attr_in7_input.dev_attr.attr, | 167 | &sensor_dev_attr_in7_input.dev_attr.attr, |
| 168 | &dev_attr_name.attr, | ||
| 160 | NULL | 169 | NULL |
| 161 | }; | 170 | }; |
| 162 | 171 | ||
