hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/hwmon/pc87427.c
....@@ -1,16 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * pc87427.c - hardware monitoring driver for the
34 * National Semiconductor PC87427 Super-I/O chip
45 * Copyright (C) 2006, 2008, 2010 Jean Delvare <jdelvare@suse.de>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
146 *
157 * Supports the following chips:
168 *
....@@ -392,8 +384,8 @@
392384 return data;
393385 }
394386
395
-static ssize_t show_fan_input(struct device *dev, struct device_attribute
396
- *devattr, char *buf)
387
+static ssize_t fan_input_show(struct device *dev,
388
+ struct device_attribute *devattr, char *buf)
397389 {
398390 struct pc87427_data *data = pc87427_update_device(dev);
399391 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -401,8 +393,8 @@
401393 return sprintf(buf, "%lu\n", fan_from_reg(data->fan[nr]));
402394 }
403395
404
-static ssize_t show_fan_min(struct device *dev, struct device_attribute
405
- *devattr, char *buf)
396
+static ssize_t fan_min_show(struct device *dev,
397
+ struct device_attribute *devattr, char *buf)
406398 {
407399 struct pc87427_data *data = pc87427_update_device(dev);
408400 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -410,8 +402,8 @@
410402 return sprintf(buf, "%lu\n", fan_from_reg(data->fan_min[nr]));
411403 }
412404
413
-static ssize_t show_fan_alarm(struct device *dev, struct device_attribute
414
- *devattr, char *buf)
405
+static ssize_t fan_alarm_show(struct device *dev,
406
+ struct device_attribute *devattr, char *buf)
415407 {
416408 struct pc87427_data *data = pc87427_update_device(dev);
417409 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -420,8 +412,8 @@
420412 & FAN_STATUS_LOSPD));
421413 }
422414
423
-static ssize_t show_fan_fault(struct device *dev, struct device_attribute
424
- *devattr, char *buf)
415
+static ssize_t fan_fault_show(struct device *dev,
416
+ struct device_attribute *devattr, char *buf)
425417 {
426418 struct pc87427_data *data = pc87427_update_device(dev);
427419 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -430,8 +422,9 @@
430422 & FAN_STATUS_STALL));
431423 }
432424
433
-static ssize_t set_fan_min(struct device *dev, struct device_attribute
434
- *devattr, const char *buf, size_t count)
425
+static ssize_t fan_min_store(struct device *dev,
426
+ struct device_attribute *devattr,
427
+ const char *buf, size_t count)
435428 {
436429 struct pc87427_data *data = dev_get_drvdata(dev);
437430 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -457,49 +450,41 @@
457450 return count;
458451 }
459452
460
-static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan_input, NULL, 0);
461
-static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan_input, NULL, 1);
462
-static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan_input, NULL, 2);
463
-static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan_input, NULL, 3);
464
-static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_fan_input, NULL, 4);
465
-static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_fan_input, NULL, 5);
466
-static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_fan_input, NULL, 6);
467
-static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_fan_input, NULL, 7);
453
+static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0);
454
+static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 1);
455
+static SENSOR_DEVICE_ATTR_RO(fan3_input, fan_input, 2);
456
+static SENSOR_DEVICE_ATTR_RO(fan4_input, fan_input, 3);
457
+static SENSOR_DEVICE_ATTR_RO(fan5_input, fan_input, 4);
458
+static SENSOR_DEVICE_ATTR_RO(fan6_input, fan_input, 5);
459
+static SENSOR_DEVICE_ATTR_RO(fan7_input, fan_input, 6);
460
+static SENSOR_DEVICE_ATTR_RO(fan8_input, fan_input, 7);
468461
469
-static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO,
470
- show_fan_min, set_fan_min, 0);
471
-static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO,
472
- show_fan_min, set_fan_min, 1);
473
-static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO,
474
- show_fan_min, set_fan_min, 2);
475
-static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO,
476
- show_fan_min, set_fan_min, 3);
477
-static SENSOR_DEVICE_ATTR(fan5_min, S_IWUSR | S_IRUGO,
478
- show_fan_min, set_fan_min, 4);
479
-static SENSOR_DEVICE_ATTR(fan6_min, S_IWUSR | S_IRUGO,
480
- show_fan_min, set_fan_min, 5);
481
-static SENSOR_DEVICE_ATTR(fan7_min, S_IWUSR | S_IRUGO,
482
- show_fan_min, set_fan_min, 6);
483
-static SENSOR_DEVICE_ATTR(fan8_min, S_IWUSR | S_IRUGO,
484
- show_fan_min, set_fan_min, 7);
462
+static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0);
463
+static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1);
464
+static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2);
465
+static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3);
466
+static SENSOR_DEVICE_ATTR_RW(fan5_min, fan_min, 4);
467
+static SENSOR_DEVICE_ATTR_RW(fan6_min, fan_min, 5);
468
+static SENSOR_DEVICE_ATTR_RW(fan7_min, fan_min, 6);
469
+static SENSOR_DEVICE_ATTR_RW(fan8_min, fan_min, 7);
485470
486
-static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0);
487
-static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1);
488
-static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 2);
489
-static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 3);
490
-static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_fan_alarm, NULL, 4);
491
-static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_fan_alarm, NULL, 5);
492
-static SENSOR_DEVICE_ATTR(fan7_alarm, S_IRUGO, show_fan_alarm, NULL, 6);
493
-static SENSOR_DEVICE_ATTR(fan8_alarm, S_IRUGO, show_fan_alarm, NULL, 7);
471
+static SENSOR_DEVICE_ATTR_RO(fan1_alarm, fan_alarm, 0);
472
+static SENSOR_DEVICE_ATTR_RO(fan2_alarm, fan_alarm, 1);
473
+static SENSOR_DEVICE_ATTR_RO(fan3_alarm, fan_alarm, 2);
474
+static SENSOR_DEVICE_ATTR_RO(fan4_alarm, fan_alarm, 3);
475
+static SENSOR_DEVICE_ATTR_RO(fan5_alarm, fan_alarm, 4);
476
+static SENSOR_DEVICE_ATTR_RO(fan6_alarm, fan_alarm, 5);
477
+static SENSOR_DEVICE_ATTR_RO(fan7_alarm, fan_alarm, 6);
478
+static SENSOR_DEVICE_ATTR_RO(fan8_alarm, fan_alarm, 7);
494479
495
-static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0);
496
-static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1);
497
-static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2);
498
-static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3);
499
-static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, show_fan_fault, NULL, 4);
500
-static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, show_fan_fault, NULL, 5);
501
-static SENSOR_DEVICE_ATTR(fan7_fault, S_IRUGO, show_fan_fault, NULL, 6);
502
-static SENSOR_DEVICE_ATTR(fan8_fault, S_IRUGO, show_fan_fault, NULL, 7);
480
+static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0);
481
+static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1);
482
+static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2);
483
+static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3);
484
+static SENSOR_DEVICE_ATTR_RO(fan5_fault, fan_fault, 4);
485
+static SENSOR_DEVICE_ATTR_RO(fan6_fault, fan_fault, 5);
486
+static SENSOR_DEVICE_ATTR_RO(fan7_fault, fan_fault, 6);
487
+static SENSOR_DEVICE_ATTR_RO(fan8_fault, fan_fault, 7);
503488
504489 static struct attribute *pc87427_attributes_fan[8][5] = {
505490 {
....@@ -576,8 +561,8 @@
576561 outb(data->pwm_enable[nr], iobase + PC87427_REG_PWM_ENABLE);
577562 }
578563
579
-static ssize_t show_pwm_enable(struct device *dev, struct device_attribute
580
- *devattr, char *buf)
564
+static ssize_t pwm_enable_show(struct device *dev,
565
+ struct device_attribute *devattr, char *buf)
581566 {
582567 struct pc87427_data *data = pc87427_update_device(dev);
583568 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -589,8 +574,9 @@
589574 return sprintf(buf, "%d\n", pwm_enable);
590575 }
591576
592
-static ssize_t set_pwm_enable(struct device *dev, struct device_attribute
593
- *devattr, const char *buf, size_t count)
577
+static ssize_t pwm_enable_store(struct device *dev,
578
+ struct device_attribute *devattr,
579
+ const char *buf, size_t count)
594580 {
595581 struct pc87427_data *data = dev_get_drvdata(dev);
596582 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -610,8 +596,8 @@
610596 return count;
611597 }
612598
613
-static ssize_t show_pwm(struct device *dev, struct device_attribute
614
- *devattr, char *buf)
599
+static ssize_t pwm_show(struct device *dev, struct device_attribute *devattr,
600
+ char *buf)
615601 {
616602 struct pc87427_data *data = pc87427_update_device(dev);
617603 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -619,8 +605,8 @@
619605 return sprintf(buf, "%d\n", (int)data->pwm[nr]);
620606 }
621607
622
-static ssize_t set_pwm(struct device *dev, struct device_attribute
623
- *devattr, const char *buf, size_t count)
608
+static ssize_t pwm_store(struct device *dev, struct device_attribute *devattr,
609
+ const char *buf, size_t count)
624610 {
625611 struct pc87427_data *data = dev_get_drvdata(dev);
626612 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -665,19 +651,15 @@
665651 return count;
666652 }
667653
668
-static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO,
669
- show_pwm_enable, set_pwm_enable, 0);
670
-static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO,
671
- show_pwm_enable, set_pwm_enable, 1);
672
-static SENSOR_DEVICE_ATTR(pwm3_enable, S_IWUSR | S_IRUGO,
673
- show_pwm_enable, set_pwm_enable, 2);
674
-static SENSOR_DEVICE_ATTR(pwm4_enable, S_IWUSR | S_IRUGO,
675
- show_pwm_enable, set_pwm_enable, 3);
654
+static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_enable, 0);
655
+static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_enable, 1);
656
+static SENSOR_DEVICE_ATTR_RW(pwm3_enable, pwm_enable, 2);
657
+static SENSOR_DEVICE_ATTR_RW(pwm4_enable, pwm_enable, 3);
676658
677
-static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0);
678
-static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1);
679
-static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2);
680
-static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3);
659
+static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0);
660
+static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1);
661
+static SENSOR_DEVICE_ATTR_RW(pwm3, pwm, 2);
662
+static SENSOR_DEVICE_ATTR_RW(pwm4, pwm, 3);
681663
682664 static struct attribute *pc87427_attributes_pwm[4][3] = {
683665 {
....@@ -706,8 +688,8 @@
706688 { .attrs = pc87427_attributes_pwm[3] },
707689 };
708690
709
-static ssize_t show_temp_input(struct device *dev, struct device_attribute
710
- *devattr, char *buf)
691
+static ssize_t temp_input_show(struct device *dev,
692
+ struct device_attribute *devattr, char *buf)
711693 {
712694 struct pc87427_data *data = pc87427_update_device(dev);
713695 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -715,8 +697,8 @@
715697 return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr]));
716698 }
717699
718
-static ssize_t show_temp_min(struct device *dev, struct device_attribute
719
- *devattr, char *buf)
700
+static ssize_t temp_min_show(struct device *dev,
701
+ struct device_attribute *devattr, char *buf)
720702 {
721703 struct pc87427_data *data = pc87427_update_device(dev);
722704 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -724,8 +706,8 @@
724706 return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_min[nr]));
725707 }
726708
727
-static ssize_t show_temp_max(struct device *dev, struct device_attribute
728
- *devattr, char *buf)
709
+static ssize_t temp_max_show(struct device *dev,
710
+ struct device_attribute *devattr, char *buf)
729711 {
730712 struct pc87427_data *data = pc87427_update_device(dev);
731713 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -733,8 +715,8 @@
733715 return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_max[nr]));
734716 }
735717
736
-static ssize_t show_temp_crit(struct device *dev, struct device_attribute
737
- *devattr, char *buf)
718
+static ssize_t temp_crit_show(struct device *dev,
719
+ struct device_attribute *devattr, char *buf)
738720 {
739721 struct pc87427_data *data = pc87427_update_device(dev);
740722 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -742,8 +724,8 @@
742724 return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_crit[nr]));
743725 }
744726
745
-static ssize_t show_temp_type(struct device *dev, struct device_attribute
746
- *devattr, char *buf)
727
+static ssize_t temp_type_show(struct device *dev,
728
+ struct device_attribute *devattr, char *buf)
747729 {
748730 struct pc87427_data *data = pc87427_update_device(dev);
749731 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -751,8 +733,9 @@
751733 return sprintf(buf, "%u\n", temp_type_from_reg(data->temp_type[nr]));
752734 }
753735
754
-static ssize_t show_temp_min_alarm(struct device *dev, struct device_attribute
755
- *devattr, char *buf)
736
+static ssize_t temp_min_alarm_show(struct device *dev,
737
+ struct device_attribute *devattr,
738
+ char *buf)
756739 {
757740 struct pc87427_data *data = pc87427_update_device(dev);
758741 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -761,8 +744,9 @@
761744 & TEMP_STATUS_LOWFLG));
762745 }
763746
764
-static ssize_t show_temp_max_alarm(struct device *dev, struct device_attribute
765
- *devattr, char *buf)
747
+static ssize_t temp_max_alarm_show(struct device *dev,
748
+ struct device_attribute *devattr,
749
+ char *buf)
766750 {
767751 struct pc87427_data *data = pc87427_update_device(dev);
768752 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -771,8 +755,9 @@
771755 & TEMP_STATUS_HIGHFLG));
772756 }
773757
774
-static ssize_t show_temp_crit_alarm(struct device *dev, struct device_attribute
775
- *devattr, char *buf)
758
+static ssize_t temp_crit_alarm_show(struct device *dev,
759
+ struct device_attribute *devattr,
760
+ char *buf)
776761 {
777762 struct pc87427_data *data = pc87427_update_device(dev);
778763 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -781,8 +766,8 @@
781766 & TEMP_STATUS_CRITFLG));
782767 }
783768
784
-static ssize_t show_temp_fault(struct device *dev, struct device_attribute
785
- *devattr, char *buf)
769
+static ssize_t temp_fault_show(struct device *dev,
770
+ struct device_attribute *devattr, char *buf)
786771 {
787772 struct pc87427_data *data = pc87427_update_device(dev);
788773 int nr = to_sensor_dev_attr(devattr)->index;
....@@ -791,86 +776,68 @@
791776 & TEMP_STATUS_SENSERR));
792777 }
793778
794
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0);
795
-static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input, NULL, 1);
796
-static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp_input, NULL, 2);
797
-static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp_input, NULL, 3);
798
-static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp_input, NULL, 4);
799
-static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp_input, NULL, 5);
779
+static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0);
780
+static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 1);
781
+static SENSOR_DEVICE_ATTR_RO(temp3_input, temp_input, 2);
782
+static SENSOR_DEVICE_ATTR_RO(temp4_input, temp_input, 3);
783
+static SENSOR_DEVICE_ATTR_RO(temp5_input, temp_input, 4);
784
+static SENSOR_DEVICE_ATTR_RO(temp6_input, temp_input, 5);
800785
801
-static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO, show_temp_min, NULL, 0);
802
-static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO, show_temp_min, NULL, 1);
803
-static SENSOR_DEVICE_ATTR(temp3_min, S_IRUGO, show_temp_min, NULL, 2);
804
-static SENSOR_DEVICE_ATTR(temp4_min, S_IRUGO, show_temp_min, NULL, 3);
805
-static SENSOR_DEVICE_ATTR(temp5_min, S_IRUGO, show_temp_min, NULL, 4);
806
-static SENSOR_DEVICE_ATTR(temp6_min, S_IRUGO, show_temp_min, NULL, 5);
786
+static SENSOR_DEVICE_ATTR_RO(temp1_min, temp_min, 0);
787
+static SENSOR_DEVICE_ATTR_RO(temp2_min, temp_min, 1);
788
+static SENSOR_DEVICE_ATTR_RO(temp3_min, temp_min, 2);
789
+static SENSOR_DEVICE_ATTR_RO(temp4_min, temp_min, 3);
790
+static SENSOR_DEVICE_ATTR_RO(temp5_min, temp_min, 4);
791
+static SENSOR_DEVICE_ATTR_RO(temp6_min, temp_min, 5);
807792
808
-static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0);
809
-static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1);
810
-static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2);
811
-static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3);
812
-static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4);
813
-static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5);
793
+static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0);
794
+static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1);
795
+static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2);
796
+static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3);
797
+static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4);
798
+static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5);
814799
815
-static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0);
816
-static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1);
817
-static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2);
818
-static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3);
819
-static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4);
820
-static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5);
800
+static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0);
801
+static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1);
802
+static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2);
803
+static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3);
804
+static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4);
805
+static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5);
821806
822
-static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0);
823
-static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1);
824
-static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2);
825
-static SENSOR_DEVICE_ATTR(temp4_type, S_IRUGO, show_temp_type, NULL, 3);
826
-static SENSOR_DEVICE_ATTR(temp5_type, S_IRUGO, show_temp_type, NULL, 4);
827
-static SENSOR_DEVICE_ATTR(temp6_type, S_IRUGO, show_temp_type, NULL, 5);
807
+static SENSOR_DEVICE_ATTR_RO(temp1_type, temp_type, 0);
808
+static SENSOR_DEVICE_ATTR_RO(temp2_type, temp_type, 1);
809
+static SENSOR_DEVICE_ATTR_RO(temp3_type, temp_type, 2);
810
+static SENSOR_DEVICE_ATTR_RO(temp4_type, temp_type, 3);
811
+static SENSOR_DEVICE_ATTR_RO(temp5_type, temp_type, 4);
812
+static SENSOR_DEVICE_ATTR_RO(temp6_type, temp_type, 5);
828813
829
-static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO,
830
- show_temp_min_alarm, NULL, 0);
831
-static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO,
832
- show_temp_min_alarm, NULL, 1);
833
-static SENSOR_DEVICE_ATTR(temp3_min_alarm, S_IRUGO,
834
- show_temp_min_alarm, NULL, 2);
835
-static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO,
836
- show_temp_min_alarm, NULL, 3);
837
-static SENSOR_DEVICE_ATTR(temp5_min_alarm, S_IRUGO,
838
- show_temp_min_alarm, NULL, 4);
839
-static SENSOR_DEVICE_ATTR(temp6_min_alarm, S_IRUGO,
840
- show_temp_min_alarm, NULL, 5);
814
+static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, temp_min_alarm, 0);
815
+static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, temp_min_alarm, 1);
816
+static SENSOR_DEVICE_ATTR_RO(temp3_min_alarm, temp_min_alarm, 2);
817
+static SENSOR_DEVICE_ATTR_RO(temp4_min_alarm, temp_min_alarm, 3);
818
+static SENSOR_DEVICE_ATTR_RO(temp5_min_alarm, temp_min_alarm, 4);
819
+static SENSOR_DEVICE_ATTR_RO(temp6_min_alarm, temp_min_alarm, 5);
841820
842
-static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO,
843
- show_temp_max_alarm, NULL, 0);
844
-static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO,
845
- show_temp_max_alarm, NULL, 1);
846
-static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO,
847
- show_temp_max_alarm, NULL, 2);
848
-static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO,
849
- show_temp_max_alarm, NULL, 3);
850
-static SENSOR_DEVICE_ATTR(temp5_max_alarm, S_IRUGO,
851
- show_temp_max_alarm, NULL, 4);
852
-static SENSOR_DEVICE_ATTR(temp6_max_alarm, S_IRUGO,
853
- show_temp_max_alarm, NULL, 5);
821
+static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, temp_max_alarm, 0);
822
+static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, temp_max_alarm, 1);
823
+static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, temp_max_alarm, 2);
824
+static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, temp_max_alarm, 3);
825
+static SENSOR_DEVICE_ATTR_RO(temp5_max_alarm, temp_max_alarm, 4);
826
+static SENSOR_DEVICE_ATTR_RO(temp6_max_alarm, temp_max_alarm, 5);
854827
855
-static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO,
856
- show_temp_crit_alarm, NULL, 0);
857
-static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO,
858
- show_temp_crit_alarm, NULL, 1);
859
-static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO,
860
- show_temp_crit_alarm, NULL, 2);
861
-static SENSOR_DEVICE_ATTR(temp4_crit_alarm, S_IRUGO,
862
- show_temp_crit_alarm, NULL, 3);
863
-static SENSOR_DEVICE_ATTR(temp5_crit_alarm, S_IRUGO,
864
- show_temp_crit_alarm, NULL, 4);
865
-static SENSOR_DEVICE_ATTR(temp6_crit_alarm, S_IRUGO,
866
- show_temp_crit_alarm, NULL, 5);
828
+static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, temp_crit_alarm, 0);
829
+static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, temp_crit_alarm, 1);
830
+static SENSOR_DEVICE_ATTR_RO(temp3_crit_alarm, temp_crit_alarm, 2);
831
+static SENSOR_DEVICE_ATTR_RO(temp4_crit_alarm, temp_crit_alarm, 3);
832
+static SENSOR_DEVICE_ATTR_RO(temp5_crit_alarm, temp_crit_alarm, 4);
833
+static SENSOR_DEVICE_ATTR_RO(temp6_crit_alarm, temp_crit_alarm, 5);
867834
868
-static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0);
869
-static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1);
870
-static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2);
871
-static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3);
872
-static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4);
873
-static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5);
835
+static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0);
836
+static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1);
837
+static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2);
838
+static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3);
839
+static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4);
840
+static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5);
874841
875842 static struct attribute *pc87427_attributes_temp[6][10] = {
876843 {