aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2018-12-10 17:02:18 -0500
committerGuenter Roeck <linux@roeck-us.net>2019-02-18 17:23:29 -0500
commit86b9f565002954d32983f424a795f070ec6f6bbf (patch)
treec4048e3fd187431629de26b8eb15d2b948d4500d /drivers/hwmon
parenteba42d30fb11377e731cfea9ab65802177b81cde (diff)
hwmon: (pc87427) 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. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/pc87427.c317
1 files changed, 146 insertions, 171 deletions
diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c
index dc5a9d5ada51..d1a3f2040c00 100644
--- a/drivers/hwmon/pc87427.c
+++ b/drivers/hwmon/pc87427.c
@@ -384,8 +384,8 @@ done:
384 return data; 384 return data;
385} 385}
386 386
387static ssize_t show_fan_input(struct device *dev, struct device_attribute 387static ssize_t fan_input_show(struct device *dev,
388 *devattr, char *buf) 388 struct device_attribute *devattr, char *buf)
389{ 389{
390 struct pc87427_data *data = pc87427_update_device(dev); 390 struct pc87427_data *data = pc87427_update_device(dev);
391 int nr = to_sensor_dev_attr(devattr)->index; 391 int nr = to_sensor_dev_attr(devattr)->index;
@@ -393,8 +393,8 @@ static ssize_t show_fan_input(struct device *dev, struct device_attribute
393 return sprintf(buf, "%lu\n", fan_from_reg(data->fan[nr])); 393 return sprintf(buf, "%lu\n", fan_from_reg(data->fan[nr]));
394} 394}
395 395
396static ssize_t show_fan_min(struct device *dev, struct device_attribute 396static ssize_t fan_min_show(struct device *dev,
397 *devattr, char *buf) 397 struct device_attribute *devattr, char *buf)
398{ 398{
399 struct pc87427_data *data = pc87427_update_device(dev); 399 struct pc87427_data *data = pc87427_update_device(dev);
400 int nr = to_sensor_dev_attr(devattr)->index; 400 int nr = to_sensor_dev_attr(devattr)->index;
@@ -402,8 +402,8 @@ static ssize_t show_fan_min(struct device *dev, struct device_attribute
402 return sprintf(buf, "%lu\n", fan_from_reg(data->fan_min[nr])); 402 return sprintf(buf, "%lu\n", fan_from_reg(data->fan_min[nr]));
403} 403}
404 404
405static ssize_t show_fan_alarm(struct device *dev, struct device_attribute 405static ssize_t fan_alarm_show(struct device *dev,
406 *devattr, char *buf) 406 struct device_attribute *devattr, char *buf)
407{ 407{
408 struct pc87427_data *data = pc87427_update_device(dev); 408 struct pc87427_data *data = pc87427_update_device(dev);
409 int nr = to_sensor_dev_attr(devattr)->index; 409 int nr = to_sensor_dev_attr(devattr)->index;
@@ -412,8 +412,8 @@ static ssize_t show_fan_alarm(struct device *dev, struct device_attribute
412 & FAN_STATUS_LOSPD)); 412 & FAN_STATUS_LOSPD));
413} 413}
414 414
415static ssize_t show_fan_fault(struct device *dev, struct device_attribute 415static ssize_t fan_fault_show(struct device *dev,
416 *devattr, char *buf) 416 struct device_attribute *devattr, char *buf)
417{ 417{
418 struct pc87427_data *data = pc87427_update_device(dev); 418 struct pc87427_data *data = pc87427_update_device(dev);
419 int nr = to_sensor_dev_attr(devattr)->index; 419 int nr = to_sensor_dev_attr(devattr)->index;
@@ -422,8 +422,9 @@ static ssize_t show_fan_fault(struct device *dev, struct device_attribute
422 & FAN_STATUS_STALL)); 422 & FAN_STATUS_STALL));
423} 423}
424 424
425static ssize_t set_fan_min(struct device *dev, struct device_attribute 425static ssize_t fan_min_store(struct device *dev,
426 *devattr, const char *buf, size_t count) 426 struct device_attribute *devattr,
427 const char *buf, size_t count)
427{ 428{
428 struct pc87427_data *data = dev_get_drvdata(dev); 429 struct pc87427_data *data = dev_get_drvdata(dev);
429 int nr = to_sensor_dev_attr(devattr)->index; 430 int nr = to_sensor_dev_attr(devattr)->index;
@@ -449,49 +450,41 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute
449 return count; 450 return count;
450} 451}
451 452
452static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan_input, NULL, 0); 453static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0);
453static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan_input, NULL, 1); 454static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 1);
454static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan_input, NULL, 2); 455static SENSOR_DEVICE_ATTR_RO(fan3_input, fan_input, 2);
455static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan_input, NULL, 3); 456static SENSOR_DEVICE_ATTR_RO(fan4_input, fan_input, 3);
456static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_fan_input, NULL, 4); 457static SENSOR_DEVICE_ATTR_RO(fan5_input, fan_input, 4);
457static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_fan_input, NULL, 5); 458static SENSOR_DEVICE_ATTR_RO(fan6_input, fan_input, 5);
458static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_fan_input, NULL, 6); 459static SENSOR_DEVICE_ATTR_RO(fan7_input, fan_input, 6);
459static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_fan_input, NULL, 7); 460static SENSOR_DEVICE_ATTR_RO(fan8_input, fan_input, 7);
460 461
461static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, 462static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0);
462 show_fan_min, set_fan_min, 0); 463static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1);
463static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO, 464static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2);
464 show_fan_min, set_fan_min, 1); 465static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3);
465static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO, 466static SENSOR_DEVICE_ATTR_RW(fan5_min, fan_min, 4);
466 show_fan_min, set_fan_min, 2); 467static SENSOR_DEVICE_ATTR_RW(fan6_min, fan_min, 5);
467static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO, 468static SENSOR_DEVICE_ATTR_RW(fan7_min, fan_min, 6);
468 show_fan_min, set_fan_min, 3); 469static SENSOR_DEVICE_ATTR_RW(fan8_min, fan_min, 7);
469static SENSOR_DEVICE_ATTR(fan5_min, S_IWUSR | S_IRUGO, 470
470 show_fan_min, set_fan_min, 4); 471static SENSOR_DEVICE_ATTR_RO(fan1_alarm, fan_alarm, 0);
471static SENSOR_DEVICE_ATTR(fan6_min, S_IWUSR | S_IRUGO, 472static SENSOR_DEVICE_ATTR_RO(fan2_alarm, fan_alarm, 1);
472 show_fan_min, set_fan_min, 5); 473static SENSOR_DEVICE_ATTR_RO(fan3_alarm, fan_alarm, 2);
473static SENSOR_DEVICE_ATTR(fan7_min, S_IWUSR | S_IRUGO, 474static SENSOR_DEVICE_ATTR_RO(fan4_alarm, fan_alarm, 3);
474 show_fan_min, set_fan_min, 6); 475static SENSOR_DEVICE_ATTR_RO(fan5_alarm, fan_alarm, 4);
475static SENSOR_DEVICE_ATTR(fan8_min, S_IWUSR | S_IRUGO, 476static SENSOR_DEVICE_ATTR_RO(fan6_alarm, fan_alarm, 5);
476 show_fan_min, set_fan_min, 7); 477static SENSOR_DEVICE_ATTR_RO(fan7_alarm, fan_alarm, 6);
477 478static SENSOR_DEVICE_ATTR_RO(fan8_alarm, fan_alarm, 7);
478static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0); 479
479static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1); 480static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0);
480static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 2); 481static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1);
481static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 3); 482static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2);
482static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_fan_alarm, NULL, 4); 483static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3);
483static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_fan_alarm, NULL, 5); 484static SENSOR_DEVICE_ATTR_RO(fan5_fault, fan_fault, 4);
484static SENSOR_DEVICE_ATTR(fan7_alarm, S_IRUGO, show_fan_alarm, NULL, 6); 485static SENSOR_DEVICE_ATTR_RO(fan6_fault, fan_fault, 5);
485static SENSOR_DEVICE_ATTR(fan8_alarm, S_IRUGO, show_fan_alarm, NULL, 7); 486static SENSOR_DEVICE_ATTR_RO(fan7_fault, fan_fault, 6);
486 487static SENSOR_DEVICE_ATTR_RO(fan8_fault, fan_fault, 7);
487static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0);
488static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1);
489static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2);
490static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3);
491static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, show_fan_fault, NULL, 4);
492static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, show_fan_fault, NULL, 5);
493static SENSOR_DEVICE_ATTR(fan7_fault, S_IRUGO, show_fan_fault, NULL, 6);
494static SENSOR_DEVICE_ATTR(fan8_fault, S_IRUGO, show_fan_fault, NULL, 7);
495 488
496static struct attribute *pc87427_attributes_fan[8][5] = { 489static struct attribute *pc87427_attributes_fan[8][5] = {
497 { 490 {
@@ -568,8 +561,8 @@ static void update_pwm_enable(struct pc87427_data *data, int nr, u8 mode)
568 outb(data->pwm_enable[nr], iobase + PC87427_REG_PWM_ENABLE); 561 outb(data->pwm_enable[nr], iobase + PC87427_REG_PWM_ENABLE);
569} 562}
570 563
571static ssize_t show_pwm_enable(struct device *dev, struct device_attribute 564static ssize_t pwm_enable_show(struct device *dev,
572 *devattr, char *buf) 565 struct device_attribute *devattr, char *buf)
573{ 566{
574 struct pc87427_data *data = pc87427_update_device(dev); 567 struct pc87427_data *data = pc87427_update_device(dev);
575 int nr = to_sensor_dev_attr(devattr)->index; 568 int nr = to_sensor_dev_attr(devattr)->index;
@@ -581,8 +574,9 @@ static ssize_t show_pwm_enable(struct device *dev, struct device_attribute
581 return sprintf(buf, "%d\n", pwm_enable); 574 return sprintf(buf, "%d\n", pwm_enable);
582} 575}
583 576
584static ssize_t set_pwm_enable(struct device *dev, struct device_attribute 577static ssize_t pwm_enable_store(struct device *dev,
585 *devattr, const char *buf, size_t count) 578 struct device_attribute *devattr,
579 const char *buf, size_t count)
586{ 580{
587 struct pc87427_data *data = dev_get_drvdata(dev); 581 struct pc87427_data *data = dev_get_drvdata(dev);
588 int nr = to_sensor_dev_attr(devattr)->index; 582 int nr = to_sensor_dev_attr(devattr)->index;
@@ -602,8 +596,8 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute
602 return count; 596 return count;
603} 597}
604 598
605static ssize_t show_pwm(struct device *dev, struct device_attribute 599static ssize_t pwm_show(struct device *dev, struct device_attribute *devattr,
606 *devattr, char *buf) 600 char *buf)
607{ 601{
608 struct pc87427_data *data = pc87427_update_device(dev); 602 struct pc87427_data *data = pc87427_update_device(dev);
609 int nr = to_sensor_dev_attr(devattr)->index; 603 int nr = to_sensor_dev_attr(devattr)->index;
@@ -611,8 +605,8 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute
611 return sprintf(buf, "%d\n", (int)data->pwm[nr]); 605 return sprintf(buf, "%d\n", (int)data->pwm[nr]);
612} 606}
613 607
614static ssize_t set_pwm(struct device *dev, struct device_attribute 608static ssize_t pwm_store(struct device *dev, struct device_attribute *devattr,
615 *devattr, const char *buf, size_t count) 609 const char *buf, size_t count)
616{ 610{
617 struct pc87427_data *data = dev_get_drvdata(dev); 611 struct pc87427_data *data = dev_get_drvdata(dev);
618 int nr = to_sensor_dev_attr(devattr)->index; 612 int nr = to_sensor_dev_attr(devattr)->index;
@@ -657,19 +651,15 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute
657 return count; 651 return count;
658} 652}
659 653
660static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, 654static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_enable, 0);
661 show_pwm_enable, set_pwm_enable, 0); 655static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_enable, 1);
662static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO, 656static SENSOR_DEVICE_ATTR_RW(pwm3_enable, pwm_enable, 2);
663 show_pwm_enable, set_pwm_enable, 1); 657static SENSOR_DEVICE_ATTR_RW(pwm4_enable, pwm_enable, 3);
664static SENSOR_DEVICE_ATTR(pwm3_enable, S_IWUSR | S_IRUGO,
665 show_pwm_enable, set_pwm_enable, 2);
666static SENSOR_DEVICE_ATTR(pwm4_enable, S_IWUSR | S_IRUGO,
667 show_pwm_enable, set_pwm_enable, 3);
668 658
669static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); 659static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0);
670static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); 660static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1);
671static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); 661static SENSOR_DEVICE_ATTR_RW(pwm3, pwm, 2);
672static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3); 662static SENSOR_DEVICE_ATTR_RW(pwm4, pwm, 3);
673 663
674static struct attribute *pc87427_attributes_pwm[4][3] = { 664static struct attribute *pc87427_attributes_pwm[4][3] = {
675 { 665 {
@@ -698,8 +688,8 @@ static const struct attribute_group pc87427_group_pwm[4] = {
698 { .attrs = pc87427_attributes_pwm[3] }, 688 { .attrs = pc87427_attributes_pwm[3] },
699}; 689};
700 690
701static ssize_t show_temp_input(struct device *dev, struct device_attribute 691static ssize_t temp_input_show(struct device *dev,
702 *devattr, char *buf) 692 struct device_attribute *devattr, char *buf)
703{ 693{
704 struct pc87427_data *data = pc87427_update_device(dev); 694 struct pc87427_data *data = pc87427_update_device(dev);
705 int nr = to_sensor_dev_attr(devattr)->index; 695 int nr = to_sensor_dev_attr(devattr)->index;
@@ -707,8 +697,8 @@ static ssize_t show_temp_input(struct device *dev, struct device_attribute
707 return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr])); 697 return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr]));
708} 698}
709 699
710static ssize_t show_temp_min(struct device *dev, struct device_attribute 700static ssize_t temp_min_show(struct device *dev,
711 *devattr, char *buf) 701 struct device_attribute *devattr, char *buf)
712{ 702{
713 struct pc87427_data *data = pc87427_update_device(dev); 703 struct pc87427_data *data = pc87427_update_device(dev);
714 int nr = to_sensor_dev_attr(devattr)->index; 704 int nr = to_sensor_dev_attr(devattr)->index;
@@ -716,8 +706,8 @@ static ssize_t show_temp_min(struct device *dev, struct device_attribute
716 return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_min[nr])); 706 return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_min[nr]));
717} 707}
718 708
719static ssize_t show_temp_max(struct device *dev, struct device_attribute 709static ssize_t temp_max_show(struct device *dev,
720 *devattr, char *buf) 710 struct device_attribute *devattr, char *buf)
721{ 711{
722 struct pc87427_data *data = pc87427_update_device(dev); 712 struct pc87427_data *data = pc87427_update_device(dev);
723 int nr = to_sensor_dev_attr(devattr)->index; 713 int nr = to_sensor_dev_attr(devattr)->index;
@@ -725,8 +715,8 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute
725 return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_max[nr])); 715 return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_max[nr]));
726} 716}
727 717
728static ssize_t show_temp_crit(struct device *dev, struct device_attribute 718static ssize_t temp_crit_show(struct device *dev,
729 *devattr, char *buf) 719 struct device_attribute *devattr, char *buf)
730{ 720{
731 struct pc87427_data *data = pc87427_update_device(dev); 721 struct pc87427_data *data = pc87427_update_device(dev);
732 int nr = to_sensor_dev_attr(devattr)->index; 722 int nr = to_sensor_dev_attr(devattr)->index;
@@ -734,8 +724,8 @@ static ssize_t show_temp_crit(struct device *dev, struct device_attribute
734 return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_crit[nr])); 724 return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_crit[nr]));
735} 725}
736 726
737static ssize_t show_temp_type(struct device *dev, struct device_attribute 727static ssize_t temp_type_show(struct device *dev,
738 *devattr, char *buf) 728 struct device_attribute *devattr, char *buf)
739{ 729{
740 struct pc87427_data *data = pc87427_update_device(dev); 730 struct pc87427_data *data = pc87427_update_device(dev);
741 int nr = to_sensor_dev_attr(devattr)->index; 731 int nr = to_sensor_dev_attr(devattr)->index;
@@ -743,8 +733,9 @@ static ssize_t show_temp_type(struct device *dev, struct device_attribute
743 return sprintf(buf, "%u\n", temp_type_from_reg(data->temp_type[nr])); 733 return sprintf(buf, "%u\n", temp_type_from_reg(data->temp_type[nr]));
744} 734}
745 735
746static ssize_t show_temp_min_alarm(struct device *dev, struct device_attribute 736static ssize_t temp_min_alarm_show(struct device *dev,
747 *devattr, char *buf) 737 struct device_attribute *devattr,
738 char *buf)
748{ 739{
749 struct pc87427_data *data = pc87427_update_device(dev); 740 struct pc87427_data *data = pc87427_update_device(dev);
750 int nr = to_sensor_dev_attr(devattr)->index; 741 int nr = to_sensor_dev_attr(devattr)->index;
@@ -753,8 +744,9 @@ static ssize_t show_temp_min_alarm(struct device *dev, struct device_attribute
753 & TEMP_STATUS_LOWFLG)); 744 & TEMP_STATUS_LOWFLG));
754} 745}
755 746
756static ssize_t show_temp_max_alarm(struct device *dev, struct device_attribute 747static ssize_t temp_max_alarm_show(struct device *dev,
757 *devattr, char *buf) 748 struct device_attribute *devattr,
749 char *buf)
758{ 750{
759 struct pc87427_data *data = pc87427_update_device(dev); 751 struct pc87427_data *data = pc87427_update_device(dev);
760 int nr = to_sensor_dev_attr(devattr)->index; 752 int nr = to_sensor_dev_attr(devattr)->index;
@@ -763,8 +755,9 @@ static ssize_t show_temp_max_alarm(struct device *dev, struct device_attribute
763 & TEMP_STATUS_HIGHFLG)); 755 & TEMP_STATUS_HIGHFLG));
764} 756}
765 757
766static ssize_t show_temp_crit_alarm(struct device *dev, struct device_attribute 758static ssize_t temp_crit_alarm_show(struct device *dev,
767 *devattr, char *buf) 759 struct device_attribute *devattr,
760 char *buf)
768{ 761{
769 struct pc87427_data *data = pc87427_update_device(dev); 762 struct pc87427_data *data = pc87427_update_device(dev);
770 int nr = to_sensor_dev_attr(devattr)->index; 763 int nr = to_sensor_dev_attr(devattr)->index;
@@ -773,8 +766,8 @@ static ssize_t show_temp_crit_alarm(struct device *dev, struct device_attribute
773 & TEMP_STATUS_CRITFLG)); 766 & TEMP_STATUS_CRITFLG));
774} 767}
775 768
776static ssize_t show_temp_fault(struct device *dev, struct device_attribute 769static ssize_t temp_fault_show(struct device *dev,
777 *devattr, char *buf) 770 struct device_attribute *devattr, char *buf)
778{ 771{
779 struct pc87427_data *data = pc87427_update_device(dev); 772 struct pc87427_data *data = pc87427_update_device(dev);
780 int nr = to_sensor_dev_attr(devattr)->index; 773 int nr = to_sensor_dev_attr(devattr)->index;
@@ -783,86 +776,68 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attribute
783 & TEMP_STATUS_SENSERR)); 776 & TEMP_STATUS_SENSERR));
784} 777}
785 778
786static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0); 779static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0);
787static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input, NULL, 1); 780static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 1);
788static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp_input, NULL, 2); 781static SENSOR_DEVICE_ATTR_RO(temp3_input, temp_input, 2);
789static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp_input, NULL, 3); 782static SENSOR_DEVICE_ATTR_RO(temp4_input, temp_input, 3);
790static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp_input, NULL, 4); 783static SENSOR_DEVICE_ATTR_RO(temp5_input, temp_input, 4);
791static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp_input, NULL, 5); 784static SENSOR_DEVICE_ATTR_RO(temp6_input, temp_input, 5);
792 785
793static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO, show_temp_min, NULL, 0); 786static SENSOR_DEVICE_ATTR_RO(temp1_min, temp_min, 0);
794static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO, show_temp_min, NULL, 1); 787static SENSOR_DEVICE_ATTR_RO(temp2_min, temp_min, 1);
795static SENSOR_DEVICE_ATTR(temp3_min, S_IRUGO, show_temp_min, NULL, 2); 788static SENSOR_DEVICE_ATTR_RO(temp3_min, temp_min, 2);
796static SENSOR_DEVICE_ATTR(temp4_min, S_IRUGO, show_temp_min, NULL, 3); 789static SENSOR_DEVICE_ATTR_RO(temp4_min, temp_min, 3);
797static SENSOR_DEVICE_ATTR(temp5_min, S_IRUGO, show_temp_min, NULL, 4); 790static SENSOR_DEVICE_ATTR_RO(temp5_min, temp_min, 4);
798static SENSOR_DEVICE_ATTR(temp6_min, S_IRUGO, show_temp_min, NULL, 5); 791static SENSOR_DEVICE_ATTR_RO(temp6_min, temp_min, 5);
799 792
800static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0); 793static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0);
801static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1); 794static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1);
802static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2); 795static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2);
803static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3); 796static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3);
804static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4); 797static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4);
805static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5); 798static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5);
806 799
807static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); 800static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0);
808static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1); 801static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1);
809static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2); 802static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2);
810static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3); 803static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3);
811static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4); 804static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4);
812static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5); 805static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5);
813 806
814static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0); 807static SENSOR_DEVICE_ATTR_RO(temp1_type, temp_type, 0);
815static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1); 808static SENSOR_DEVICE_ATTR_RO(temp2_type, temp_type, 1);
816static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2); 809static SENSOR_DEVICE_ATTR_RO(temp3_type, temp_type, 2);
817static SENSOR_DEVICE_ATTR(temp4_type, S_IRUGO, show_temp_type, NULL, 3); 810static SENSOR_DEVICE_ATTR_RO(temp4_type, temp_type, 3);
818static SENSOR_DEVICE_ATTR(temp5_type, S_IRUGO, show_temp_type, NULL, 4); 811static SENSOR_DEVICE_ATTR_RO(temp5_type, temp_type, 4);
819static SENSOR_DEVICE_ATTR(temp6_type, S_IRUGO, show_temp_type, NULL, 5); 812static SENSOR_DEVICE_ATTR_RO(temp6_type, temp_type, 5);
820 813
821static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, 814static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, temp_min_alarm, 0);
822 show_temp_min_alarm, NULL, 0); 815static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, temp_min_alarm, 1);
823static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, 816static SENSOR_DEVICE_ATTR_RO(temp3_min_alarm, temp_min_alarm, 2);
824 show_temp_min_alarm, NULL, 1); 817static SENSOR_DEVICE_ATTR_RO(temp4_min_alarm, temp_min_alarm, 3);
825static SENSOR_DEVICE_ATTR(temp3_min_alarm, S_IRUGO, 818static SENSOR_DEVICE_ATTR_RO(temp5_min_alarm, temp_min_alarm, 4);
826 show_temp_min_alarm, NULL, 2); 819static SENSOR_DEVICE_ATTR_RO(temp6_min_alarm, temp_min_alarm, 5);
827static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, 820
828 show_temp_min_alarm, NULL, 3); 821static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, temp_max_alarm, 0);
829static SENSOR_DEVICE_ATTR(temp5_min_alarm, S_IRUGO, 822static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, temp_max_alarm, 1);
830 show_temp_min_alarm, NULL, 4); 823static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, temp_max_alarm, 2);
831static SENSOR_DEVICE_ATTR(temp6_min_alarm, S_IRUGO, 824static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, temp_max_alarm, 3);
832 show_temp_min_alarm, NULL, 5); 825static SENSOR_DEVICE_ATTR_RO(temp5_max_alarm, temp_max_alarm, 4);
833 826static SENSOR_DEVICE_ATTR_RO(temp6_max_alarm, temp_max_alarm, 5);
834static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, 827
835 show_temp_max_alarm, NULL, 0); 828static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, temp_crit_alarm, 0);
836static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, 829static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, temp_crit_alarm, 1);
837 show_temp_max_alarm, NULL, 1); 830static SENSOR_DEVICE_ATTR_RO(temp3_crit_alarm, temp_crit_alarm, 2);
838static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, 831static SENSOR_DEVICE_ATTR_RO(temp4_crit_alarm, temp_crit_alarm, 3);
839 show_temp_max_alarm, NULL, 2); 832static SENSOR_DEVICE_ATTR_RO(temp5_crit_alarm, temp_crit_alarm, 4);
840static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, 833static SENSOR_DEVICE_ATTR_RO(temp6_crit_alarm, temp_crit_alarm, 5);
841 show_temp_max_alarm, NULL, 3); 834
842static SENSOR_DEVICE_ATTR(temp5_max_alarm, S_IRUGO, 835static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0);
843 show_temp_max_alarm, NULL, 4); 836static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1);
844static SENSOR_DEVICE_ATTR(temp6_max_alarm, S_IRUGO, 837static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2);
845 show_temp_max_alarm, NULL, 5); 838static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3);
846 839static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4);
847static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, 840static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5);
848 show_temp_crit_alarm, NULL, 0);
849static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO,
850 show_temp_crit_alarm, NULL, 1);
851static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO,
852 show_temp_crit_alarm, NULL, 2);
853static SENSOR_DEVICE_ATTR(temp4_crit_alarm, S_IRUGO,
854 show_temp_crit_alarm, NULL, 3);
855static SENSOR_DEVICE_ATTR(temp5_crit_alarm, S_IRUGO,
856 show_temp_crit_alarm, NULL, 4);
857static SENSOR_DEVICE_ATTR(temp6_crit_alarm, S_IRUGO,
858 show_temp_crit_alarm, NULL, 5);
859
860static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0);
861static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1);
862static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2);
863static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3);
864static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4);
865static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5);
866 841
867static struct attribute *pc87427_attributes_temp[6][10] = { 842static struct attribute *pc87427_attributes_temp[6][10] = {
868 { 843 {