Skip to content

Commit

Permalink
hwmon: (ad7314) Add 'name' sysfs attribute
Browse files Browse the repository at this point in the history
The 'name' sysfs attribute is mandatory for hwmon devices, but was missing
in this driver.

Cc: Jonathan Cameron <jic23@cam.ac.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
  • Loading branch information
Guenter Roeck committed Sep 18, 2012
1 parent 4e21f4e commit 3ceefe4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/hwmon/ad7314.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,18 @@ static ssize_t ad7314_show_temperature(struct device *dev,
}
}

static ssize_t ad7314_show_name(struct device *dev,
struct device_attribute *devattr, char *buf)
{
return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
}

static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL);
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
ad7314_show_temperature, NULL, 0);

static struct attribute *ad7314_attributes[] = {
&dev_attr_name.attr,
&sensor_dev_attr_temp1_input.dev_attr.attr,
NULL,
};
Expand Down

0 comments on commit 3ceefe4

Please sign in to comment.