summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ads7871.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-09-11 13:39:08 -0700
committerGuenter Roeck <linux@roeck-us.net>2012-09-17 14:29:20 -0700
commit4e21f4eaa49f78d3e977e316514c941053871c76 (patch)
tree181afa93cd96ccc2e8f5846087f4fa9d678b8d3b /drivers/hwmon/ads7871.c
parent5698bd757d55b1bb87edd1a9744ab09c142abfc2 (diff)
downloadop-kernel-dev-4e21f4eaa49f78d3e977e316514c941053871c76.zip
op-kernel-dev-4e21f4eaa49f78d3e977e316514c941053871c76.tar.gz
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>
Diffstat (limited to 'drivers/hwmon/ads7871.c')
-rw-r--r--drivers/hwmon/ads7871.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
index e65c6e4..7bf4ce3 100644
--- a/drivers/hwmon/ads7871.c
+++ b/drivers/hwmon/ads7871.c
@@ -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
};
OpenPOWER on IntegriCloud