diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2016-12-22 15:05:02 +0300 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2017-01-02 21:19:45 +0300 |
commit | d0688f6ccdcdf17e709c7986b81ff6b2d63d1db8 (patch) | |
tree | 429ce57a7b8b7a51510a4ba2f22eeafe0e6054f4 /drivers/hwmon | |
parent | 1f856175e44bc2b8c5c961854abe80fb6c106229 (diff) | |
download | linux-d0688f6ccdcdf17e709c7986b81ff6b2d63d1db8.tar.xz |
hwmon: (nsa320) use permission-specific DEVICE_ATTR variants
Use DEVICE_ATTR_RO for read-only attributes. This simplifies the source
code, improves readbility, and reduces the chance of inconsistencies.
The conversion was done automatically using coccinelle. It was validated
by compiling both the old and the new source code and comparing its text,
data, and bss size.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
[groeck: Updated description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/nsa320-hwmon.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/hwmon/nsa320-hwmon.c b/drivers/hwmon/nsa320-hwmon.c index 0517a265741f..5a16109cdea8 100644 --- a/drivers/hwmon/nsa320-hwmon.c +++ b/drivers/hwmon/nsa320-hwmon.c @@ -122,8 +122,8 @@ static ssize_t show_label(struct device *dev, return sprintf(buf, "%s\n", nsa320_input_names[channel]); } -static ssize_t show_temp(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t temp1_input_show(struct device *dev, + struct device_attribute *attr, char *buf) { s32 mcu_data = nsa320_hwmon_update(dev); @@ -133,8 +133,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr, return sprintf(buf, "%d\n", (mcu_data & 0xffff) * 100); } -static ssize_t show_fan(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t fan1_input_show(struct device *dev, + struct device_attribute *attr, char *buf) { s32 mcu_data = nsa320_hwmon_update(dev); @@ -145,9 +145,9 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *attr, } static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, NSA320_TEMP); -static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL); +static DEVICE_ATTR_RO(temp1_input); static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, show_label, NULL, NSA320_FAN); -static DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL); +static DEVICE_ATTR_RO(fan1_input); static struct attribute *nsa320_attrs[] = { &sensor_dev_attr_temp1_label.dev_attr.attr, |