summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/g760a.c
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2016-12-22 07:04:41 -0500
committerGuenter Roeck <linux@roeck-us.net>2017-01-02 13:19:45 -0500
commit92a4873d532d579070ddd304bae3fe13e8810493 (patch)
tree72e7e14eca46d5f6a266b0cd8182f06181a9a8bc /drivers/hwmon/g760a.c
parente34e885b9e32d7c78dd4d4f60616f1026ae0061e (diff)
hwmon: (g760a) use permission-specific DEVICE_ATTR variants
Use DEVICE_ATTR_RO for read only attributes and DEVICE_ATTR_RW for read/write 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/g760a.c')
-rw-r--r--drivers/hwmon/g760a.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/hwmon/g760a.c b/drivers/hwmon/g760a.c
index ec6a77da411a..7be1371b2c3d 100644
--- a/drivers/hwmon/g760a.c
+++ b/drivers/hwmon/g760a.c
@@ -107,8 +107,8 @@ static struct g760a_data *g760a_update_client(struct device *dev)
107 return data; 107 return data;
108} 108}
109 109
110static ssize_t show_fan(struct device *dev, struct device_attribute *da, 110static ssize_t fan1_input_show(struct device *dev,
111 char *buf) 111 struct device_attribute *da, char *buf)
112{ 112{
113 struct g760a_data *data = g760a_update_client(dev); 113 struct g760a_data *data = g760a_update_client(dev);
114 unsigned int rpm = 0; 114 unsigned int rpm = 0;
@@ -121,8 +121,8 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *da,
121 return sprintf(buf, "%d\n", rpm); 121 return sprintf(buf, "%d\n", rpm);
122} 122}
123 123
124static ssize_t show_fan_alarm(struct device *dev, struct device_attribute *da, 124static ssize_t fan1_alarm_show(struct device *dev,
125 char *buf) 125 struct device_attribute *da, char *buf)
126{ 126{
127 struct g760a_data *data = g760a_update_client(dev); 127 struct g760a_data *data = g760a_update_client(dev);
128 128
@@ -131,16 +131,16 @@ static ssize_t show_fan_alarm(struct device *dev, struct device_attribute *da,
131 return sprintf(buf, "%d\n", fan_alarm); 131 return sprintf(buf, "%d\n", fan_alarm);
132} 132}
133 133
134static ssize_t get_pwm(struct device *dev, struct device_attribute *da, 134static ssize_t pwm1_show(struct device *dev, struct device_attribute *da,
135 char *buf) 135 char *buf)
136{ 136{
137 struct g760a_data *data = g760a_update_client(dev); 137 struct g760a_data *data = g760a_update_client(dev);
138 138
139 return sprintf(buf, "%d\n", PWM_FROM_CNT(data->set_cnt)); 139 return sprintf(buf, "%d\n", PWM_FROM_CNT(data->set_cnt));
140} 140}
141 141
142static ssize_t set_pwm(struct device *dev, struct device_attribute *da, 142static ssize_t pwm1_store(struct device *dev, struct device_attribute *da,
143 const char *buf, size_t count) 143 const char *buf, size_t count)
144{ 144{
145 struct g760a_data *data = g760a_update_client(dev); 145 struct g760a_data *data = g760a_update_client(dev);
146 struct i2c_client *client = data->client; 146 struct i2c_client *client = data->client;
@@ -157,9 +157,9 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *da,
157 return count; 157 return count;
158} 158}
159 159
160static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, get_pwm, set_pwm); 160static DEVICE_ATTR_RW(pwm1);
161static DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL); 161static DEVICE_ATTR_RO(fan1_input);
162static DEVICE_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL); 162static DEVICE_ATTR_RO(fan1_alarm);
163 163
164static struct attribute *g760a_attrs[] = { 164static struct attribute *g760a_attrs[] = {
165 &dev_attr_pwm1.attr, 165 &dev_attr_pwm1.attr,