hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/hwmon/adt7462.c
....@@ -1,22 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * A hwmon driver for the Analog Devices ADT7462
34 * Copyright (C) 2008 IBM
45 *
56 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
207 */
218
229 #include <linux/module.h>
....@@ -448,6 +435,7 @@
448435 case 3:
449436 return "+1.5V";
450437 }
438
+ fallthrough;
451439 case 2:
452440 if (!(data->pin_cfg[1] & ADT7462_PIN22_INPUT))
453441 return "+12V3";
....@@ -505,6 +493,7 @@
505493 case 3:
506494 return "+1.5";
507495 }
496
+ fallthrough;
508497 case 11:
509498 if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
510499 ADT7462_PIN28_VOLT &&
....@@ -542,6 +531,7 @@
542531 case 3:
543532 return 7800;
544533 }
534
+ fallthrough;
545535 case 2:
546536 if (!(data->pin_cfg[1] & ADT7462_PIN22_INPUT))
547537 return 62500;
....@@ -599,6 +589,7 @@
599589 case 3:
600590 return 7800;
601591 }
592
+ fallthrough;
602593 case 11:
603594 case 12:
604595 if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
....@@ -784,9 +775,8 @@
784775 return data;
785776 }
786777
787
-static ssize_t show_temp_min(struct device *dev,
788
- struct device_attribute *devattr,
789
- char *buf)
778
+static ssize_t temp_min_show(struct device *dev,
779
+ struct device_attribute *devattr, char *buf)
790780 {
791781 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
792782 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -797,10 +787,9 @@
797787 return sprintf(buf, "%d\n", 1000 * (data->temp_min[attr->index] - 64));
798788 }
799789
800
-static ssize_t set_temp_min(struct device *dev,
801
- struct device_attribute *devattr,
802
- const char *buf,
803
- size_t count)
790
+static ssize_t temp_min_store(struct device *dev,
791
+ struct device_attribute *devattr,
792
+ const char *buf, size_t count)
804793 {
805794 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
806795 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -822,9 +811,8 @@
822811 return count;
823812 }
824813
825
-static ssize_t show_temp_max(struct device *dev,
826
- struct device_attribute *devattr,
827
- char *buf)
814
+static ssize_t temp_max_show(struct device *dev,
815
+ struct device_attribute *devattr, char *buf)
828816 {
829817 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
830818 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -835,10 +823,9 @@
835823 return sprintf(buf, "%d\n", 1000 * (data->temp_max[attr->index] - 64));
836824 }
837825
838
-static ssize_t set_temp_max(struct device *dev,
839
- struct device_attribute *devattr,
840
- const char *buf,
841
- size_t count)
826
+static ssize_t temp_max_store(struct device *dev,
827
+ struct device_attribute *devattr,
828
+ const char *buf, size_t count)
842829 {
843830 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
844831 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -860,7 +847,7 @@
860847 return count;
861848 }
862849
863
-static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
850
+static ssize_t temp_show(struct device *dev, struct device_attribute *devattr,
864851 char *buf)
865852 {
866853 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
....@@ -874,9 +861,8 @@
874861 250 * frac);
875862 }
876863
877
-static ssize_t show_temp_label(struct device *dev,
878
- struct device_attribute *devattr,
879
- char *buf)
864
+static ssize_t temp_label_show(struct device *dev,
865
+ struct device_attribute *devattr, char *buf)
880866 {
881867 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
882868 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -884,9 +870,8 @@
884870 return sprintf(buf, "%s\n", temp_label(data, attr->index));
885871 }
886872
887
-static ssize_t show_volt_max(struct device *dev,
888
- struct device_attribute *devattr,
889
- char *buf)
873
+static ssize_t volt_max_show(struct device *dev,
874
+ struct device_attribute *devattr, char *buf)
890875 {
891876 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
892877 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -898,10 +883,9 @@
898883 return sprintf(buf, "%d\n", x);
899884 }
900885
901
-static ssize_t set_volt_max(struct device *dev,
902
- struct device_attribute *devattr,
903
- const char *buf,
904
- size_t count)
886
+static ssize_t volt_max_store(struct device *dev,
887
+ struct device_attribute *devattr,
888
+ const char *buf, size_t count)
905889 {
906890 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
907891 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -926,9 +910,8 @@
926910 return count;
927911 }
928912
929
-static ssize_t show_volt_min(struct device *dev,
930
- struct device_attribute *devattr,
931
- char *buf)
913
+static ssize_t volt_min_show(struct device *dev,
914
+ struct device_attribute *devattr, char *buf)
932915 {
933916 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
934917 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -940,10 +923,9 @@
940923 return sprintf(buf, "%d\n", x);
941924 }
942925
943
-static ssize_t set_volt_min(struct device *dev,
944
- struct device_attribute *devattr,
945
- const char *buf,
946
- size_t count)
926
+static ssize_t volt_min_store(struct device *dev,
927
+ struct device_attribute *devattr,
928
+ const char *buf, size_t count)
947929 {
948930 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
949931 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -968,9 +950,8 @@
968950 return count;
969951 }
970952
971
-static ssize_t show_voltage(struct device *dev,
972
- struct device_attribute *devattr,
973
- char *buf)
953
+static ssize_t voltage_show(struct device *dev,
954
+ struct device_attribute *devattr, char *buf)
974955 {
975956 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
976957 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -982,9 +963,8 @@
982963 return sprintf(buf, "%d\n", x);
983964 }
984965
985
-static ssize_t show_voltage_label(struct device *dev,
986
- struct device_attribute *devattr,
987
- char *buf)
966
+static ssize_t voltage_label_show(struct device *dev,
967
+ struct device_attribute *devattr, char *buf)
988968 {
989969 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
990970 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -992,9 +972,8 @@
992972 return sprintf(buf, "%s\n", voltage_label(data, attr->index));
993973 }
994974
995
-static ssize_t show_alarm(struct device *dev,
996
- struct device_attribute *devattr,
997
- char *buf)
975
+static ssize_t alarm_show(struct device *dev,
976
+ struct device_attribute *devattr, char *buf)
998977 {
999978 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
1000979 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -1012,9 +991,8 @@
1012991 return data->fan_enabled & (1 << fan);
1013992 }
1014993
1015
-static ssize_t show_fan_min(struct device *dev,
1016
- struct device_attribute *devattr,
1017
- char *buf)
994
+static ssize_t fan_min_show(struct device *dev,
995
+ struct device_attribute *devattr, char *buf)
1018996 {
1019997 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
1020998 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -1031,9 +1009,9 @@
10311009 return sprintf(buf, "%d\n", FAN_PERIOD_TO_RPM(temp));
10321010 }
10331011
1034
-static ssize_t set_fan_min(struct device *dev,
1035
- struct device_attribute *devattr,
1036
- const char *buf, size_t count)
1012
+static ssize_t fan_min_store(struct device *dev,
1013
+ struct device_attribute *devattr,
1014
+ const char *buf, size_t count)
10371015 {
10381016 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
10391017 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -1057,7 +1035,7 @@
10571035 return count;
10581036 }
10591037
1060
-static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,
1038
+static ssize_t fan_show(struct device *dev, struct device_attribute *devattr,
10611039 char *buf)
10621040 {
10631041 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
....@@ -1071,18 +1049,16 @@
10711049 FAN_PERIOD_TO_RPM(data->fan[attr->index]));
10721050 }
10731051
1074
-static ssize_t show_force_pwm_max(struct device *dev,
1075
- struct device_attribute *devattr,
1076
- char *buf)
1052
+static ssize_t force_pwm_max_show(struct device *dev,
1053
+ struct device_attribute *devattr, char *buf)
10771054 {
10781055 struct adt7462_data *data = adt7462_update_device(dev);
10791056 return sprintf(buf, "%d\n", (data->cfg2 & ADT7462_FSPD_MASK ? 1 : 0));
10801057 }
10811058
1082
-static ssize_t set_force_pwm_max(struct device *dev,
1083
- struct device_attribute *devattr,
1084
- const char *buf,
1085
- size_t count)
1059
+static ssize_t force_pwm_max_store(struct device *dev,
1060
+ struct device_attribute *devattr,
1061
+ const char *buf, size_t count)
10861062 {
10871063 struct adt7462_data *data = dev_get_drvdata(dev);
10881064 struct i2c_client *client = data->client;
....@@ -1105,7 +1081,7 @@
11051081 return count;
11061082 }
11071083
1108
-static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr,
1084
+static ssize_t pwm_show(struct device *dev, struct device_attribute *devattr,
11091085 char *buf)
11101086 {
11111087 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
....@@ -1113,8 +1089,8 @@
11131089 return sprintf(buf, "%d\n", data->pwm[attr->index]);
11141090 }
11151091
1116
-static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr,
1117
- const char *buf, size_t count)
1092
+static ssize_t pwm_store(struct device *dev, struct device_attribute *devattr,
1093
+ const char *buf, size_t count)
11181094 {
11191095 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
11201096 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -1134,18 +1110,16 @@
11341110 return count;
11351111 }
11361112
1137
-static ssize_t show_pwm_max(struct device *dev,
1138
- struct device_attribute *devattr,
1139
- char *buf)
1113
+static ssize_t pwm_max_show(struct device *dev,
1114
+ struct device_attribute *devattr, char *buf)
11401115 {
11411116 struct adt7462_data *data = adt7462_update_device(dev);
11421117 return sprintf(buf, "%d\n", data->pwm_max);
11431118 }
11441119
1145
-static ssize_t set_pwm_max(struct device *dev,
1146
- struct device_attribute *devattr,
1147
- const char *buf,
1148
- size_t count)
1120
+static ssize_t pwm_max_store(struct device *dev,
1121
+ struct device_attribute *devattr,
1122
+ const char *buf, size_t count)
11491123 {
11501124 struct adt7462_data *data = dev_get_drvdata(dev);
11511125 struct i2c_client *client = data->client;
....@@ -1164,19 +1138,17 @@
11641138 return count;
11651139 }
11661140
1167
-static ssize_t show_pwm_min(struct device *dev,
1168
- struct device_attribute *devattr,
1169
- char *buf)
1141
+static ssize_t pwm_min_show(struct device *dev,
1142
+ struct device_attribute *devattr, char *buf)
11701143 {
11711144 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
11721145 struct adt7462_data *data = adt7462_update_device(dev);
11731146 return sprintf(buf, "%d\n", data->pwm_min[attr->index]);
11741147 }
11751148
1176
-static ssize_t set_pwm_min(struct device *dev,
1177
- struct device_attribute *devattr,
1178
- const char *buf,
1179
- size_t count)
1149
+static ssize_t pwm_min_store(struct device *dev,
1150
+ struct device_attribute *devattr,
1151
+ const char *buf, size_t count)
11801152 {
11811153 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
11821154 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -1197,9 +1169,8 @@
11971169 return count;
11981170 }
11991171
1200
-static ssize_t show_pwm_hyst(struct device *dev,
1201
- struct device_attribute *devattr,
1202
- char *buf)
1172
+static ssize_t pwm_hyst_show(struct device *dev,
1173
+ struct device_attribute *devattr, char *buf)
12031174 {
12041175 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
12051176 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -1207,10 +1178,9 @@
12071178 (data->pwm_trange[attr->index] & ADT7462_PWM_HYST_MASK));
12081179 }
12091180
1210
-static ssize_t set_pwm_hyst(struct device *dev,
1211
- struct device_attribute *devattr,
1212
- const char *buf,
1213
- size_t count)
1181
+static ssize_t pwm_hyst_store(struct device *dev,
1182
+ struct device_attribute *devattr,
1183
+ const char *buf, size_t count)
12141184 {
12151185 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
12161186 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -1236,9 +1206,8 @@
12361206 return count;
12371207 }
12381208
1239
-static ssize_t show_pwm_tmax(struct device *dev,
1240
- struct device_attribute *devattr,
1241
- char *buf)
1209
+static ssize_t pwm_tmax_show(struct device *dev,
1210
+ struct device_attribute *devattr, char *buf)
12421211 {
12431212 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
12441213 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -1251,10 +1220,9 @@
12511220 return sprintf(buf, "%d\n", tmin + trange);
12521221 }
12531222
1254
-static ssize_t set_pwm_tmax(struct device *dev,
1255
- struct device_attribute *devattr,
1256
- const char *buf,
1257
- size_t count)
1223
+static ssize_t pwm_tmax_store(struct device *dev,
1224
+ struct device_attribute *devattr,
1225
+ const char *buf, size_t count)
12581226 {
12591227 int temp;
12601228 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
....@@ -1284,19 +1252,17 @@
12841252 return count;
12851253 }
12861254
1287
-static ssize_t show_pwm_tmin(struct device *dev,
1288
- struct device_attribute *devattr,
1289
- char *buf)
1255
+static ssize_t pwm_tmin_show(struct device *dev,
1256
+ struct device_attribute *devattr, char *buf)
12901257 {
12911258 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
12921259 struct adt7462_data *data = adt7462_update_device(dev);
12931260 return sprintf(buf, "%d\n", 1000 * (data->pwm_tmin[attr->index] - 64));
12941261 }
12951262
1296
-static ssize_t set_pwm_tmin(struct device *dev,
1297
- struct device_attribute *devattr,
1298
- const char *buf,
1299
- size_t count)
1263
+static ssize_t pwm_tmin_store(struct device *dev,
1264
+ struct device_attribute *devattr,
1265
+ const char *buf, size_t count)
13001266 {
13011267 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
13021268 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -1318,9 +1284,8 @@
13181284 return count;
13191285 }
13201286
1321
-static ssize_t show_pwm_auto(struct device *dev,
1322
- struct device_attribute *devattr,
1323
- char *buf)
1287
+static ssize_t pwm_auto_show(struct device *dev,
1288
+ struct device_attribute *devattr, char *buf)
13241289 {
13251290 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
13261291 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -1350,10 +1315,9 @@
13501315 mutex_unlock(&data->lock);
13511316 }
13521317
1353
-static ssize_t set_pwm_auto(struct device *dev,
1354
- struct device_attribute *devattr,
1355
- const char *buf,
1356
- size_t count)
1318
+static ssize_t pwm_auto_store(struct device *dev,
1319
+ struct device_attribute *devattr,
1320
+ const char *buf, size_t count)
13571321 {
13581322 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
13591323 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -1375,9 +1339,8 @@
13751339 }
13761340 }
13771341
1378
-static ssize_t show_pwm_auto_temp(struct device *dev,
1379
- struct device_attribute *devattr,
1380
- char *buf)
1342
+static ssize_t pwm_auto_temp_show(struct device *dev,
1343
+ struct device_attribute *devattr, char *buf)
13811344 {
13821345 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
13831346 struct adt7462_data *data = adt7462_update_device(dev);
....@@ -1409,10 +1372,9 @@
14091372 return ilog2(input);
14101373 }
14111374
1412
-static ssize_t set_pwm_auto_temp(struct device *dev,
1413
- struct device_attribute *devattr,
1414
- const char *buf,
1415
- size_t count)
1375
+static ssize_t pwm_auto_temp_store(struct device *dev,
1376
+ struct device_attribute *devattr,
1377
+ const char *buf, size_t count)
14161378 {
14171379 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
14181380 struct adt7462_data *data = dev_get_drvdata(dev);
....@@ -1431,274 +1393,199 @@
14311393 return count;
14321394 }
14331395
1434
-static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max,
1435
- set_temp_max, 0);
1436
-static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp_max,
1437
- set_temp_max, 1);
1438
-static SENSOR_DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, show_temp_max,
1439
- set_temp_max, 2);
1440
-static SENSOR_DEVICE_ATTR(temp4_max, S_IWUSR | S_IRUGO, show_temp_max,
1441
- set_temp_max, 3);
1396
+static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0);
1397
+static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1);
1398
+static SENSOR_DEVICE_ATTR_RW(temp3_max, temp_max, 2);
1399
+static SENSOR_DEVICE_ATTR_RW(temp4_max, temp_max, 3);
14421400
1443
-static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp_min,
1444
- set_temp_min, 0);
1445
-static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_min,
1446
- set_temp_min, 1);
1447
-static SENSOR_DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO, show_temp_min,
1448
- set_temp_min, 2);
1449
-static SENSOR_DEVICE_ATTR(temp4_min, S_IWUSR | S_IRUGO, show_temp_min,
1450
- set_temp_min, 3);
1401
+static SENSOR_DEVICE_ATTR_RW(temp1_min, temp_min, 0);
1402
+static SENSOR_DEVICE_ATTR_RW(temp2_min, temp_min, 1);
1403
+static SENSOR_DEVICE_ATTR_RW(temp3_min, temp_min, 2);
1404
+static SENSOR_DEVICE_ATTR_RW(temp4_min, temp_min, 3);
14511405
1452
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
1453
-static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1);
1454
-static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2);
1455
-static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3);
1406
+static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
1407
+static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1);
1408
+static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2);
1409
+static SENSOR_DEVICE_ATTR_RO(temp4_input, temp, 3);
14561410
1457
-static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL, 0);
1458
-static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, show_temp_label, NULL, 1);
1459
-static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, show_temp_label, NULL, 2);
1460
-static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, show_temp_label, NULL, 3);
1411
+static SENSOR_DEVICE_ATTR_RO(temp1_label, temp_label, 0);
1412
+static SENSOR_DEVICE_ATTR_RO(temp2_label, temp_label, 1);
1413
+static SENSOR_DEVICE_ATTR_RO(temp3_label, temp_label, 2);
1414
+static SENSOR_DEVICE_ATTR_RO(temp4_label, temp_label, 3);
14611415
1462
-static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL,
1463
- ADT7462_ALARM1 | ADT7462_LT_ALARM);
1464
-static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL,
1465
- ADT7462_ALARM1 | ADT7462_R1T_ALARM);
1466
-static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL,
1467
- ADT7462_ALARM1 | ADT7462_R2T_ALARM);
1468
-static SENSOR_DEVICE_ATTR(temp4_alarm, S_IRUGO, show_alarm, NULL,
1469
- ADT7462_ALARM1 | ADT7462_R3T_ALARM);
1416
+static SENSOR_DEVICE_ATTR_RO(temp1_alarm, alarm,
1417
+ ADT7462_ALARM1 | ADT7462_LT_ALARM);
1418
+static SENSOR_DEVICE_ATTR_RO(temp2_alarm, alarm,
1419
+ ADT7462_ALARM1 | ADT7462_R1T_ALARM);
1420
+static SENSOR_DEVICE_ATTR_RO(temp3_alarm, alarm,
1421
+ ADT7462_ALARM1 | ADT7462_R2T_ALARM);
1422
+static SENSOR_DEVICE_ATTR_RO(temp4_alarm, alarm,
1423
+ ADT7462_ALARM1 | ADT7462_R3T_ALARM);
14701424
1471
-static SENSOR_DEVICE_ATTR(in1_max, S_IWUSR | S_IRUGO, show_volt_max,
1472
- set_volt_max, 0);
1473
-static SENSOR_DEVICE_ATTR(in2_max, S_IWUSR | S_IRUGO, show_volt_max,
1474
- set_volt_max, 1);
1475
-static SENSOR_DEVICE_ATTR(in3_max, S_IWUSR | S_IRUGO, show_volt_max,
1476
- set_volt_max, 2);
1477
-static SENSOR_DEVICE_ATTR(in4_max, S_IWUSR | S_IRUGO, show_volt_max,
1478
- set_volt_max, 3);
1479
-static SENSOR_DEVICE_ATTR(in5_max, S_IWUSR | S_IRUGO, show_volt_max,
1480
- set_volt_max, 4);
1481
-static SENSOR_DEVICE_ATTR(in6_max, S_IWUSR | S_IRUGO, show_volt_max,
1482
- set_volt_max, 5);
1483
-static SENSOR_DEVICE_ATTR(in7_max, S_IWUSR | S_IRUGO, show_volt_max,
1484
- set_volt_max, 6);
1485
-static SENSOR_DEVICE_ATTR(in8_max, S_IWUSR | S_IRUGO, show_volt_max,
1486
- set_volt_max, 7);
1487
-static SENSOR_DEVICE_ATTR(in9_max, S_IWUSR | S_IRUGO, show_volt_max,
1488
- set_volt_max, 8);
1489
-static SENSOR_DEVICE_ATTR(in10_max, S_IWUSR | S_IRUGO, show_volt_max,
1490
- set_volt_max, 9);
1491
-static SENSOR_DEVICE_ATTR(in11_max, S_IWUSR | S_IRUGO, show_volt_max,
1492
- set_volt_max, 10);
1493
-static SENSOR_DEVICE_ATTR(in12_max, S_IWUSR | S_IRUGO, show_volt_max,
1494
- set_volt_max, 11);
1495
-static SENSOR_DEVICE_ATTR(in13_max, S_IWUSR | S_IRUGO, show_volt_max,
1496
- set_volt_max, 12);
1425
+static SENSOR_DEVICE_ATTR_RW(in1_max, volt_max, 0);
1426
+static SENSOR_DEVICE_ATTR_RW(in2_max, volt_max, 1);
1427
+static SENSOR_DEVICE_ATTR_RW(in3_max, volt_max, 2);
1428
+static SENSOR_DEVICE_ATTR_RW(in4_max, volt_max, 3);
1429
+static SENSOR_DEVICE_ATTR_RW(in5_max, volt_max, 4);
1430
+static SENSOR_DEVICE_ATTR_RW(in6_max, volt_max, 5);
1431
+static SENSOR_DEVICE_ATTR_RW(in7_max, volt_max, 6);
1432
+static SENSOR_DEVICE_ATTR_RW(in8_max, volt_max, 7);
1433
+static SENSOR_DEVICE_ATTR_RW(in9_max, volt_max, 8);
1434
+static SENSOR_DEVICE_ATTR_RW(in10_max, volt_max, 9);
1435
+static SENSOR_DEVICE_ATTR_RW(in11_max, volt_max, 10);
1436
+static SENSOR_DEVICE_ATTR_RW(in12_max, volt_max, 11);
1437
+static SENSOR_DEVICE_ATTR_RW(in13_max, volt_max, 12);
14971438
1498
-static SENSOR_DEVICE_ATTR(in1_min, S_IWUSR | S_IRUGO, show_volt_min,
1499
- set_volt_min, 0);
1500
-static SENSOR_DEVICE_ATTR(in2_min, S_IWUSR | S_IRUGO, show_volt_min,
1501
- set_volt_min, 1);
1502
-static SENSOR_DEVICE_ATTR(in3_min, S_IWUSR | S_IRUGO, show_volt_min,
1503
- set_volt_min, 2);
1504
-static SENSOR_DEVICE_ATTR(in4_min, S_IWUSR | S_IRUGO, show_volt_min,
1505
- set_volt_min, 3);
1506
-static SENSOR_DEVICE_ATTR(in5_min, S_IWUSR | S_IRUGO, show_volt_min,
1507
- set_volt_min, 4);
1508
-static SENSOR_DEVICE_ATTR(in6_min, S_IWUSR | S_IRUGO, show_volt_min,
1509
- set_volt_min, 5);
1510
-static SENSOR_DEVICE_ATTR(in7_min, S_IWUSR | S_IRUGO, show_volt_min,
1511
- set_volt_min, 6);
1512
-static SENSOR_DEVICE_ATTR(in8_min, S_IWUSR | S_IRUGO, show_volt_min,
1513
- set_volt_min, 7);
1514
-static SENSOR_DEVICE_ATTR(in9_min, S_IWUSR | S_IRUGO, show_volt_min,
1515
- set_volt_min, 8);
1516
-static SENSOR_DEVICE_ATTR(in10_min, S_IWUSR | S_IRUGO, show_volt_min,
1517
- set_volt_min, 9);
1518
-static SENSOR_DEVICE_ATTR(in11_min, S_IWUSR | S_IRUGO, show_volt_min,
1519
- set_volt_min, 10);
1520
-static SENSOR_DEVICE_ATTR(in12_min, S_IWUSR | S_IRUGO, show_volt_min,
1521
- set_volt_min, 11);
1522
-static SENSOR_DEVICE_ATTR(in13_min, S_IWUSR | S_IRUGO, show_volt_min,
1523
- set_volt_min, 12);
1439
+static SENSOR_DEVICE_ATTR_RW(in1_min, volt_min, 0);
1440
+static SENSOR_DEVICE_ATTR_RW(in2_min, volt_min, 1);
1441
+static SENSOR_DEVICE_ATTR_RW(in3_min, volt_min, 2);
1442
+static SENSOR_DEVICE_ATTR_RW(in4_min, volt_min, 3);
1443
+static SENSOR_DEVICE_ATTR_RW(in5_min, volt_min, 4);
1444
+static SENSOR_DEVICE_ATTR_RW(in6_min, volt_min, 5);
1445
+static SENSOR_DEVICE_ATTR_RW(in7_min, volt_min, 6);
1446
+static SENSOR_DEVICE_ATTR_RW(in8_min, volt_min, 7);
1447
+static SENSOR_DEVICE_ATTR_RW(in9_min, volt_min, 8);
1448
+static SENSOR_DEVICE_ATTR_RW(in10_min, volt_min, 9);
1449
+static SENSOR_DEVICE_ATTR_RW(in11_min, volt_min, 10);
1450
+static SENSOR_DEVICE_ATTR_RW(in12_min, volt_min, 11);
1451
+static SENSOR_DEVICE_ATTR_RW(in13_min, volt_min, 12);
15241452
1525
-static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 0);
1526
-static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 1);
1527
-static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_voltage, NULL, 2);
1528
-static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_voltage, NULL, 3);
1529
-static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 4);
1530
-static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 5);
1531
-static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 6);
1532
-static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_voltage, NULL, 7);
1533
-static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_voltage, NULL, 8);
1534
-static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_voltage, NULL, 9);
1535
-static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_voltage, NULL, 10);
1536
-static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_voltage, NULL, 11);
1537
-static SENSOR_DEVICE_ATTR(in13_input, S_IRUGO, show_voltage, NULL, 12);
1453
+static SENSOR_DEVICE_ATTR_RO(in1_input, voltage, 0);
1454
+static SENSOR_DEVICE_ATTR_RO(in2_input, voltage, 1);
1455
+static SENSOR_DEVICE_ATTR_RO(in3_input, voltage, 2);
1456
+static SENSOR_DEVICE_ATTR_RO(in4_input, voltage, 3);
1457
+static SENSOR_DEVICE_ATTR_RO(in5_input, voltage, 4);
1458
+static SENSOR_DEVICE_ATTR_RO(in6_input, voltage, 5);
1459
+static SENSOR_DEVICE_ATTR_RO(in7_input, voltage, 6);
1460
+static SENSOR_DEVICE_ATTR_RO(in8_input, voltage, 7);
1461
+static SENSOR_DEVICE_ATTR_RO(in9_input, voltage, 8);
1462
+static SENSOR_DEVICE_ATTR_RO(in10_input, voltage, 9);
1463
+static SENSOR_DEVICE_ATTR_RO(in11_input, voltage, 10);
1464
+static SENSOR_DEVICE_ATTR_RO(in12_input, voltage, 11);
1465
+static SENSOR_DEVICE_ATTR_RO(in13_input, voltage, 12);
15381466
1539
-static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_voltage_label, NULL, 0);
1540
-static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_voltage_label, NULL, 1);
1541
-static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_voltage_label, NULL, 2);
1542
-static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_voltage_label, NULL, 3);
1543
-static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_voltage_label, NULL, 4);
1544
-static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_voltage_label, NULL, 5);
1545
-static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_voltage_label, NULL, 6);
1546
-static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_voltage_label, NULL, 7);
1547
-static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_voltage_label, NULL, 8);
1548
-static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, show_voltage_label, NULL, 9);
1549
-static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, show_voltage_label, NULL, 10);
1550
-static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, show_voltage_label, NULL, 11);
1551
-static SENSOR_DEVICE_ATTR(in13_label, S_IRUGO, show_voltage_label, NULL, 12);
1467
+static SENSOR_DEVICE_ATTR_RO(in1_label, voltage_label, 0);
1468
+static SENSOR_DEVICE_ATTR_RO(in2_label, voltage_label, 1);
1469
+static SENSOR_DEVICE_ATTR_RO(in3_label, voltage_label, 2);
1470
+static SENSOR_DEVICE_ATTR_RO(in4_label, voltage_label, 3);
1471
+static SENSOR_DEVICE_ATTR_RO(in5_label, voltage_label, 4);
1472
+static SENSOR_DEVICE_ATTR_RO(in6_label, voltage_label, 5);
1473
+static SENSOR_DEVICE_ATTR_RO(in7_label, voltage_label, 6);
1474
+static SENSOR_DEVICE_ATTR_RO(in8_label, voltage_label, 7);
1475
+static SENSOR_DEVICE_ATTR_RO(in9_label, voltage_label, 8);
1476
+static SENSOR_DEVICE_ATTR_RO(in10_label, voltage_label, 9);
1477
+static SENSOR_DEVICE_ATTR_RO(in11_label, voltage_label, 10);
1478
+static SENSOR_DEVICE_ATTR_RO(in12_label, voltage_label, 11);
1479
+static SENSOR_DEVICE_ATTR_RO(in13_label, voltage_label, 12);
15521480
1553
-static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL,
1554
- ADT7462_ALARM2 | ADT7462_V0_ALARM);
1555
-static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL,
1556
- ADT7462_ALARM2 | ADT7462_V7_ALARM);
1557
-static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL,
1558
- ADT7462_ALARM2 | ADT7462_V2_ALARM);
1559
-static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL,
1560
- ADT7462_ALARM2 | ADT7462_V6_ALARM);
1561
-static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL,
1562
- ADT7462_ALARM2 | ADT7462_V5_ALARM);
1563
-static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL,
1564
- ADT7462_ALARM2 | ADT7462_V4_ALARM);
1565
-static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL,
1566
- ADT7462_ALARM2 | ADT7462_V3_ALARM);
1567
-static SENSOR_DEVICE_ATTR(in8_alarm, S_IRUGO, show_alarm, NULL,
1568
- ADT7462_ALARM2 | ADT7462_V1_ALARM);
1569
-static SENSOR_DEVICE_ATTR(in9_alarm, S_IRUGO, show_alarm, NULL,
1570
- ADT7462_ALARM3 | ADT7462_V10_ALARM);
1571
-static SENSOR_DEVICE_ATTR(in10_alarm, S_IRUGO, show_alarm, NULL,
1572
- ADT7462_ALARM3 | ADT7462_V9_ALARM);
1573
-static SENSOR_DEVICE_ATTR(in11_alarm, S_IRUGO, show_alarm, NULL,
1574
- ADT7462_ALARM3 | ADT7462_V8_ALARM);
1575
-static SENSOR_DEVICE_ATTR(in12_alarm, S_IRUGO, show_alarm, NULL,
1576
- ADT7462_ALARM3 | ADT7462_V11_ALARM);
1577
-static SENSOR_DEVICE_ATTR(in13_alarm, S_IRUGO, show_alarm, NULL,
1578
- ADT7462_ALARM3 | ADT7462_V12_ALARM);
1481
+static SENSOR_DEVICE_ATTR_RO(in1_alarm, alarm,
1482
+ ADT7462_ALARM2 | ADT7462_V0_ALARM);
1483
+static SENSOR_DEVICE_ATTR_RO(in2_alarm, alarm,
1484
+ ADT7462_ALARM2 | ADT7462_V7_ALARM);
1485
+static SENSOR_DEVICE_ATTR_RO(in3_alarm, alarm,
1486
+ ADT7462_ALARM2 | ADT7462_V2_ALARM);
1487
+static SENSOR_DEVICE_ATTR_RO(in4_alarm, alarm,
1488
+ ADT7462_ALARM2 | ADT7462_V6_ALARM);
1489
+static SENSOR_DEVICE_ATTR_RO(in5_alarm, alarm,
1490
+ ADT7462_ALARM2 | ADT7462_V5_ALARM);
1491
+static SENSOR_DEVICE_ATTR_RO(in6_alarm, alarm,
1492
+ ADT7462_ALARM2 | ADT7462_V4_ALARM);
1493
+static SENSOR_DEVICE_ATTR_RO(in7_alarm, alarm,
1494
+ ADT7462_ALARM2 | ADT7462_V3_ALARM);
1495
+static SENSOR_DEVICE_ATTR_RO(in8_alarm, alarm,
1496
+ ADT7462_ALARM2 | ADT7462_V1_ALARM);
1497
+static SENSOR_DEVICE_ATTR_RO(in9_alarm, alarm,
1498
+ ADT7462_ALARM3 | ADT7462_V10_ALARM);
1499
+static SENSOR_DEVICE_ATTR_RO(in10_alarm, alarm,
1500
+ ADT7462_ALARM3 | ADT7462_V9_ALARM);
1501
+static SENSOR_DEVICE_ATTR_RO(in11_alarm, alarm,
1502
+ ADT7462_ALARM3 | ADT7462_V8_ALARM);
1503
+static SENSOR_DEVICE_ATTR_RO(in12_alarm, alarm,
1504
+ ADT7462_ALARM3 | ADT7462_V11_ALARM);
1505
+static SENSOR_DEVICE_ATTR_RO(in13_alarm, alarm,
1506
+ ADT7462_ALARM3 | ADT7462_V12_ALARM);
15791507
1580
-static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan_min,
1581
- set_fan_min, 0);
1582
-static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO, show_fan_min,
1583
- set_fan_min, 1);
1584
-static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO, show_fan_min,
1585
- set_fan_min, 2);
1586
-static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO, show_fan_min,
1587
- set_fan_min, 3);
1588
-static SENSOR_DEVICE_ATTR(fan5_min, S_IWUSR | S_IRUGO, show_fan_min,
1589
- set_fan_min, 4);
1590
-static SENSOR_DEVICE_ATTR(fan6_min, S_IWUSR | S_IRUGO, show_fan_min,
1591
- set_fan_min, 5);
1592
-static SENSOR_DEVICE_ATTR(fan7_min, S_IWUSR | S_IRUGO, show_fan_min,
1593
- set_fan_min, 6);
1594
-static SENSOR_DEVICE_ATTR(fan8_min, S_IWUSR | S_IRUGO, show_fan_min,
1595
- set_fan_min, 7);
1508
+static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0);
1509
+static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1);
1510
+static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2);
1511
+static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3);
1512
+static SENSOR_DEVICE_ATTR_RW(fan5_min, fan_min, 4);
1513
+static SENSOR_DEVICE_ATTR_RW(fan6_min, fan_min, 5);
1514
+static SENSOR_DEVICE_ATTR_RW(fan7_min, fan_min, 6);
1515
+static SENSOR_DEVICE_ATTR_RW(fan8_min, fan_min, 7);
15961516
1597
-static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0);
1598
-static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1);
1599
-static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2);
1600
-static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3);
1601
-static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_fan, NULL, 4);
1602
-static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_fan, NULL, 5);
1603
-static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_fan, NULL, 6);
1604
-static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_fan, NULL, 7);
1517
+static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0);
1518
+static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1);
1519
+static SENSOR_DEVICE_ATTR_RO(fan3_input, fan, 2);
1520
+static SENSOR_DEVICE_ATTR_RO(fan4_input, fan, 3);
1521
+static SENSOR_DEVICE_ATTR_RO(fan5_input, fan, 4);
1522
+static SENSOR_DEVICE_ATTR_RO(fan6_input, fan, 5);
1523
+static SENSOR_DEVICE_ATTR_RO(fan7_input, fan, 6);
1524
+static SENSOR_DEVICE_ATTR_RO(fan8_input, fan, 7);
16051525
1606
-static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL,
1607
- ADT7462_ALARM4 | ADT7462_F0_ALARM);
1608
-static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL,
1609
- ADT7462_ALARM4 | ADT7462_F1_ALARM);
1610
-static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL,
1611
- ADT7462_ALARM4 | ADT7462_F2_ALARM);
1612
-static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL,
1613
- ADT7462_ALARM4 | ADT7462_F3_ALARM);
1614
-static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL,
1615
- ADT7462_ALARM4 | ADT7462_F4_ALARM);
1616
-static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_alarm, NULL,
1617
- ADT7462_ALARM4 | ADT7462_F5_ALARM);
1618
-static SENSOR_DEVICE_ATTR(fan7_alarm, S_IRUGO, show_alarm, NULL,
1619
- ADT7462_ALARM4 | ADT7462_F6_ALARM);
1620
-static SENSOR_DEVICE_ATTR(fan8_alarm, S_IRUGO, show_alarm, NULL,
1621
- ADT7462_ALARM4 | ADT7462_F7_ALARM);
1526
+static SENSOR_DEVICE_ATTR_RO(fan1_alarm, alarm,
1527
+ ADT7462_ALARM4 | ADT7462_F0_ALARM);
1528
+static SENSOR_DEVICE_ATTR_RO(fan2_alarm, alarm,
1529
+ ADT7462_ALARM4 | ADT7462_F1_ALARM);
1530
+static SENSOR_DEVICE_ATTR_RO(fan3_alarm, alarm,
1531
+ ADT7462_ALARM4 | ADT7462_F2_ALARM);
1532
+static SENSOR_DEVICE_ATTR_RO(fan4_alarm, alarm,
1533
+ ADT7462_ALARM4 | ADT7462_F3_ALARM);
1534
+static SENSOR_DEVICE_ATTR_RO(fan5_alarm, alarm,
1535
+ ADT7462_ALARM4 | ADT7462_F4_ALARM);
1536
+static SENSOR_DEVICE_ATTR_RO(fan6_alarm, alarm,
1537
+ ADT7462_ALARM4 | ADT7462_F5_ALARM);
1538
+static SENSOR_DEVICE_ATTR_RO(fan7_alarm, alarm,
1539
+ ADT7462_ALARM4 | ADT7462_F6_ALARM);
1540
+static SENSOR_DEVICE_ATTR_RO(fan8_alarm, alarm,
1541
+ ADT7462_ALARM4 | ADT7462_F7_ALARM);
16221542
1623
-static SENSOR_DEVICE_ATTR(force_pwm_max, S_IWUSR | S_IRUGO,
1624
- show_force_pwm_max, set_force_pwm_max, 0);
1543
+static SENSOR_DEVICE_ATTR_RW(force_pwm_max, force_pwm_max, 0);
16251544
1626
-static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0);
1627
-static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1);
1628
-static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2);
1629
-static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3);
1545
+static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0);
1546
+static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1);
1547
+static SENSOR_DEVICE_ATTR_RW(pwm3, pwm, 2);
1548
+static SENSOR_DEVICE_ATTR_RW(pwm4, pwm, 3);
16301549
1631
-static SENSOR_DEVICE_ATTR(pwm1_auto_point1_pwm, S_IWUSR | S_IRUGO,
1632
- show_pwm_min, set_pwm_min, 0);
1633
-static SENSOR_DEVICE_ATTR(pwm2_auto_point1_pwm, S_IWUSR | S_IRUGO,
1634
- show_pwm_min, set_pwm_min, 1);
1635
-static SENSOR_DEVICE_ATTR(pwm3_auto_point1_pwm, S_IWUSR | S_IRUGO,
1636
- show_pwm_min, set_pwm_min, 2);
1637
-static SENSOR_DEVICE_ATTR(pwm4_auto_point1_pwm, S_IWUSR | S_IRUGO,
1638
- show_pwm_min, set_pwm_min, 3);
1550
+static SENSOR_DEVICE_ATTR_RW(pwm1_auto_point1_pwm, pwm_min, 0);
1551
+static SENSOR_DEVICE_ATTR_RW(pwm2_auto_point1_pwm, pwm_min, 1);
1552
+static SENSOR_DEVICE_ATTR_RW(pwm3_auto_point1_pwm, pwm_min, 2);
1553
+static SENSOR_DEVICE_ATTR_RW(pwm4_auto_point1_pwm, pwm_min, 3);
16391554
1640
-static SENSOR_DEVICE_ATTR(pwm1_auto_point2_pwm, S_IWUSR | S_IRUGO,
1641
- show_pwm_max, set_pwm_max, 0);
1642
-static SENSOR_DEVICE_ATTR(pwm2_auto_point2_pwm, S_IWUSR | S_IRUGO,
1643
- show_pwm_max, set_pwm_max, 1);
1644
-static SENSOR_DEVICE_ATTR(pwm3_auto_point2_pwm, S_IWUSR | S_IRUGO,
1645
- show_pwm_max, set_pwm_max, 2);
1646
-static SENSOR_DEVICE_ATTR(pwm4_auto_point2_pwm, S_IWUSR | S_IRUGO,
1647
- show_pwm_max, set_pwm_max, 3);
1555
+static SENSOR_DEVICE_ATTR_RW(pwm1_auto_point2_pwm, pwm_max, 0);
1556
+static SENSOR_DEVICE_ATTR_RW(pwm2_auto_point2_pwm, pwm_max, 1);
1557
+static SENSOR_DEVICE_ATTR_RW(pwm3_auto_point2_pwm, pwm_max, 2);
1558
+static SENSOR_DEVICE_ATTR_RW(pwm4_auto_point2_pwm, pwm_max, 3);
16481559
1649
-static SENSOR_DEVICE_ATTR(temp1_auto_point1_hyst, S_IWUSR | S_IRUGO,
1650
- show_pwm_hyst, set_pwm_hyst, 0);
1651
-static SENSOR_DEVICE_ATTR(temp2_auto_point1_hyst, S_IWUSR | S_IRUGO,
1652
- show_pwm_hyst, set_pwm_hyst, 1);
1653
-static SENSOR_DEVICE_ATTR(temp3_auto_point1_hyst, S_IWUSR | S_IRUGO,
1654
- show_pwm_hyst, set_pwm_hyst, 2);
1655
-static SENSOR_DEVICE_ATTR(temp4_auto_point1_hyst, S_IWUSR | S_IRUGO,
1656
- show_pwm_hyst, set_pwm_hyst, 3);
1560
+static SENSOR_DEVICE_ATTR_RW(temp1_auto_point1_hyst, pwm_hyst, 0);
1561
+static SENSOR_DEVICE_ATTR_RW(temp2_auto_point1_hyst, pwm_hyst, 1);
1562
+static SENSOR_DEVICE_ATTR_RW(temp3_auto_point1_hyst, pwm_hyst, 2);
1563
+static SENSOR_DEVICE_ATTR_RW(temp4_auto_point1_hyst, pwm_hyst, 3);
16571564
1658
-static SENSOR_DEVICE_ATTR(temp1_auto_point2_hyst, S_IWUSR | S_IRUGO,
1659
- show_pwm_hyst, set_pwm_hyst, 0);
1660
-static SENSOR_DEVICE_ATTR(temp2_auto_point2_hyst, S_IWUSR | S_IRUGO,
1661
- show_pwm_hyst, set_pwm_hyst, 1);
1662
-static SENSOR_DEVICE_ATTR(temp3_auto_point2_hyst, S_IWUSR | S_IRUGO,
1663
- show_pwm_hyst, set_pwm_hyst, 2);
1664
-static SENSOR_DEVICE_ATTR(temp4_auto_point2_hyst, S_IWUSR | S_IRUGO,
1665
- show_pwm_hyst, set_pwm_hyst, 3);
1565
+static SENSOR_DEVICE_ATTR_RW(temp1_auto_point2_hyst, pwm_hyst, 0);
1566
+static SENSOR_DEVICE_ATTR_RW(temp2_auto_point2_hyst, pwm_hyst, 1);
1567
+static SENSOR_DEVICE_ATTR_RW(temp3_auto_point2_hyst, pwm_hyst, 2);
1568
+static SENSOR_DEVICE_ATTR_RW(temp4_auto_point2_hyst, pwm_hyst, 3);
16661569
1667
-static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp, S_IWUSR | S_IRUGO,
1668
- show_pwm_tmin, set_pwm_tmin, 0);
1669
-static SENSOR_DEVICE_ATTR(temp2_auto_point1_temp, S_IWUSR | S_IRUGO,
1670
- show_pwm_tmin, set_pwm_tmin, 1);
1671
-static SENSOR_DEVICE_ATTR(temp3_auto_point1_temp, S_IWUSR | S_IRUGO,
1672
- show_pwm_tmin, set_pwm_tmin, 2);
1673
-static SENSOR_DEVICE_ATTR(temp4_auto_point1_temp, S_IWUSR | S_IRUGO,
1674
- show_pwm_tmin, set_pwm_tmin, 3);
1570
+static SENSOR_DEVICE_ATTR_RW(temp1_auto_point1_temp, pwm_tmin, 0);
1571
+static SENSOR_DEVICE_ATTR_RW(temp2_auto_point1_temp, pwm_tmin, 1);
1572
+static SENSOR_DEVICE_ATTR_RW(temp3_auto_point1_temp, pwm_tmin, 2);
1573
+static SENSOR_DEVICE_ATTR_RW(temp4_auto_point1_temp, pwm_tmin, 3);
16751574
1676
-static SENSOR_DEVICE_ATTR(temp1_auto_point2_temp, S_IWUSR | S_IRUGO,
1677
- show_pwm_tmax, set_pwm_tmax, 0);
1678
-static SENSOR_DEVICE_ATTR(temp2_auto_point2_temp, S_IWUSR | S_IRUGO,
1679
- show_pwm_tmax, set_pwm_tmax, 1);
1680
-static SENSOR_DEVICE_ATTR(temp3_auto_point2_temp, S_IWUSR | S_IRUGO,
1681
- show_pwm_tmax, set_pwm_tmax, 2);
1682
-static SENSOR_DEVICE_ATTR(temp4_auto_point2_temp, S_IWUSR | S_IRUGO,
1683
- show_pwm_tmax, set_pwm_tmax, 3);
1575
+static SENSOR_DEVICE_ATTR_RW(temp1_auto_point2_temp, pwm_tmax, 0);
1576
+static SENSOR_DEVICE_ATTR_RW(temp2_auto_point2_temp, pwm_tmax, 1);
1577
+static SENSOR_DEVICE_ATTR_RW(temp3_auto_point2_temp, pwm_tmax, 2);
1578
+static SENSOR_DEVICE_ATTR_RW(temp4_auto_point2_temp, pwm_tmax, 3);
16841579
1685
-static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, show_pwm_auto,
1686
- set_pwm_auto, 0);
1687
-static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO, show_pwm_auto,
1688
- set_pwm_auto, 1);
1689
-static SENSOR_DEVICE_ATTR(pwm3_enable, S_IWUSR | S_IRUGO, show_pwm_auto,
1690
- set_pwm_auto, 2);
1691
-static SENSOR_DEVICE_ATTR(pwm4_enable, S_IWUSR | S_IRUGO, show_pwm_auto,
1692
- set_pwm_auto, 3);
1580
+static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_auto, 0);
1581
+static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_auto, 1);
1582
+static SENSOR_DEVICE_ATTR_RW(pwm3_enable, pwm_auto, 2);
1583
+static SENSOR_DEVICE_ATTR_RW(pwm4_enable, pwm_auto, 3);
16931584
1694
-static SENSOR_DEVICE_ATTR(pwm1_auto_channels_temp, S_IWUSR | S_IRUGO,
1695
- show_pwm_auto_temp, set_pwm_auto_temp, 0);
1696
-static SENSOR_DEVICE_ATTR(pwm2_auto_channels_temp, S_IWUSR | S_IRUGO,
1697
- show_pwm_auto_temp, set_pwm_auto_temp, 1);
1698
-static SENSOR_DEVICE_ATTR(pwm3_auto_channels_temp, S_IWUSR | S_IRUGO,
1699
- show_pwm_auto_temp, set_pwm_auto_temp, 2);
1700
-static SENSOR_DEVICE_ATTR(pwm4_auto_channels_temp, S_IWUSR | S_IRUGO,
1701
- show_pwm_auto_temp, set_pwm_auto_temp, 3);
1585
+static SENSOR_DEVICE_ATTR_RW(pwm1_auto_channels_temp, pwm_auto_temp, 0);
1586
+static SENSOR_DEVICE_ATTR_RW(pwm2_auto_channels_temp, pwm_auto_temp, 1);
1587
+static SENSOR_DEVICE_ATTR_RW(pwm3_auto_channels_temp, pwm_auto_temp, 2);
1588
+static SENSOR_DEVICE_ATTR_RW(pwm4_auto_channels_temp, pwm_auto_temp, 3);
17021589
17031590 static struct attribute *adt7462_attrs[] = {
17041591 &sensor_dev_attr_temp1_max.dev_attr.attr,
....@@ -1900,8 +1787,7 @@
19001787 return 0;
19011788 }
19021789
1903
-static int adt7462_probe(struct i2c_client *client,
1904
- const struct i2c_device_id *id)
1790
+static int adt7462_probe(struct i2c_client *client)
19051791 {
19061792 struct device *dev = &client->dev;
19071793 struct adt7462_data *data;
....@@ -1933,7 +1819,7 @@
19331819 .driver = {
19341820 .name = "adt7462",
19351821 },
1936
- .probe = adt7462_probe,
1822
+ .probe_new = adt7462_probe,
19371823 .id_table = adt7462_id,
19381824 .detect = adt7462_detect,
19391825 .address_list = normal_i2c,