hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/hwmon/lm93.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * lm93.c - Part of lm_sensors, Linux kernel modules for hardware monitoring
34 *
....@@ -22,20 +23,6 @@
2223 *
2324 * Modified for mainline integration by Hans J. Koch <hjk@hansjkoch.de>
2425 * Copyright (c) 2007 Hans J. Koch, Linutronix GmbH
25
- *
26
- * This program is free software; you can redistribute it and/or modify
27
- * it under the terms of the GNU General Public License as published by
28
- * the Free Software Foundation; either version 2 of the License, or
29
- * (at your option) any later version.
30
- *
31
- * This program is distributed in the hope that it will be useful,
32
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
33
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34
- * GNU General Public License for more details.
35
- *
36
- * You should have received a copy of the GNU General Public License
37
- * along with this program; if not, write to the Free Software
38
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3926 */
4027
4128 #include <linux/module.h>
....@@ -1111,8 +1098,8 @@
11111098 }
11121099
11131100 /* following are the sysfs callback functions */
1114
-static ssize_t show_in(struct device *dev, struct device_attribute *attr,
1115
- char *buf)
1101
+static ssize_t in_show(struct device *dev, struct device_attribute *attr,
1102
+ char *buf)
11161103 {
11171104 int nr = (to_sensor_dev_attr(attr))->index;
11181105
....@@ -1120,25 +1107,25 @@
11201107 return sprintf(buf, "%d\n", LM93_IN_FROM_REG(nr, data->block3[nr]));
11211108 }
11221109
1123
-static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_in, NULL, 0);
1124
-static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_in, NULL, 1);
1125
-static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_in, NULL, 2);
1126
-static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_in, NULL, 3);
1127
-static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_in, NULL, 4);
1128
-static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_in, NULL, 5);
1129
-static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_in, NULL, 6);
1130
-static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_in, NULL, 7);
1131
-static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_in, NULL, 8);
1132
-static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_in, NULL, 9);
1133
-static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_in, NULL, 10);
1134
-static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_in, NULL, 11);
1135
-static SENSOR_DEVICE_ATTR(in13_input, S_IRUGO, show_in, NULL, 12);
1136
-static SENSOR_DEVICE_ATTR(in14_input, S_IRUGO, show_in, NULL, 13);
1137
-static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, show_in, NULL, 14);
1138
-static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, show_in, NULL, 15);
1110
+static SENSOR_DEVICE_ATTR_RO(in1_input, in, 0);
1111
+static SENSOR_DEVICE_ATTR_RO(in2_input, in, 1);
1112
+static SENSOR_DEVICE_ATTR_RO(in3_input, in, 2);
1113
+static SENSOR_DEVICE_ATTR_RO(in4_input, in, 3);
1114
+static SENSOR_DEVICE_ATTR_RO(in5_input, in, 4);
1115
+static SENSOR_DEVICE_ATTR_RO(in6_input, in, 5);
1116
+static SENSOR_DEVICE_ATTR_RO(in7_input, in, 6);
1117
+static SENSOR_DEVICE_ATTR_RO(in8_input, in, 7);
1118
+static SENSOR_DEVICE_ATTR_RO(in9_input, in, 8);
1119
+static SENSOR_DEVICE_ATTR_RO(in10_input, in, 9);
1120
+static SENSOR_DEVICE_ATTR_RO(in11_input, in, 10);
1121
+static SENSOR_DEVICE_ATTR_RO(in12_input, in, 11);
1122
+static SENSOR_DEVICE_ATTR_RO(in13_input, in, 12);
1123
+static SENSOR_DEVICE_ATTR_RO(in14_input, in, 13);
1124
+static SENSOR_DEVICE_ATTR_RO(in15_input, in, 14);
1125
+static SENSOR_DEVICE_ATTR_RO(in16_input, in, 15);
11391126
1140
-static ssize_t show_in_min(struct device *dev,
1141
- struct device_attribute *attr, char *buf)
1127
+static ssize_t in_min_show(struct device *dev, struct device_attribute *attr,
1128
+ char *buf)
11421129 {
11431130 int nr = (to_sensor_dev_attr(attr))->index;
11441131 struct lm93_data *data = lm93_update_device(dev);
....@@ -1154,7 +1141,7 @@
11541141 return sprintf(buf, "%ld\n", rc);
11551142 }
11561143
1157
-static ssize_t store_in_min(struct device *dev, struct device_attribute *attr,
1144
+static ssize_t in_min_store(struct device *dev, struct device_attribute *attr,
11581145 const char *buf, size_t count)
11591146 {
11601147 int nr = (to_sensor_dev_attr(attr))->index;
....@@ -1185,41 +1172,25 @@
11851172 return count;
11861173 }
11871174
1188
-static SENSOR_DEVICE_ATTR(in1_min, S_IWUSR | S_IRUGO,
1189
- show_in_min, store_in_min, 0);
1190
-static SENSOR_DEVICE_ATTR(in2_min, S_IWUSR | S_IRUGO,
1191
- show_in_min, store_in_min, 1);
1192
-static SENSOR_DEVICE_ATTR(in3_min, S_IWUSR | S_IRUGO,
1193
- show_in_min, store_in_min, 2);
1194
-static SENSOR_DEVICE_ATTR(in4_min, S_IWUSR | S_IRUGO,
1195
- show_in_min, store_in_min, 3);
1196
-static SENSOR_DEVICE_ATTR(in5_min, S_IWUSR | S_IRUGO,
1197
- show_in_min, store_in_min, 4);
1198
-static SENSOR_DEVICE_ATTR(in6_min, S_IWUSR | S_IRUGO,
1199
- show_in_min, store_in_min, 5);
1200
-static SENSOR_DEVICE_ATTR(in7_min, S_IWUSR | S_IRUGO,
1201
- show_in_min, store_in_min, 6);
1202
-static SENSOR_DEVICE_ATTR(in8_min, S_IWUSR | S_IRUGO,
1203
- show_in_min, store_in_min, 7);
1204
-static SENSOR_DEVICE_ATTR(in9_min, S_IWUSR | S_IRUGO,
1205
- show_in_min, store_in_min, 8);
1206
-static SENSOR_DEVICE_ATTR(in10_min, S_IWUSR | S_IRUGO,
1207
- show_in_min, store_in_min, 9);
1208
-static SENSOR_DEVICE_ATTR(in11_min, S_IWUSR | S_IRUGO,
1209
- show_in_min, store_in_min, 10);
1210
-static SENSOR_DEVICE_ATTR(in12_min, S_IWUSR | S_IRUGO,
1211
- show_in_min, store_in_min, 11);
1212
-static SENSOR_DEVICE_ATTR(in13_min, S_IWUSR | S_IRUGO,
1213
- show_in_min, store_in_min, 12);
1214
-static SENSOR_DEVICE_ATTR(in14_min, S_IWUSR | S_IRUGO,
1215
- show_in_min, store_in_min, 13);
1216
-static SENSOR_DEVICE_ATTR(in15_min, S_IWUSR | S_IRUGO,
1217
- show_in_min, store_in_min, 14);
1218
-static SENSOR_DEVICE_ATTR(in16_min, S_IWUSR | S_IRUGO,
1219
- show_in_min, store_in_min, 15);
1175
+static SENSOR_DEVICE_ATTR_RW(in1_min, in_min, 0);
1176
+static SENSOR_DEVICE_ATTR_RW(in2_min, in_min, 1);
1177
+static SENSOR_DEVICE_ATTR_RW(in3_min, in_min, 2);
1178
+static SENSOR_DEVICE_ATTR_RW(in4_min, in_min, 3);
1179
+static SENSOR_DEVICE_ATTR_RW(in5_min, in_min, 4);
1180
+static SENSOR_DEVICE_ATTR_RW(in6_min, in_min, 5);
1181
+static SENSOR_DEVICE_ATTR_RW(in7_min, in_min, 6);
1182
+static SENSOR_DEVICE_ATTR_RW(in8_min, in_min, 7);
1183
+static SENSOR_DEVICE_ATTR_RW(in9_min, in_min, 8);
1184
+static SENSOR_DEVICE_ATTR_RW(in10_min, in_min, 9);
1185
+static SENSOR_DEVICE_ATTR_RW(in11_min, in_min, 10);
1186
+static SENSOR_DEVICE_ATTR_RW(in12_min, in_min, 11);
1187
+static SENSOR_DEVICE_ATTR_RW(in13_min, in_min, 12);
1188
+static SENSOR_DEVICE_ATTR_RW(in14_min, in_min, 13);
1189
+static SENSOR_DEVICE_ATTR_RW(in15_min, in_min, 14);
1190
+static SENSOR_DEVICE_ATTR_RW(in16_min, in_min, 15);
12201191
1221
-static ssize_t show_in_max(struct device *dev,
1222
- struct device_attribute *attr, char *buf)
1192
+static ssize_t in_max_show(struct device *dev, struct device_attribute *attr,
1193
+ char *buf)
12231194 {
12241195 int nr = (to_sensor_dev_attr(attr))->index;
12251196 struct lm93_data *data = lm93_update_device(dev);
....@@ -1235,7 +1206,7 @@
12351206 return sprintf(buf, "%ld\n", rc);
12361207 }
12371208
1238
-static ssize_t store_in_max(struct device *dev, struct device_attribute *attr,
1209
+static ssize_t in_max_store(struct device *dev, struct device_attribute *attr,
12391210 const char *buf, size_t count)
12401211 {
12411212 int nr = (to_sensor_dev_attr(attr))->index;
....@@ -1266,61 +1237,46 @@
12661237 return count;
12671238 }
12681239
1269
-static SENSOR_DEVICE_ATTR(in1_max, S_IWUSR | S_IRUGO,
1270
- show_in_max, store_in_max, 0);
1271
-static SENSOR_DEVICE_ATTR(in2_max, S_IWUSR | S_IRUGO,
1272
- show_in_max, store_in_max, 1);
1273
-static SENSOR_DEVICE_ATTR(in3_max, S_IWUSR | S_IRUGO,
1274
- show_in_max, store_in_max, 2);
1275
-static SENSOR_DEVICE_ATTR(in4_max, S_IWUSR | S_IRUGO,
1276
- show_in_max, store_in_max, 3);
1277
-static SENSOR_DEVICE_ATTR(in5_max, S_IWUSR | S_IRUGO,
1278
- show_in_max, store_in_max, 4);
1279
-static SENSOR_DEVICE_ATTR(in6_max, S_IWUSR | S_IRUGO,
1280
- show_in_max, store_in_max, 5);
1281
-static SENSOR_DEVICE_ATTR(in7_max, S_IWUSR | S_IRUGO,
1282
- show_in_max, store_in_max, 6);
1283
-static SENSOR_DEVICE_ATTR(in8_max, S_IWUSR | S_IRUGO,
1284
- show_in_max, store_in_max, 7);
1285
-static SENSOR_DEVICE_ATTR(in9_max, S_IWUSR | S_IRUGO,
1286
- show_in_max, store_in_max, 8);
1287
-static SENSOR_DEVICE_ATTR(in10_max, S_IWUSR | S_IRUGO,
1288
- show_in_max, store_in_max, 9);
1289
-static SENSOR_DEVICE_ATTR(in11_max, S_IWUSR | S_IRUGO,
1290
- show_in_max, store_in_max, 10);
1291
-static SENSOR_DEVICE_ATTR(in12_max, S_IWUSR | S_IRUGO,
1292
- show_in_max, store_in_max, 11);
1293
-static SENSOR_DEVICE_ATTR(in13_max, S_IWUSR | S_IRUGO,
1294
- show_in_max, store_in_max, 12);
1295
-static SENSOR_DEVICE_ATTR(in14_max, S_IWUSR | S_IRUGO,
1296
- show_in_max, store_in_max, 13);
1297
-static SENSOR_DEVICE_ATTR(in15_max, S_IWUSR | S_IRUGO,
1298
- show_in_max, store_in_max, 14);
1299
-static SENSOR_DEVICE_ATTR(in16_max, S_IWUSR | S_IRUGO,
1300
- show_in_max, store_in_max, 15);
1240
+static SENSOR_DEVICE_ATTR_RW(in1_max, in_max, 0);
1241
+static SENSOR_DEVICE_ATTR_RW(in2_max, in_max, 1);
1242
+static SENSOR_DEVICE_ATTR_RW(in3_max, in_max, 2);
1243
+static SENSOR_DEVICE_ATTR_RW(in4_max, in_max, 3);
1244
+static SENSOR_DEVICE_ATTR_RW(in5_max, in_max, 4);
1245
+static SENSOR_DEVICE_ATTR_RW(in6_max, in_max, 5);
1246
+static SENSOR_DEVICE_ATTR_RW(in7_max, in_max, 6);
1247
+static SENSOR_DEVICE_ATTR_RW(in8_max, in_max, 7);
1248
+static SENSOR_DEVICE_ATTR_RW(in9_max, in_max, 8);
1249
+static SENSOR_DEVICE_ATTR_RW(in10_max, in_max, 9);
1250
+static SENSOR_DEVICE_ATTR_RW(in11_max, in_max, 10);
1251
+static SENSOR_DEVICE_ATTR_RW(in12_max, in_max, 11);
1252
+static SENSOR_DEVICE_ATTR_RW(in13_max, in_max, 12);
1253
+static SENSOR_DEVICE_ATTR_RW(in14_max, in_max, 13);
1254
+static SENSOR_DEVICE_ATTR_RW(in15_max, in_max, 14);
1255
+static SENSOR_DEVICE_ATTR_RW(in16_max, in_max, 15);
13011256
1302
-static ssize_t show_temp(struct device *dev,
1303
- struct device_attribute *attr, char *buf)
1257
+static ssize_t temp_show(struct device *dev, struct device_attribute *attr,
1258
+ char *buf)
13041259 {
13051260 int nr = (to_sensor_dev_attr(attr))->index;
13061261 struct lm93_data *data = lm93_update_device(dev);
13071262 return sprintf(buf, "%d\n", LM93_TEMP_FROM_REG(data->block2[nr]));
13081263 }
13091264
1310
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
1311
-static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1);
1312
-static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2);
1265
+static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
1266
+static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1);
1267
+static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2);
13131268
1314
-static ssize_t show_temp_min(struct device *dev,
1315
- struct device_attribute *attr, char *buf)
1269
+static ssize_t temp_min_show(struct device *dev,
1270
+ struct device_attribute *attr, char *buf)
13161271 {
13171272 int nr = (to_sensor_dev_attr(attr))->index;
13181273 struct lm93_data *data = lm93_update_device(dev);
13191274 return sprintf(buf, "%d\n", LM93_TEMP_FROM_REG(data->temp_lim[nr].min));
13201275 }
13211276
1322
-static ssize_t store_temp_min(struct device *dev, struct device_attribute *attr,
1323
- const char *buf, size_t count)
1277
+static ssize_t temp_min_store(struct device *dev,
1278
+ struct device_attribute *attr, const char *buf,
1279
+ size_t count)
13241280 {
13251281 int nr = (to_sensor_dev_attr(attr))->index;
13261282 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -1339,14 +1295,11 @@
13391295 return count;
13401296 }
13411297
1342
-static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO,
1343
- show_temp_min, store_temp_min, 0);
1344
-static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO,
1345
- show_temp_min, store_temp_min, 1);
1346
-static SENSOR_DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO,
1347
- show_temp_min, store_temp_min, 2);
1298
+static SENSOR_DEVICE_ATTR_RW(temp1_min, temp_min, 0);
1299
+static SENSOR_DEVICE_ATTR_RW(temp2_min, temp_min, 1);
1300
+static SENSOR_DEVICE_ATTR_RW(temp3_min, temp_min, 2);
13481301
1349
-static ssize_t show_temp_max(struct device *dev,
1302
+static ssize_t temp_max_show(struct device *dev,
13501303 struct device_attribute *attr, char *buf)
13511304 {
13521305 int nr = (to_sensor_dev_attr(attr))->index;
....@@ -1354,8 +1307,9 @@
13541307 return sprintf(buf, "%d\n", LM93_TEMP_FROM_REG(data->temp_lim[nr].max));
13551308 }
13561309
1357
-static ssize_t store_temp_max(struct device *dev, struct device_attribute *attr,
1358
- const char *buf, size_t count)
1310
+static ssize_t temp_max_store(struct device *dev,
1311
+ struct device_attribute *attr, const char *buf,
1312
+ size_t count)
13591313 {
13601314 int nr = (to_sensor_dev_attr(attr))->index;
13611315 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -1374,24 +1328,21 @@
13741328 return count;
13751329 }
13761330
1377
-static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
1378
- show_temp_max, store_temp_max, 0);
1379
-static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO,
1380
- show_temp_max, store_temp_max, 1);
1381
-static SENSOR_DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO,
1382
- show_temp_max, store_temp_max, 2);
1331
+static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0);
1332
+static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1);
1333
+static SENSOR_DEVICE_ATTR_RW(temp3_max, temp_max, 2);
13831334
1384
-static ssize_t show_temp_auto_base(struct device *dev,
1385
- struct device_attribute *attr, char *buf)
1335
+static ssize_t temp_auto_base_show(struct device *dev,
1336
+ struct device_attribute *attr, char *buf)
13861337 {
13871338 int nr = (to_sensor_dev_attr(attr))->index;
13881339 struct lm93_data *data = lm93_update_device(dev);
13891340 return sprintf(buf, "%d\n", LM93_TEMP_FROM_REG(data->block10.base[nr]));
13901341 }
13911342
1392
-static ssize_t store_temp_auto_base(struct device *dev,
1393
- struct device_attribute *attr,
1394
- const char *buf, size_t count)
1343
+static ssize_t temp_auto_base_store(struct device *dev,
1344
+ struct device_attribute *attr,
1345
+ const char *buf, size_t count)
13951346 {
13961347 int nr = (to_sensor_dev_attr(attr))->index;
13971348 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -1410,14 +1361,11 @@
14101361 return count;
14111362 }
14121363
1413
-static SENSOR_DEVICE_ATTR(temp1_auto_base, S_IWUSR | S_IRUGO,
1414
- show_temp_auto_base, store_temp_auto_base, 0);
1415
-static SENSOR_DEVICE_ATTR(temp2_auto_base, S_IWUSR | S_IRUGO,
1416
- show_temp_auto_base, store_temp_auto_base, 1);
1417
-static SENSOR_DEVICE_ATTR(temp3_auto_base, S_IWUSR | S_IRUGO,
1418
- show_temp_auto_base, store_temp_auto_base, 2);
1364
+static SENSOR_DEVICE_ATTR_RW(temp1_auto_base, temp_auto_base, 0);
1365
+static SENSOR_DEVICE_ATTR_RW(temp2_auto_base, temp_auto_base, 1);
1366
+static SENSOR_DEVICE_ATTR_RW(temp3_auto_base, temp_auto_base, 2);
14191367
1420
-static ssize_t show_temp_auto_boost(struct device *dev,
1368
+static ssize_t temp_auto_boost_show(struct device *dev,
14211369 struct device_attribute *attr, char *buf)
14221370 {
14231371 int nr = (to_sensor_dev_attr(attr))->index;
....@@ -1425,7 +1373,7 @@
14251373 return sprintf(buf, "%d\n", LM93_TEMP_FROM_REG(data->boost[nr]));
14261374 }
14271375
1428
-static ssize_t store_temp_auto_boost(struct device *dev,
1376
+static ssize_t temp_auto_boost_store(struct device *dev,
14291377 struct device_attribute *attr,
14301378 const char *buf, size_t count)
14311379 {
....@@ -1446,14 +1394,11 @@
14461394 return count;
14471395 }
14481396
1449
-static SENSOR_DEVICE_ATTR(temp1_auto_boost, S_IWUSR | S_IRUGO,
1450
- show_temp_auto_boost, store_temp_auto_boost, 0);
1451
-static SENSOR_DEVICE_ATTR(temp2_auto_boost, S_IWUSR | S_IRUGO,
1452
- show_temp_auto_boost, store_temp_auto_boost, 1);
1453
-static SENSOR_DEVICE_ATTR(temp3_auto_boost, S_IWUSR | S_IRUGO,
1454
- show_temp_auto_boost, store_temp_auto_boost, 2);
1397
+static SENSOR_DEVICE_ATTR_RW(temp1_auto_boost, temp_auto_boost, 0);
1398
+static SENSOR_DEVICE_ATTR_RW(temp2_auto_boost, temp_auto_boost, 1);
1399
+static SENSOR_DEVICE_ATTR_RW(temp3_auto_boost, temp_auto_boost, 2);
14551400
1456
-static ssize_t show_temp_auto_boost_hyst(struct device *dev,
1401
+static ssize_t temp_auto_boost_hyst_show(struct device *dev,
14571402 struct device_attribute *attr,
14581403 char *buf)
14591404 {
....@@ -1464,7 +1409,7 @@
14641409 LM93_AUTO_BOOST_HYST_FROM_REGS(data, nr, mode));
14651410 }
14661411
1467
-static ssize_t store_temp_auto_boost_hyst(struct device *dev,
1412
+static ssize_t temp_auto_boost_hyst_store(struct device *dev,
14681413 struct device_attribute *attr,
14691414 const char *buf, size_t count)
14701415 {
....@@ -1490,18 +1435,12 @@
14901435 return count;
14911436 }
14921437
1493
-static SENSOR_DEVICE_ATTR(temp1_auto_boost_hyst, S_IWUSR | S_IRUGO,
1494
- show_temp_auto_boost_hyst,
1495
- store_temp_auto_boost_hyst, 0);
1496
-static SENSOR_DEVICE_ATTR(temp2_auto_boost_hyst, S_IWUSR | S_IRUGO,
1497
- show_temp_auto_boost_hyst,
1498
- store_temp_auto_boost_hyst, 1);
1499
-static SENSOR_DEVICE_ATTR(temp3_auto_boost_hyst, S_IWUSR | S_IRUGO,
1500
- show_temp_auto_boost_hyst,
1501
- store_temp_auto_boost_hyst, 2);
1438
+static SENSOR_DEVICE_ATTR_RW(temp1_auto_boost_hyst, temp_auto_boost_hyst, 0);
1439
+static SENSOR_DEVICE_ATTR_RW(temp2_auto_boost_hyst, temp_auto_boost_hyst, 1);
1440
+static SENSOR_DEVICE_ATTR_RW(temp3_auto_boost_hyst, temp_auto_boost_hyst, 2);
15021441
1503
-static ssize_t show_temp_auto_offset(struct device *dev,
1504
- struct device_attribute *attr, char *buf)
1442
+static ssize_t temp_auto_offset_show(struct device *dev,
1443
+ struct device_attribute *attr, char *buf)
15051444 {
15061445 struct sensor_device_attribute_2 *s_attr = to_sensor_dev_attr_2(attr);
15071446 int nr = s_attr->index;
....@@ -1513,9 +1452,9 @@
15131452 nr, mode));
15141453 }
15151454
1516
-static ssize_t store_temp_auto_offset(struct device *dev,
1517
- struct device_attribute *attr,
1518
- const char *buf, size_t count)
1455
+static ssize_t temp_auto_offset_store(struct device *dev,
1456
+ struct device_attribute *attr,
1457
+ const char *buf, size_t count)
15191458 {
15201459 struct sensor_device_attribute_2 *s_attr = to_sensor_dev_attr_2(attr);
15211460 int nr = s_attr->index;
....@@ -1542,81 +1481,46 @@
15421481 return count;
15431482 }
15441483
1545
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset1, S_IWUSR | S_IRUGO,
1546
- show_temp_auto_offset, store_temp_auto_offset, 0, 0);
1547
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset2, S_IWUSR | S_IRUGO,
1548
- show_temp_auto_offset, store_temp_auto_offset, 1, 0);
1549
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset3, S_IWUSR | S_IRUGO,
1550
- show_temp_auto_offset, store_temp_auto_offset, 2, 0);
1551
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset4, S_IWUSR | S_IRUGO,
1552
- show_temp_auto_offset, store_temp_auto_offset, 3, 0);
1553
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset5, S_IWUSR | S_IRUGO,
1554
- show_temp_auto_offset, store_temp_auto_offset, 4, 0);
1555
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset6, S_IWUSR | S_IRUGO,
1556
- show_temp_auto_offset, store_temp_auto_offset, 5, 0);
1557
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset7, S_IWUSR | S_IRUGO,
1558
- show_temp_auto_offset, store_temp_auto_offset, 6, 0);
1559
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset8, S_IWUSR | S_IRUGO,
1560
- show_temp_auto_offset, store_temp_auto_offset, 7, 0);
1561
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset9, S_IWUSR | S_IRUGO,
1562
- show_temp_auto_offset, store_temp_auto_offset, 8, 0);
1563
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset10, S_IWUSR | S_IRUGO,
1564
- show_temp_auto_offset, store_temp_auto_offset, 9, 0);
1565
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset11, S_IWUSR | S_IRUGO,
1566
- show_temp_auto_offset, store_temp_auto_offset, 10, 0);
1567
-static SENSOR_DEVICE_ATTR_2(temp1_auto_offset12, S_IWUSR | S_IRUGO,
1568
- show_temp_auto_offset, store_temp_auto_offset, 11, 0);
1569
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset1, S_IWUSR | S_IRUGO,
1570
- show_temp_auto_offset, store_temp_auto_offset, 0, 1);
1571
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset2, S_IWUSR | S_IRUGO,
1572
- show_temp_auto_offset, store_temp_auto_offset, 1, 1);
1573
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset3, S_IWUSR | S_IRUGO,
1574
- show_temp_auto_offset, store_temp_auto_offset, 2, 1);
1575
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset4, S_IWUSR | S_IRUGO,
1576
- show_temp_auto_offset, store_temp_auto_offset, 3, 1);
1577
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset5, S_IWUSR | S_IRUGO,
1578
- show_temp_auto_offset, store_temp_auto_offset, 4, 1);
1579
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset6, S_IWUSR | S_IRUGO,
1580
- show_temp_auto_offset, store_temp_auto_offset, 5, 1);
1581
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset7, S_IWUSR | S_IRUGO,
1582
- show_temp_auto_offset, store_temp_auto_offset, 6, 1);
1583
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset8, S_IWUSR | S_IRUGO,
1584
- show_temp_auto_offset, store_temp_auto_offset, 7, 1);
1585
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset9, S_IWUSR | S_IRUGO,
1586
- show_temp_auto_offset, store_temp_auto_offset, 8, 1);
1587
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset10, S_IWUSR | S_IRUGO,
1588
- show_temp_auto_offset, store_temp_auto_offset, 9, 1);
1589
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset11, S_IWUSR | S_IRUGO,
1590
- show_temp_auto_offset, store_temp_auto_offset, 10, 1);
1591
-static SENSOR_DEVICE_ATTR_2(temp2_auto_offset12, S_IWUSR | S_IRUGO,
1592
- show_temp_auto_offset, store_temp_auto_offset, 11, 1);
1593
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset1, S_IWUSR | S_IRUGO,
1594
- show_temp_auto_offset, store_temp_auto_offset, 0, 2);
1595
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset2, S_IWUSR | S_IRUGO,
1596
- show_temp_auto_offset, store_temp_auto_offset, 1, 2);
1597
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset3, S_IWUSR | S_IRUGO,
1598
- show_temp_auto_offset, store_temp_auto_offset, 2, 2);
1599
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset4, S_IWUSR | S_IRUGO,
1600
- show_temp_auto_offset, store_temp_auto_offset, 3, 2);
1601
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset5, S_IWUSR | S_IRUGO,
1602
- show_temp_auto_offset, store_temp_auto_offset, 4, 2);
1603
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset6, S_IWUSR | S_IRUGO,
1604
- show_temp_auto_offset, store_temp_auto_offset, 5, 2);
1605
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset7, S_IWUSR | S_IRUGO,
1606
- show_temp_auto_offset, store_temp_auto_offset, 6, 2);
1607
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset8, S_IWUSR | S_IRUGO,
1608
- show_temp_auto_offset, store_temp_auto_offset, 7, 2);
1609
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset9, S_IWUSR | S_IRUGO,
1610
- show_temp_auto_offset, store_temp_auto_offset, 8, 2);
1611
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset10, S_IWUSR | S_IRUGO,
1612
- show_temp_auto_offset, store_temp_auto_offset, 9, 2);
1613
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset11, S_IWUSR | S_IRUGO,
1614
- show_temp_auto_offset, store_temp_auto_offset, 10, 2);
1615
-static SENSOR_DEVICE_ATTR_2(temp3_auto_offset12, S_IWUSR | S_IRUGO,
1616
- show_temp_auto_offset, store_temp_auto_offset, 11, 2);
1484
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset1, temp_auto_offset, 0, 0);
1485
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset2, temp_auto_offset, 1, 0);
1486
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset3, temp_auto_offset, 2, 0);
1487
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset4, temp_auto_offset, 3, 0);
1488
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset5, temp_auto_offset, 4, 0);
1489
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset6, temp_auto_offset, 5, 0);
1490
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset7, temp_auto_offset, 6, 0);
1491
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset8, temp_auto_offset, 7, 0);
1492
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset9, temp_auto_offset, 8, 0);
1493
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset10, temp_auto_offset, 9, 0);
1494
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset11, temp_auto_offset, 10, 0);
1495
+static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset12, temp_auto_offset, 11, 0);
1496
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset1, temp_auto_offset, 0, 1);
1497
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset2, temp_auto_offset, 1, 1);
1498
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset3, temp_auto_offset, 2, 1);
1499
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset4, temp_auto_offset, 3, 1);
1500
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset5, temp_auto_offset, 4, 1);
1501
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset6, temp_auto_offset, 5, 1);
1502
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset7, temp_auto_offset, 6, 1);
1503
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset8, temp_auto_offset, 7, 1);
1504
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset9, temp_auto_offset, 8, 1);
1505
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset10, temp_auto_offset, 9, 1);
1506
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset11, temp_auto_offset, 10, 1);
1507
+static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset12, temp_auto_offset, 11, 1);
1508
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset1, temp_auto_offset, 0, 2);
1509
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset2, temp_auto_offset, 1, 2);
1510
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset3, temp_auto_offset, 2, 2);
1511
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset4, temp_auto_offset, 3, 2);
1512
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset5, temp_auto_offset, 4, 2);
1513
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset6, temp_auto_offset, 5, 2);
1514
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset7, temp_auto_offset, 6, 2);
1515
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset8, temp_auto_offset, 7, 2);
1516
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset9, temp_auto_offset, 8, 2);
1517
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset10, temp_auto_offset, 9, 2);
1518
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset11, temp_auto_offset, 10, 2);
1519
+static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset12, temp_auto_offset, 11, 2);
16171520
1618
-static ssize_t show_temp_auto_pwm_min(struct device *dev,
1619
- struct device_attribute *attr, char *buf)
1521
+static ssize_t temp_auto_pwm_min_show(struct device *dev,
1522
+ struct device_attribute *attr,
1523
+ char *buf)
16201524 {
16211525 int nr = (to_sensor_dev_attr(attr))->index;
16221526 u8 reg, ctl4;
....@@ -1627,9 +1531,9 @@
16271531 LM93_PWM_MAP_LO_FREQ : LM93_PWM_MAP_HI_FREQ));
16281532 }
16291533
1630
-static ssize_t store_temp_auto_pwm_min(struct device *dev,
1631
- struct device_attribute *attr,
1632
- const char *buf, size_t count)
1534
+static ssize_t temp_auto_pwm_min_store(struct device *dev,
1535
+ struct device_attribute *attr,
1536
+ const char *buf, size_t count)
16331537 {
16341538 int nr = (to_sensor_dev_attr(attr))->index;
16351539 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -1655,18 +1559,13 @@
16551559 return count;
16561560 }
16571561
1658
-static SENSOR_DEVICE_ATTR(temp1_auto_pwm_min, S_IWUSR | S_IRUGO,
1659
- show_temp_auto_pwm_min,
1660
- store_temp_auto_pwm_min, 0);
1661
-static SENSOR_DEVICE_ATTR(temp2_auto_pwm_min, S_IWUSR | S_IRUGO,
1662
- show_temp_auto_pwm_min,
1663
- store_temp_auto_pwm_min, 1);
1664
-static SENSOR_DEVICE_ATTR(temp3_auto_pwm_min, S_IWUSR | S_IRUGO,
1665
- show_temp_auto_pwm_min,
1666
- store_temp_auto_pwm_min, 2);
1562
+static SENSOR_DEVICE_ATTR_RW(temp1_auto_pwm_min, temp_auto_pwm_min, 0);
1563
+static SENSOR_DEVICE_ATTR_RW(temp2_auto_pwm_min, temp_auto_pwm_min, 1);
1564
+static SENSOR_DEVICE_ATTR_RW(temp3_auto_pwm_min, temp_auto_pwm_min, 2);
16671565
1668
-static ssize_t show_temp_auto_offset_hyst(struct device *dev,
1669
- struct device_attribute *attr, char *buf)
1566
+static ssize_t temp_auto_offset_hyst_show(struct device *dev,
1567
+ struct device_attribute *attr,
1568
+ char *buf)
16701569 {
16711570 int nr = (to_sensor_dev_attr(attr))->index;
16721571 struct lm93_data *data = lm93_update_device(dev);
....@@ -1675,9 +1574,9 @@
16751574 data->auto_pwm_min_hyst[nr / 2], mode));
16761575 }
16771576
1678
-static ssize_t store_temp_auto_offset_hyst(struct device *dev,
1679
- struct device_attribute *attr,
1680
- const char *buf, size_t count)
1577
+static ssize_t temp_auto_offset_hyst_store(struct device *dev,
1578
+ struct device_attribute *attr,
1579
+ const char *buf, size_t count)
16811580 {
16821581 int nr = (to_sensor_dev_attr(attr))->index;
16831582 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -1703,18 +1602,12 @@
17031602 return count;
17041603 }
17051604
1706
-static SENSOR_DEVICE_ATTR(temp1_auto_offset_hyst, S_IWUSR | S_IRUGO,
1707
- show_temp_auto_offset_hyst,
1708
- store_temp_auto_offset_hyst, 0);
1709
-static SENSOR_DEVICE_ATTR(temp2_auto_offset_hyst, S_IWUSR | S_IRUGO,
1710
- show_temp_auto_offset_hyst,
1711
- store_temp_auto_offset_hyst, 1);
1712
-static SENSOR_DEVICE_ATTR(temp3_auto_offset_hyst, S_IWUSR | S_IRUGO,
1713
- show_temp_auto_offset_hyst,
1714
- store_temp_auto_offset_hyst, 2);
1605
+static SENSOR_DEVICE_ATTR_RW(temp1_auto_offset_hyst, temp_auto_offset_hyst, 0);
1606
+static SENSOR_DEVICE_ATTR_RW(temp2_auto_offset_hyst, temp_auto_offset_hyst, 1);
1607
+static SENSOR_DEVICE_ATTR_RW(temp3_auto_offset_hyst, temp_auto_offset_hyst, 2);
17151608
1716
-static ssize_t show_fan_input(struct device *dev,
1717
- struct device_attribute *attr, char *buf)
1609
+static ssize_t fan_input_show(struct device *dev,
1610
+ struct device_attribute *attr, char *buf)
17181611 {
17191612 struct sensor_device_attribute *s_attr = to_sensor_dev_attr(attr);
17201613 int nr = s_attr->index;
....@@ -1723,13 +1616,13 @@
17231616 return sprintf(buf, "%d\n", LM93_FAN_FROM_REG(data->block5[nr]));
17241617 }
17251618
1726
-static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan_input, NULL, 0);
1727
-static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan_input, NULL, 1);
1728
-static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan_input, NULL, 2);
1729
-static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan_input, NULL, 3);
1619
+static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0);
1620
+static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 1);
1621
+static SENSOR_DEVICE_ATTR_RO(fan3_input, fan_input, 2);
1622
+static SENSOR_DEVICE_ATTR_RO(fan4_input, fan_input, 3);
17301623
1731
-static ssize_t show_fan_min(struct device *dev,
1732
- struct device_attribute *attr, char *buf)
1624
+static ssize_t fan_min_show(struct device *dev, struct device_attribute *attr,
1625
+ char *buf)
17331626 {
17341627 int nr = (to_sensor_dev_attr(attr))->index;
17351628 struct lm93_data *data = lm93_update_device(dev);
....@@ -1737,8 +1630,9 @@
17371630 return sprintf(buf, "%d\n", LM93_FAN_FROM_REG(data->block8[nr]));
17381631 }
17391632
1740
-static ssize_t store_fan_min(struct device *dev, struct device_attribute *attr,
1741
- const char *buf, size_t count)
1633
+static ssize_t fan_min_store(struct device *dev,
1634
+ struct device_attribute *attr, const char *buf,
1635
+ size_t count)
17421636 {
17431637 int nr = (to_sensor_dev_attr(attr))->index;
17441638 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -1757,14 +1651,10 @@
17571651 return count;
17581652 }
17591653
1760
-static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO,
1761
- show_fan_min, store_fan_min, 0);
1762
-static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO,
1763
- show_fan_min, store_fan_min, 1);
1764
-static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO,
1765
- show_fan_min, store_fan_min, 2);
1766
-static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO,
1767
- show_fan_min, store_fan_min, 3);
1654
+static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0);
1655
+static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1);
1656
+static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2);
1657
+static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3);
17681658
17691659 /*
17701660 * some tedious bit-twiddling here to deal with the register format:
....@@ -1780,8 +1670,8 @@
17801670 * T4 T3 T2 T1
17811671 */
17821672
1783
-static ssize_t show_fan_smart_tach(struct device *dev,
1784
- struct device_attribute *attr, char *buf)
1673
+static ssize_t fan_smart_tach_show(struct device *dev,
1674
+ struct device_attribute *attr, char *buf)
17851675 {
17861676 int nr = (to_sensor_dev_attr(attr))->index;
17871677 struct lm93_data *data = lm93_update_device(dev);
....@@ -1819,9 +1709,9 @@
18191709 lm93_write_byte(client, LM93_REG_SFC2, data->sfc2);
18201710 }
18211711
1822
-static ssize_t store_fan_smart_tach(struct device *dev,
1823
- struct device_attribute *attr,
1824
- const char *buf, size_t count)
1712
+static ssize_t fan_smart_tach_store(struct device *dev,
1713
+ struct device_attribute *attr,
1714
+ const char *buf, size_t count)
18251715 {
18261716 int nr = (to_sensor_dev_attr(attr))->index;
18271717 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -1849,16 +1739,12 @@
18491739 return count;
18501740 }
18511741
1852
-static SENSOR_DEVICE_ATTR(fan1_smart_tach, S_IWUSR | S_IRUGO,
1853
- show_fan_smart_tach, store_fan_smart_tach, 0);
1854
-static SENSOR_DEVICE_ATTR(fan2_smart_tach, S_IWUSR | S_IRUGO,
1855
- show_fan_smart_tach, store_fan_smart_tach, 1);
1856
-static SENSOR_DEVICE_ATTR(fan3_smart_tach, S_IWUSR | S_IRUGO,
1857
- show_fan_smart_tach, store_fan_smart_tach, 2);
1858
-static SENSOR_DEVICE_ATTR(fan4_smart_tach, S_IWUSR | S_IRUGO,
1859
- show_fan_smart_tach, store_fan_smart_tach, 3);
1742
+static SENSOR_DEVICE_ATTR_RW(fan1_smart_tach, fan_smart_tach, 0);
1743
+static SENSOR_DEVICE_ATTR_RW(fan2_smart_tach, fan_smart_tach, 1);
1744
+static SENSOR_DEVICE_ATTR_RW(fan3_smart_tach, fan_smart_tach, 2);
1745
+static SENSOR_DEVICE_ATTR_RW(fan4_smart_tach, fan_smart_tach, 3);
18601746
1861
-static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
1747
+static ssize_t pwm_show(struct device *dev, struct device_attribute *attr,
18621748 char *buf)
18631749 {
18641750 int nr = (to_sensor_dev_attr(attr))->index;
....@@ -1876,8 +1762,8 @@
18761762 return sprintf(buf, "%ld\n", rc);
18771763 }
18781764
1879
-static ssize_t store_pwm(struct device *dev, struct device_attribute *attr,
1880
- const char *buf, size_t count)
1765
+static ssize_t pwm_store(struct device *dev, struct device_attribute *attr,
1766
+ const char *buf, size_t count)
18811767 {
18821768 int nr = (to_sensor_dev_attr(attr))->index;
18831769 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -1904,11 +1790,11 @@
19041790 return count;
19051791 }
19061792
1907
-static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0);
1908
-static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 1);
1793
+static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0);
1794
+static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1);
19091795
1910
-static ssize_t show_pwm_enable(struct device *dev,
1911
- struct device_attribute *attr, char *buf)
1796
+static ssize_t pwm_enable_show(struct device *dev,
1797
+ struct device_attribute *attr, char *buf)
19121798 {
19131799 int nr = (to_sensor_dev_attr(attr))->index;
19141800 struct lm93_data *data = lm93_update_device(dev);
....@@ -1923,7 +1809,7 @@
19231809 return sprintf(buf, "%ld\n", rc);
19241810 }
19251811
1926
-static ssize_t store_pwm_enable(struct device *dev,
1812
+static ssize_t pwm_enable_store(struct device *dev,
19271813 struct device_attribute *attr,
19281814 const char *buf, size_t count)
19291815 {
....@@ -1961,13 +1847,11 @@
19611847 return count;
19621848 }
19631849
1964
-static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO,
1965
- show_pwm_enable, store_pwm_enable, 0);
1966
-static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO,
1967
- show_pwm_enable, store_pwm_enable, 1);
1850
+static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_enable, 0);
1851
+static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_enable, 1);
19681852
1969
-static ssize_t show_pwm_freq(struct device *dev, struct device_attribute *attr,
1970
- char *buf)
1853
+static ssize_t pwm_freq_show(struct device *dev,
1854
+ struct device_attribute *attr, char *buf)
19711855 {
19721856 int nr = (to_sensor_dev_attr(attr))->index;
19731857 struct lm93_data *data = lm93_update_device(dev);
....@@ -2001,9 +1885,9 @@
20011885 lm93_write_byte(client, LM93_REG_SFC2, data->sfc2);
20021886 }
20031887
2004
-static ssize_t store_pwm_freq(struct device *dev,
2005
- struct device_attribute *attr,
2006
- const char *buf, size_t count)
1888
+static ssize_t pwm_freq_store(struct device *dev,
1889
+ struct device_attribute *attr, const char *buf,
1890
+ size_t count)
20071891 {
20081892 int nr = (to_sensor_dev_attr(attr))->index;
20091893 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -2028,22 +1912,21 @@
20281912 return count;
20291913 }
20301914
2031
-static SENSOR_DEVICE_ATTR(pwm1_freq, S_IWUSR | S_IRUGO,
2032
- show_pwm_freq, store_pwm_freq, 0);
2033
-static SENSOR_DEVICE_ATTR(pwm2_freq, S_IWUSR | S_IRUGO,
2034
- show_pwm_freq, store_pwm_freq, 1);
1915
+static SENSOR_DEVICE_ATTR_RW(pwm1_freq, pwm_freq, 0);
1916
+static SENSOR_DEVICE_ATTR_RW(pwm2_freq, pwm_freq, 1);
20351917
2036
-static ssize_t show_pwm_auto_channels(struct device *dev,
2037
- struct device_attribute *attr, char *buf)
1918
+static ssize_t pwm_auto_channels_show(struct device *dev,
1919
+ struct device_attribute *attr,
1920
+ char *buf)
20381921 {
20391922 int nr = (to_sensor_dev_attr(attr))->index;
20401923 struct lm93_data *data = lm93_update_device(dev);
20411924 return sprintf(buf, "%d\n", data->block9[nr][LM93_PWM_CTL1]);
20421925 }
20431926
2044
-static ssize_t store_pwm_auto_channels(struct device *dev,
2045
- struct device_attribute *attr,
2046
- const char *buf, size_t count)
1927
+static ssize_t pwm_auto_channels_store(struct device *dev,
1928
+ struct device_attribute *attr,
1929
+ const char *buf, size_t count)
20471930 {
20481931 int nr = (to_sensor_dev_attr(attr))->index;
20491932 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -2063,13 +1946,12 @@
20631946 return count;
20641947 }
20651948
2066
-static SENSOR_DEVICE_ATTR(pwm1_auto_channels, S_IWUSR | S_IRUGO,
2067
- show_pwm_auto_channels, store_pwm_auto_channels, 0);
2068
-static SENSOR_DEVICE_ATTR(pwm2_auto_channels, S_IWUSR | S_IRUGO,
2069
- show_pwm_auto_channels, store_pwm_auto_channels, 1);
1949
+static SENSOR_DEVICE_ATTR_RW(pwm1_auto_channels, pwm_auto_channels, 0);
1950
+static SENSOR_DEVICE_ATTR_RW(pwm2_auto_channels, pwm_auto_channels, 1);
20701951
2071
-static ssize_t show_pwm_auto_spinup_min(struct device *dev,
2072
- struct device_attribute *attr, char *buf)
1952
+static ssize_t pwm_auto_spinup_min_show(struct device *dev,
1953
+ struct device_attribute *attr,
1954
+ char *buf)
20731955 {
20741956 int nr = (to_sensor_dev_attr(attr))->index;
20751957 struct lm93_data *data = lm93_update_device(dev);
....@@ -2082,9 +1964,9 @@
20821964 LM93_PWM_MAP_LO_FREQ : LM93_PWM_MAP_HI_FREQ));
20831965 }
20841966
2085
-static ssize_t store_pwm_auto_spinup_min(struct device *dev,
2086
- struct device_attribute *attr,
2087
- const char *buf, size_t count)
1967
+static ssize_t pwm_auto_spinup_min_store(struct device *dev,
1968
+ struct device_attribute *attr,
1969
+ const char *buf, size_t count)
20881970 {
20891971 int nr = (to_sensor_dev_attr(attr))->index;
20901972 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -2109,15 +1991,12 @@
21091991 return count;
21101992 }
21111993
2112
-static SENSOR_DEVICE_ATTR(pwm1_auto_spinup_min, S_IWUSR | S_IRUGO,
2113
- show_pwm_auto_spinup_min,
2114
- store_pwm_auto_spinup_min, 0);
2115
-static SENSOR_DEVICE_ATTR(pwm2_auto_spinup_min, S_IWUSR | S_IRUGO,
2116
- show_pwm_auto_spinup_min,
2117
- store_pwm_auto_spinup_min, 1);
1994
+static SENSOR_DEVICE_ATTR_RW(pwm1_auto_spinup_min, pwm_auto_spinup_min, 0);
1995
+static SENSOR_DEVICE_ATTR_RW(pwm2_auto_spinup_min, pwm_auto_spinup_min, 1);
21181996
2119
-static ssize_t show_pwm_auto_spinup_time(struct device *dev,
2120
- struct device_attribute *attr, char *buf)
1997
+static ssize_t pwm_auto_spinup_time_show(struct device *dev,
1998
+ struct device_attribute *attr,
1999
+ char *buf)
21212000 {
21222001 int nr = (to_sensor_dev_attr(attr))->index;
21232002 struct lm93_data *data = lm93_update_device(dev);
....@@ -2125,9 +2004,9 @@
21252004 data->block9[nr][LM93_PWM_CTL3]));
21262005 }
21272006
2128
-static ssize_t store_pwm_auto_spinup_time(struct device *dev,
2129
- struct device_attribute *attr,
2130
- const char *buf, size_t count)
2007
+static ssize_t pwm_auto_spinup_time_store(struct device *dev,
2008
+ struct device_attribute *attr,
2009
+ const char *buf, size_t count)
21312010 {
21322011 int nr = (to_sensor_dev_attr(attr))->index;
21332012 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -2149,12 +2028,8 @@
21492028 return count;
21502029 }
21512030
2152
-static SENSOR_DEVICE_ATTR(pwm1_auto_spinup_time, S_IWUSR | S_IRUGO,
2153
- show_pwm_auto_spinup_time,
2154
- store_pwm_auto_spinup_time, 0);
2155
-static SENSOR_DEVICE_ATTR(pwm2_auto_spinup_time, S_IWUSR | S_IRUGO,
2156
- show_pwm_auto_spinup_time,
2157
- store_pwm_auto_spinup_time, 1);
2031
+static SENSOR_DEVICE_ATTR_RW(pwm1_auto_spinup_time, pwm_auto_spinup_time, 0);
2032
+static SENSOR_DEVICE_ATTR_RW(pwm2_auto_spinup_time, pwm_auto_spinup_time, 1);
21582033
21592034 static ssize_t pwm_auto_prochot_ramp_show(struct device *dev,
21602035 struct device_attribute *attr, char *buf)
....@@ -2220,7 +2095,7 @@
22202095
22212096 static DEVICE_ATTR_RW(pwm_auto_vrdhot_ramp);
22222097
2223
-static ssize_t show_vid(struct device *dev, struct device_attribute *attr,
2098
+static ssize_t vid_show(struct device *dev, struct device_attribute *attr,
22242099 char *buf)
22252100 {
22262101 int nr = (to_sensor_dev_attr(attr))->index;
....@@ -2228,21 +2103,21 @@
22282103 return sprintf(buf, "%d\n", LM93_VID_FROM_REG(data->vid[nr]));
22292104 }
22302105
2231
-static SENSOR_DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL, 0);
2232
-static SENSOR_DEVICE_ATTR(cpu1_vid, S_IRUGO, show_vid, NULL, 1);
2106
+static SENSOR_DEVICE_ATTR_RO(cpu0_vid, vid, 0);
2107
+static SENSOR_DEVICE_ATTR_RO(cpu1_vid, vid, 1);
22332108
2234
-static ssize_t show_prochot(struct device *dev, struct device_attribute *attr,
2235
- char *buf)
2109
+static ssize_t prochot_show(struct device *dev, struct device_attribute *attr,
2110
+ char *buf)
22362111 {
22372112 int nr = (to_sensor_dev_attr(attr))->index;
22382113 struct lm93_data *data = lm93_update_device(dev);
22392114 return sprintf(buf, "%d\n", data->block4[nr].cur);
22402115 }
22412116
2242
-static SENSOR_DEVICE_ATTR(prochot1, S_IRUGO, show_prochot, NULL, 0);
2243
-static SENSOR_DEVICE_ATTR(prochot2, S_IRUGO, show_prochot, NULL, 1);
2117
+static SENSOR_DEVICE_ATTR_RO(prochot1, prochot, 0);
2118
+static SENSOR_DEVICE_ATTR_RO(prochot2, prochot, 1);
22442119
2245
-static ssize_t show_prochot_avg(struct device *dev,
2120
+static ssize_t prochot_avg_show(struct device *dev,
22462121 struct device_attribute *attr, char *buf)
22472122 {
22482123 int nr = (to_sensor_dev_attr(attr))->index;
....@@ -2250,10 +2125,10 @@
22502125 return sprintf(buf, "%d\n", data->block4[nr].avg);
22512126 }
22522127
2253
-static SENSOR_DEVICE_ATTR(prochot1_avg, S_IRUGO, show_prochot_avg, NULL, 0);
2254
-static SENSOR_DEVICE_ATTR(prochot2_avg, S_IRUGO, show_prochot_avg, NULL, 1);
2128
+static SENSOR_DEVICE_ATTR_RO(prochot1_avg, prochot_avg, 0);
2129
+static SENSOR_DEVICE_ATTR_RO(prochot2_avg, prochot_avg, 1);
22552130
2256
-static ssize_t show_prochot_max(struct device *dev,
2131
+static ssize_t prochot_max_show(struct device *dev,
22572132 struct device_attribute *attr, char *buf)
22582133 {
22592134 int nr = (to_sensor_dev_attr(attr))->index;
....@@ -2261,9 +2136,9 @@
22612136 return sprintf(buf, "%d\n", data->prochot_max[nr]);
22622137 }
22632138
2264
-static ssize_t store_prochot_max(struct device *dev,
2265
- struct device_attribute *attr,
2266
- const char *buf, size_t count)
2139
+static ssize_t prochot_max_store(struct device *dev,
2140
+ struct device_attribute *attr,
2141
+ const char *buf, size_t count)
22672142 {
22682143 int nr = (to_sensor_dev_attr(attr))->index;
22692144 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -2283,15 +2158,13 @@
22832158 return count;
22842159 }
22852160
2286
-static SENSOR_DEVICE_ATTR(prochot1_max, S_IWUSR | S_IRUGO,
2287
- show_prochot_max, store_prochot_max, 0);
2288
-static SENSOR_DEVICE_ATTR(prochot2_max, S_IWUSR | S_IRUGO,
2289
- show_prochot_max, store_prochot_max, 1);
2161
+static SENSOR_DEVICE_ATTR_RW(prochot1_max, prochot_max, 0);
2162
+static SENSOR_DEVICE_ATTR_RW(prochot2_max, prochot_max, 1);
22902163
22912164 static const u8 prochot_override_mask[] = { 0x80, 0x40 };
22922165
2293
-static ssize_t show_prochot_override(struct device *dev,
2294
- struct device_attribute *attr, char *buf)
2166
+static ssize_t prochot_override_show(struct device *dev,
2167
+ struct device_attribute *attr, char *buf)
22952168 {
22962169 int nr = (to_sensor_dev_attr(attr))->index;
22972170 struct lm93_data *data = lm93_update_device(dev);
....@@ -2299,9 +2172,9 @@
22992172 (data->prochot_override & prochot_override_mask[nr]) ? 1 : 0);
23002173 }
23012174
2302
-static ssize_t store_prochot_override(struct device *dev,
2303
- struct device_attribute *attr,
2304
- const char *buf, size_t count)
2175
+static ssize_t prochot_override_store(struct device *dev,
2176
+ struct device_attribute *attr,
2177
+ const char *buf, size_t count)
23052178 {
23062179 int nr = (to_sensor_dev_attr(attr))->index;
23072180 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -2324,13 +2197,11 @@
23242197 return count;
23252198 }
23262199
2327
-static SENSOR_DEVICE_ATTR(prochot1_override, S_IWUSR | S_IRUGO,
2328
- show_prochot_override, store_prochot_override, 0);
2329
-static SENSOR_DEVICE_ATTR(prochot2_override, S_IWUSR | S_IRUGO,
2330
- show_prochot_override, store_prochot_override, 1);
2200
+static SENSOR_DEVICE_ATTR_RW(prochot1_override, prochot_override, 0);
2201
+static SENSOR_DEVICE_ATTR_RW(prochot2_override, prochot_override, 1);
23312202
2332
-static ssize_t show_prochot_interval(struct device *dev,
2333
- struct device_attribute *attr, char *buf)
2203
+static ssize_t prochot_interval_show(struct device *dev,
2204
+ struct device_attribute *attr, char *buf)
23342205 {
23352206 int nr = (to_sensor_dev_attr(attr))->index;
23362207 struct lm93_data *data = lm93_update_device(dev);
....@@ -2342,9 +2213,9 @@
23422213 return sprintf(buf, "%d\n", LM93_INTERVAL_FROM_REG(tmp));
23432214 }
23442215
2345
-static ssize_t store_prochot_interval(struct device *dev,
2346
- struct device_attribute *attr,
2347
- const char *buf, size_t count)
2216
+static ssize_t prochot_interval_store(struct device *dev,
2217
+ struct device_attribute *attr,
2218
+ const char *buf, size_t count)
23482219 {
23492220 int nr = (to_sensor_dev_attr(attr))->index;
23502221 struct lm93_data *data = dev_get_drvdata(dev);
....@@ -2369,10 +2240,8 @@
23692240 return count;
23702241 }
23712242
2372
-static SENSOR_DEVICE_ATTR(prochot1_interval, S_IWUSR | S_IRUGO,
2373
- show_prochot_interval, store_prochot_interval, 0);
2374
-static SENSOR_DEVICE_ATTR(prochot2_interval, S_IWUSR | S_IRUGO,
2375
- show_prochot_interval, store_prochot_interval, 1);
2243
+static SENSOR_DEVICE_ATTR_RW(prochot1_interval, prochot_interval, 0);
2244
+static SENSOR_DEVICE_ATTR_RW(prochot2_interval, prochot_interval, 1);
23762245
23772246 static ssize_t prochot_override_duty_cycle_show(struct device *dev,
23782247 struct device_attribute *attr,
....@@ -2438,8 +2307,8 @@
24382307
24392308 static DEVICE_ATTR_RW(prochot_short);
24402309
2441
-static ssize_t show_vrdhot(struct device *dev, struct device_attribute *attr,
2442
- char *buf)
2310
+static ssize_t vrdhot_show(struct device *dev, struct device_attribute *attr,
2311
+ char *buf)
24432312 {
24442313 int nr = (to_sensor_dev_attr(attr))->index;
24452314 struct lm93_data *data = lm93_update_device(dev);
....@@ -2447,8 +2316,8 @@
24472316 data->block1.host_status_1 & (1 << (nr + 4)) ? 1 : 0);
24482317 }
24492318
2450
-static SENSOR_DEVICE_ATTR(vrdhot1, S_IRUGO, show_vrdhot, NULL, 0);
2451
-static SENSOR_DEVICE_ATTR(vrdhot2, S_IRUGO, show_vrdhot, NULL, 1);
2319
+static SENSOR_DEVICE_ATTR_RO(vrdhot1, vrdhot, 0);
2320
+static SENSOR_DEVICE_ATTR_RO(vrdhot2, vrdhot, 1);
24522321
24532322 static ssize_t gpio_show(struct device *dev, struct device_attribute *attr,
24542323 char *buf)
....@@ -2714,8 +2583,7 @@
27142583 return 0;
27152584 }
27162585
2717
-static int lm93_probe(struct i2c_client *client,
2718
- const struct i2c_device_id *id)
2586
+static int lm93_probe(struct i2c_client *client)
27192587 {
27202588 struct device *dev = &client->dev;
27212589 struct lm93_data *data;
....@@ -2767,7 +2635,7 @@
27672635 .driver = {
27682636 .name = "lm93",
27692637 },
2770
- .probe = lm93_probe,
2638
+ .probe_new = lm93_probe,
27712639 .id_table = lm93_id,
27722640 .detect = lm93_detect,
27732641 .address_list = normal_i2c,