summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/sch5627.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2018-12-10 17:02:19 -0500
committerGuenter Roeck <linux@roeck-us.net>2019-02-18 17:23:29 -0500
commit290dbb8ee4aa47794b41b9aec05c8d7b5e9cc429 (patch)
tree70a50bde85b8144ff0c3e0691d185b7a1299f380 /drivers/hwmon/sch5627.c
parente3a0ee1a8f3d5b404056cb969af9ba5b7ceccf95 (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.c146
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
214static ssize_t show_temp(struct device *dev, struct device_attribute 214static 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
228static ssize_t show_temp_fault(struct device *dev, struct device_attribute 228static 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
240static ssize_t show_temp_max(struct device *dev, struct device_attribute 240static 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
251static ssize_t show_temp_crit(struct device *dev, struct device_attribute 251static 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
262static ssize_t show_fan(struct device *dev, struct device_attribute 262static 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
279static ssize_t show_fan_fault(struct device *dev, struct device_attribute 279static 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
292static ssize_t show_fan_min(struct device *dev, struct device_attribute 292static 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
304static ssize_t show_in(struct device *dev, struct device_attribute 304static 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
320static ssize_t show_in_label(struct device *dev, struct device_attribute 320static 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
329static DEVICE_ATTR_RO(name); 329static DEVICE_ATTR_RO(name);
330static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); 330static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
331static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); 331static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1);
332static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); 332static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2);
333static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3); 333static SENSOR_DEVICE_ATTR_RO(temp4_input, temp, 3);
334static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp, NULL, 4); 334static SENSOR_DEVICE_ATTR_RO(temp5_input, temp, 4);
335static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp, NULL, 5); 335static SENSOR_DEVICE_ATTR_RO(temp6_input, temp, 5);
336static SENSOR_DEVICE_ATTR(temp7_input, S_IRUGO, show_temp, NULL, 6); 336static SENSOR_DEVICE_ATTR_RO(temp7_input, temp, 6);
337static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, show_temp, NULL, 7); 337static SENSOR_DEVICE_ATTR_RO(temp8_input, temp, 7);
338static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); 338static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0);
339static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); 339static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1);
340static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2); 340static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2);
341static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3); 341static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3);
342static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4); 342static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4);
343static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5); 343static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5);
344static SENSOR_DEVICE_ATTR(temp7_fault, S_IRUGO, show_temp_fault, NULL, 6); 344static SENSOR_DEVICE_ATTR_RO(temp7_fault, temp_fault, 6);
345static SENSOR_DEVICE_ATTR(temp8_fault, S_IRUGO, show_temp_fault, NULL, 7); 345static SENSOR_DEVICE_ATTR_RO(temp8_fault, temp_fault, 7);
346static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0); 346static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0);
347static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1); 347static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1);
348static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2); 348static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2);
349static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3); 349static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3);
350static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4); 350static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4);
351static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5); 351static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5);
352static SENSOR_DEVICE_ATTR(temp7_max, S_IRUGO, show_temp_max, NULL, 6); 352static SENSOR_DEVICE_ATTR_RO(temp7_max, temp_max, 6);
353static SENSOR_DEVICE_ATTR(temp8_max, S_IRUGO, show_temp_max, NULL, 7); 353static SENSOR_DEVICE_ATTR_RO(temp8_max, temp_max, 7);
354static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); 354static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0);
355static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1); 355static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1);
356static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2); 356static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2);
357static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3); 357static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3);
358static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4); 358static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4);
359static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5); 359static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5);
360static SENSOR_DEVICE_ATTR(temp7_crit, S_IRUGO, show_temp_crit, NULL, 6); 360static SENSOR_DEVICE_ATTR_RO(temp7_crit, temp_crit, 6);
361static SENSOR_DEVICE_ATTR(temp8_crit, S_IRUGO, show_temp_crit, NULL, 7); 361static SENSOR_DEVICE_ATTR_RO(temp8_crit, temp_crit, 7);
362 362
363static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); 363static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0);
364static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1); 364static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1);
365static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2); 365static SENSOR_DEVICE_ATTR_RO(fan3_input, fan, 2);
366static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3); 366static SENSOR_DEVICE_ATTR_RO(fan4_input, fan, 3);
367static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0); 367static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0);
368static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1); 368static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1);
369static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2); 369static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2);
370static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3); 370static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3);
371static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO, show_fan_min, NULL, 0); 371static SENSOR_DEVICE_ATTR_RO(fan1_min, fan_min, 0);
372static SENSOR_DEVICE_ATTR(fan2_min, S_IRUGO, show_fan_min, NULL, 1); 372static SENSOR_DEVICE_ATTR_RO(fan2_min, fan_min, 1);
373static SENSOR_DEVICE_ATTR(fan3_min, S_IRUGO, show_fan_min, NULL, 2); 373static SENSOR_DEVICE_ATTR_RO(fan3_min, fan_min, 2);
374static SENSOR_DEVICE_ATTR(fan4_min, S_IRUGO, show_fan_min, NULL, 3); 374static SENSOR_DEVICE_ATTR_RO(fan4_min, fan_min, 3);
375 375
376static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_in, NULL, 0); 376static SENSOR_DEVICE_ATTR_RO(in0_input, in, 0);
377static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_in, NULL, 1); 377static SENSOR_DEVICE_ATTR_RO(in1_input, in, 1);
378static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_in, NULL, 2); 378static SENSOR_DEVICE_ATTR_RO(in2_input, in, 2);
379static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_in, NULL, 3); 379static SENSOR_DEVICE_ATTR_RO(in3_input, in, 3);
380static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_in, NULL, 4); 380static SENSOR_DEVICE_ATTR_RO(in4_input, in, 4);
381static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_in_label, NULL, 0); 381static SENSOR_DEVICE_ATTR_RO(in0_label, in_label, 0);
382static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_in_label, NULL, 1); 382static SENSOR_DEVICE_ATTR_RO(in1_label, in_label, 1);
383static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_in_label, NULL, 2); 383static SENSOR_DEVICE_ATTR_RO(in2_label, in_label, 2);
384static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_in_label, NULL, 3); 384static SENSOR_DEVICE_ATTR_RO(in3_label, in_label, 3);
385 385
386static struct attribute *sch5627_attributes[] = { 386static struct attribute *sch5627_attributes[] = {
387 &dev_attr_name.attr, 387 &dev_attr_name.attr,