diff options
author | Guenter Roeck <linux@roeck-us.net> | 2018-12-10 17:02:19 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-02-18 17:23:29 -0500 |
commit | 290dbb8ee4aa47794b41b9aec05c8d7b5e9cc429 (patch) | |
tree | 70a50bde85b8144ff0c3e0691d185b7a1299f380 /drivers/hwmon/sch5627.c | |
parent | e3a0ee1a8f3d5b404056cb969af9ba5b7ceccf95 (diff) |
hwmon: (sch5627) Use permission specific SENSOR[_DEVICE]_ATTR variants
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readability, and to reduce the chance of inconsistencies.
Also replace any remaining S_<PERMS> in the driver with octal values.
The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/hwmon/.
This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/sch5627.c')
-rw-r--r-- | drivers/hwmon/sch5627.c | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c index 91544f2312e6..63cfbc5a86ed 100644 --- a/drivers/hwmon/sch5627.c +++ b/drivers/hwmon/sch5627.c | |||
@@ -211,8 +211,8 @@ static ssize_t name_show(struct device *dev, struct device_attribute *devattr, | |||
211 | return snprintf(buf, PAGE_SIZE, "%s\n", DEVNAME); | 211 | return snprintf(buf, PAGE_SIZE, "%s\n", DEVNAME); |
212 | } | 212 | } |
213 | 213 | ||
214 | static ssize_t show_temp(struct device *dev, struct device_attribute | 214 | static ssize_t temp_show(struct device *dev, struct device_attribute *devattr, |
215 | *devattr, char *buf) | 215 | char *buf) |
216 | { | 216 | { |
217 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 217 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
218 | struct sch5627_data *data = sch5627_update_device(dev); | 218 | struct sch5627_data *data = sch5627_update_device(dev); |
@@ -225,8 +225,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute | |||
225 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | 225 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
226 | } | 226 | } |
227 | 227 | ||
228 | static ssize_t show_temp_fault(struct device *dev, struct device_attribute | 228 | static ssize_t temp_fault_show(struct device *dev, |
229 | *devattr, char *buf) | 229 | struct device_attribute *devattr, char *buf) |
230 | { | 230 | { |
231 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 231 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
232 | struct sch5627_data *data = sch5627_update_device(dev); | 232 | struct sch5627_data *data = sch5627_update_device(dev); |
@@ -237,8 +237,8 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attribute | |||
237 | return snprintf(buf, PAGE_SIZE, "%d\n", data->temp[attr->index] == 0); | 237 | return snprintf(buf, PAGE_SIZE, "%d\n", data->temp[attr->index] == 0); |
238 | } | 238 | } |
239 | 239 | ||
240 | static ssize_t show_temp_max(struct device *dev, struct device_attribute | 240 | static ssize_t temp_max_show(struct device *dev, |
241 | *devattr, char *buf) | 241 | struct device_attribute *devattr, char *buf) |
242 | { | 242 | { |
243 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 243 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
244 | struct sch5627_data *data = dev_get_drvdata(dev); | 244 | struct sch5627_data *data = dev_get_drvdata(dev); |
@@ -248,8 +248,8 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute | |||
248 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | 248 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
249 | } | 249 | } |
250 | 250 | ||
251 | static ssize_t show_temp_crit(struct device *dev, struct device_attribute | 251 | static ssize_t temp_crit_show(struct device *dev, |
252 | *devattr, char *buf) | 252 | struct device_attribute *devattr, char *buf) |
253 | { | 253 | { |
254 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 254 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
255 | struct sch5627_data *data = dev_get_drvdata(dev); | 255 | struct sch5627_data *data = dev_get_drvdata(dev); |
@@ -259,8 +259,8 @@ static ssize_t show_temp_crit(struct device *dev, struct device_attribute | |||
259 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | 259 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
260 | } | 260 | } |
261 | 261 | ||
262 | static ssize_t show_fan(struct device *dev, struct device_attribute | 262 | static ssize_t fan_show(struct device *dev, struct device_attribute *devattr, |
263 | *devattr, char *buf) | 263 | char *buf) |
264 | { | 264 | { |
265 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 265 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
266 | struct sch5627_data *data = sch5627_update_device(dev); | 266 | struct sch5627_data *data = sch5627_update_device(dev); |
@@ -276,8 +276,8 @@ static ssize_t show_fan(struct device *dev, struct device_attribute | |||
276 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | 276 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
277 | } | 277 | } |
278 | 278 | ||
279 | static ssize_t show_fan_fault(struct device *dev, struct device_attribute | 279 | static ssize_t fan_fault_show(struct device *dev, |
280 | *devattr, char *buf) | 280 | struct device_attribute *devattr, char *buf) |
281 | { | 281 | { |
282 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 282 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
283 | struct sch5627_data *data = sch5627_update_device(dev); | 283 | struct sch5627_data *data = sch5627_update_device(dev); |
@@ -289,8 +289,8 @@ static ssize_t show_fan_fault(struct device *dev, struct device_attribute | |||
289 | data->fan[attr->index] == 0xffff); | 289 | data->fan[attr->index] == 0xffff); |
290 | } | 290 | } |
291 | 291 | ||
292 | static ssize_t show_fan_min(struct device *dev, struct device_attribute | 292 | static ssize_t fan_min_show(struct device *dev, |
293 | *devattr, char *buf) | 293 | struct device_attribute *devattr, char *buf) |
294 | { | 294 | { |
295 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 295 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
296 | struct sch5627_data *data = dev_get_drvdata(dev); | 296 | struct sch5627_data *data = dev_get_drvdata(dev); |
@@ -301,8 +301,8 @@ static ssize_t show_fan_min(struct device *dev, struct device_attribute | |||
301 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | 301 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
302 | } | 302 | } |
303 | 303 | ||
304 | static ssize_t show_in(struct device *dev, struct device_attribute | 304 | static ssize_t in_show(struct device *dev, struct device_attribute *devattr, |
305 | *devattr, char *buf) | 305 | char *buf) |
306 | { | 306 | { |
307 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 307 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
308 | struct sch5627_data *data = sch5627_update_device(dev); | 308 | struct sch5627_data *data = sch5627_update_device(dev); |
@@ -317,8 +317,8 @@ static ssize_t show_in(struct device *dev, struct device_attribute | |||
317 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | 317 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
318 | } | 318 | } |
319 | 319 | ||
320 | static ssize_t show_in_label(struct device *dev, struct device_attribute | 320 | static ssize_t in_label_show(struct device *dev, |
321 | *devattr, char *buf) | 321 | struct device_attribute *devattr, char *buf) |
322 | { | 322 | { |
323 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 323 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
324 | 324 | ||
@@ -327,61 +327,61 @@ static ssize_t show_in_label(struct device *dev, struct device_attribute | |||
327 | } | 327 | } |
328 | 328 | ||
329 | static DEVICE_ATTR_RO(name); | 329 | static DEVICE_ATTR_RO(name); |
330 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); | 330 | static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0); |
331 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); | 331 | static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1); |
332 | static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); | 332 | static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2); |
333 | static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3); | 333 | static SENSOR_DEVICE_ATTR_RO(temp4_input, temp, 3); |
334 | static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp, NULL, 4); | 334 | static SENSOR_DEVICE_ATTR_RO(temp5_input, temp, 4); |
335 | static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp, NULL, 5); | 335 | static SENSOR_DEVICE_ATTR_RO(temp6_input, temp, 5); |
336 | static SENSOR_DEVICE_ATTR(temp7_input, S_IRUGO, show_temp, NULL, 6); | 336 | static SENSOR_DEVICE_ATTR_RO(temp7_input, temp, 6); |
337 | static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, show_temp, NULL, 7); | 337 | static SENSOR_DEVICE_ATTR_RO(temp8_input, temp, 7); |
338 | static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); | 338 | static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0); |
339 | static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); | 339 | static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1); |
340 | static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2); | 340 | static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2); |
341 | static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3); | 341 | static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3); |
342 | static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4); | 342 | static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4); |
343 | static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5); | 343 | static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5); |
344 | static SENSOR_DEVICE_ATTR(temp7_fault, S_IRUGO, show_temp_fault, NULL, 6); | 344 | static SENSOR_DEVICE_ATTR_RO(temp7_fault, temp_fault, 6); |
345 | static SENSOR_DEVICE_ATTR(temp8_fault, S_IRUGO, show_temp_fault, NULL, 7); | 345 | static SENSOR_DEVICE_ATTR_RO(temp8_fault, temp_fault, 7); |
346 | static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0); | 346 | static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0); |
347 | static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1); | 347 | static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1); |
348 | static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2); | 348 | static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2); |
349 | static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3); | 349 | static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3); |
350 | static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4); | 350 | static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4); |
351 | static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5); | 351 | static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5); |
352 | static SENSOR_DEVICE_ATTR(temp7_max, S_IRUGO, show_temp_max, NULL, 6); | 352 | static SENSOR_DEVICE_ATTR_RO(temp7_max, temp_max, 6); |
353 | static SENSOR_DEVICE_ATTR(temp8_max, S_IRUGO, show_temp_max, NULL, 7); | 353 | static SENSOR_DEVICE_ATTR_RO(temp8_max, temp_max, 7); |
354 | static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); | 354 | static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0); |
355 | static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1); | 355 | static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1); |
356 | static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2); | 356 | static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2); |
357 | static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3); | 357 | static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3); |
358 | static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4); | 358 | static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4); |
359 | static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5); | 359 | static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5); |
360 | static SENSOR_DEVICE_ATTR(temp7_crit, S_IRUGO, show_temp_crit, NULL, 6); | 360 | static SENSOR_DEVICE_ATTR_RO(temp7_crit, temp_crit, 6); |
361 | static SENSOR_DEVICE_ATTR(temp8_crit, S_IRUGO, show_temp_crit, NULL, 7); | 361 | static SENSOR_DEVICE_ATTR_RO(temp8_crit, temp_crit, 7); |
362 | 362 | ||
363 | static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); | 363 | static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0); |
364 | static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1); | 364 | static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1); |
365 | static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2); | 365 | static SENSOR_DEVICE_ATTR_RO(fan3_input, fan, 2); |
366 | static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3); | 366 | static SENSOR_DEVICE_ATTR_RO(fan4_input, fan, 3); |
367 | static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0); | 367 | static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0); |
368 | static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1); | 368 | static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1); |
369 | static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2); | 369 | static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2); |
370 | static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3); | 370 | static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3); |
371 | static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO, show_fan_min, NULL, 0); | 371 | static SENSOR_DEVICE_ATTR_RO(fan1_min, fan_min, 0); |
372 | static SENSOR_DEVICE_ATTR(fan2_min, S_IRUGO, show_fan_min, NULL, 1); | 372 | static SENSOR_DEVICE_ATTR_RO(fan2_min, fan_min, 1); |
373 | static SENSOR_DEVICE_ATTR(fan3_min, S_IRUGO, show_fan_min, NULL, 2); | 373 | static SENSOR_DEVICE_ATTR_RO(fan3_min, fan_min, 2); |
374 | static SENSOR_DEVICE_ATTR(fan4_min, S_IRUGO, show_fan_min, NULL, 3); | 374 | static SENSOR_DEVICE_ATTR_RO(fan4_min, fan_min, 3); |
375 | 375 | ||
376 | static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_in, NULL, 0); | 376 | static SENSOR_DEVICE_ATTR_RO(in0_input, in, 0); |
377 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_in, NULL, 1); | 377 | static SENSOR_DEVICE_ATTR_RO(in1_input, in, 1); |
378 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_in, NULL, 2); | 378 | static SENSOR_DEVICE_ATTR_RO(in2_input, in, 2); |
379 | static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_in, NULL, 3); | 379 | static SENSOR_DEVICE_ATTR_RO(in3_input, in, 3); |
380 | static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_in, NULL, 4); | 380 | static SENSOR_DEVICE_ATTR_RO(in4_input, in, 4); |
381 | static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_in_label, NULL, 0); | 381 | static SENSOR_DEVICE_ATTR_RO(in0_label, in_label, 0); |
382 | static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_in_label, NULL, 1); | 382 | static SENSOR_DEVICE_ATTR_RO(in1_label, in_label, 1); |
383 | static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_in_label, NULL, 2); | 383 | static SENSOR_DEVICE_ATTR_RO(in2_label, in_label, 2); |
384 | static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_in_label, NULL, 3); | 384 | static SENSOR_DEVICE_ATTR_RO(in3_label, in_label, 3); |
385 | 385 | ||
386 | static struct attribute *sch5627_attributes[] = { | 386 | static struct attribute *sch5627_attributes[] = { |
387 | &dev_attr_name.attr, | 387 | &dev_attr_name.attr, |