summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/nsa320-hwmon.c
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2016-12-22 07:05:02 -0500
committerGuenter Roeck <linux@roeck-us.net>2017-01-02 13:19:45 -0500
commitd0688f6ccdcdf17e709c7986b81ff6b2d63d1db8 (patch)
tree429ce57a7b8b7a51510a4ba2f22eeafe0e6054f4 /drivers/hwmon/nsa320-hwmon.c
parent1f856175e44bc2b8c5c961854abe80fb6c106229 (diff)
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/nsa320-hwmon.c')
-rw-r--r--drivers/hwmon/nsa320-hwmon.c12
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,
122 return sprintf(buf, "%s\n", nsa320_input_names[channel]); 122 return sprintf(buf, "%s\n", nsa320_input_names[channel]);
123} 123}
124 124
125static ssize_t show_temp(struct device *dev, struct device_attribute *attr, 125static ssize_t temp1_input_show(struct device *dev,
126 char *buf) 126 struct device_attribute *attr, char *buf)
127{ 127{
128 s32 mcu_data = nsa320_hwmon_update(dev); 128 s32 mcu_data = nsa320_hwmon_update(dev);
129 129
@@ -133,8 +133,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
133 return sprintf(buf, "%d\n", (mcu_data & 0xffff) * 100); 133 return sprintf(buf, "%d\n", (mcu_data & 0xffff) * 100);
134} 134}
135 135
136static ssize_t show_fan(struct device *dev, struct device_attribute *attr, 136static ssize_t fan1_input_show(struct device *dev,
137 char *buf) 137 struct device_attribute *attr, char *buf)
138{ 138{
139 s32 mcu_data = nsa320_hwmon_update(dev); 139 s32 mcu_data = nsa320_hwmon_update(dev);
140 140
@@ -145,9 +145,9 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *attr,
145} 145}
146 146
147static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, NSA320_TEMP); 147static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, NSA320_TEMP);
148static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL); 148static DEVICE_ATTR_RO(temp1_input);
149static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, show_label, NULL, NSA320_FAN); 149static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, show_label, NULL, NSA320_FAN);
150static DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL); 150static DEVICE_ATTR_RO(fan1_input);
151 151
152static struct attribute *nsa320_attrs[] = { 152static struct attribute *nsa320_attrs[] = {
153 &sensor_dev_attr_temp1_label.dev_attr.attr, 153 &sensor_dev_attr_temp1_label.dev_attr.attr,