.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * lm93.c - Part of lm_sensors, Linux kernel modules for hardware monitoring |
---|
3 | 4 | * |
---|
.. | .. |
---|
22 | 23 | * |
---|
23 | 24 | * Modified for mainline integration by Hans J. Koch <hjk@hansjkoch.de> |
---|
24 | 25 | * 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. |
---|
39 | 26 | */ |
---|
40 | 27 | |
---|
41 | 28 | #include <linux/module.h> |
---|
.. | .. |
---|
1111 | 1098 | } |
---|
1112 | 1099 | |
---|
1113 | 1100 | /* 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) |
---|
1116 | 1103 | { |
---|
1117 | 1104 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1118 | 1105 | |
---|
.. | .. |
---|
1120 | 1107 | return sprintf(buf, "%d\n", LM93_IN_FROM_REG(nr, data->block3[nr])); |
---|
1121 | 1108 | } |
---|
1122 | 1109 | |
---|
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); |
---|
1139 | 1126 | |
---|
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) |
---|
1142 | 1129 | { |
---|
1143 | 1130 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1144 | 1131 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
1154 | 1141 | return sprintf(buf, "%ld\n", rc); |
---|
1155 | 1142 | } |
---|
1156 | 1143 | |
---|
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, |
---|
1158 | 1145 | const char *buf, size_t count) |
---|
1159 | 1146 | { |
---|
1160 | 1147 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
.. | .. |
---|
1185 | 1172 | return count; |
---|
1186 | 1173 | } |
---|
1187 | 1174 | |
---|
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); |
---|
1220 | 1191 | |
---|
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) |
---|
1223 | 1194 | { |
---|
1224 | 1195 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1225 | 1196 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
1235 | 1206 | return sprintf(buf, "%ld\n", rc); |
---|
1236 | 1207 | } |
---|
1237 | 1208 | |
---|
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, |
---|
1239 | 1210 | const char *buf, size_t count) |
---|
1240 | 1211 | { |
---|
1241 | 1212 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
.. | .. |
---|
1266 | 1237 | return count; |
---|
1267 | 1238 | } |
---|
1268 | 1239 | |
---|
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); |
---|
1301 | 1256 | |
---|
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) |
---|
1304 | 1259 | { |
---|
1305 | 1260 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1306 | 1261 | struct lm93_data *data = lm93_update_device(dev); |
---|
1307 | 1262 | return sprintf(buf, "%d\n", LM93_TEMP_FROM_REG(data->block2[nr])); |
---|
1308 | 1263 | } |
---|
1309 | 1264 | |
---|
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); |
---|
1313 | 1268 | |
---|
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) |
---|
1316 | 1271 | { |
---|
1317 | 1272 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1318 | 1273 | struct lm93_data *data = lm93_update_device(dev); |
---|
1319 | 1274 | return sprintf(buf, "%d\n", LM93_TEMP_FROM_REG(data->temp_lim[nr].min)); |
---|
1320 | 1275 | } |
---|
1321 | 1276 | |
---|
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) |
---|
1324 | 1280 | { |
---|
1325 | 1281 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1326 | 1282 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
1339 | 1295 | return count; |
---|
1340 | 1296 | } |
---|
1341 | 1297 | |
---|
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); |
---|
1348 | 1301 | |
---|
1349 | | -static ssize_t show_temp_max(struct device *dev, |
---|
| 1302 | +static ssize_t temp_max_show(struct device *dev, |
---|
1350 | 1303 | struct device_attribute *attr, char *buf) |
---|
1351 | 1304 | { |
---|
1352 | 1305 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
.. | .. |
---|
1354 | 1307 | return sprintf(buf, "%d\n", LM93_TEMP_FROM_REG(data->temp_lim[nr].max)); |
---|
1355 | 1308 | } |
---|
1356 | 1309 | |
---|
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) |
---|
1359 | 1313 | { |
---|
1360 | 1314 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1361 | 1315 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
1374 | 1328 | return count; |
---|
1375 | 1329 | } |
---|
1376 | 1330 | |
---|
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); |
---|
1383 | 1334 | |
---|
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) |
---|
1386 | 1337 | { |
---|
1387 | 1338 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1388 | 1339 | struct lm93_data *data = lm93_update_device(dev); |
---|
1389 | 1340 | return sprintf(buf, "%d\n", LM93_TEMP_FROM_REG(data->block10.base[nr])); |
---|
1390 | 1341 | } |
---|
1391 | 1342 | |
---|
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) |
---|
1395 | 1346 | { |
---|
1396 | 1347 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1397 | 1348 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
1410 | 1361 | return count; |
---|
1411 | 1362 | } |
---|
1412 | 1363 | |
---|
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); |
---|
1419 | 1367 | |
---|
1420 | | -static ssize_t show_temp_auto_boost(struct device *dev, |
---|
| 1368 | +static ssize_t temp_auto_boost_show(struct device *dev, |
---|
1421 | 1369 | struct device_attribute *attr, char *buf) |
---|
1422 | 1370 | { |
---|
1423 | 1371 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
.. | .. |
---|
1425 | 1373 | return sprintf(buf, "%d\n", LM93_TEMP_FROM_REG(data->boost[nr])); |
---|
1426 | 1374 | } |
---|
1427 | 1375 | |
---|
1428 | | -static ssize_t store_temp_auto_boost(struct device *dev, |
---|
| 1376 | +static ssize_t temp_auto_boost_store(struct device *dev, |
---|
1429 | 1377 | struct device_attribute *attr, |
---|
1430 | 1378 | const char *buf, size_t count) |
---|
1431 | 1379 | { |
---|
.. | .. |
---|
1446 | 1394 | return count; |
---|
1447 | 1395 | } |
---|
1448 | 1396 | |
---|
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); |
---|
1455 | 1400 | |
---|
1456 | | -static ssize_t show_temp_auto_boost_hyst(struct device *dev, |
---|
| 1401 | +static ssize_t temp_auto_boost_hyst_show(struct device *dev, |
---|
1457 | 1402 | struct device_attribute *attr, |
---|
1458 | 1403 | char *buf) |
---|
1459 | 1404 | { |
---|
.. | .. |
---|
1464 | 1409 | LM93_AUTO_BOOST_HYST_FROM_REGS(data, nr, mode)); |
---|
1465 | 1410 | } |
---|
1466 | 1411 | |
---|
1467 | | -static ssize_t store_temp_auto_boost_hyst(struct device *dev, |
---|
| 1412 | +static ssize_t temp_auto_boost_hyst_store(struct device *dev, |
---|
1468 | 1413 | struct device_attribute *attr, |
---|
1469 | 1414 | const char *buf, size_t count) |
---|
1470 | 1415 | { |
---|
.. | .. |
---|
1490 | 1435 | return count; |
---|
1491 | 1436 | } |
---|
1492 | 1437 | |
---|
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); |
---|
1502 | 1441 | |
---|
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) |
---|
1505 | 1444 | { |
---|
1506 | 1445 | struct sensor_device_attribute_2 *s_attr = to_sensor_dev_attr_2(attr); |
---|
1507 | 1446 | int nr = s_attr->index; |
---|
.. | .. |
---|
1513 | 1452 | nr, mode)); |
---|
1514 | 1453 | } |
---|
1515 | 1454 | |
---|
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) |
---|
1519 | 1458 | { |
---|
1520 | 1459 | struct sensor_device_attribute_2 *s_attr = to_sensor_dev_attr_2(attr); |
---|
1521 | 1460 | int nr = s_attr->index; |
---|
.. | .. |
---|
1542 | 1481 | return count; |
---|
1543 | 1482 | } |
---|
1544 | 1483 | |
---|
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); |
---|
1617 | 1520 | |
---|
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) |
---|
1620 | 1524 | { |
---|
1621 | 1525 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1622 | 1526 | u8 reg, ctl4; |
---|
.. | .. |
---|
1627 | 1531 | LM93_PWM_MAP_LO_FREQ : LM93_PWM_MAP_HI_FREQ)); |
---|
1628 | 1532 | } |
---|
1629 | 1533 | |
---|
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) |
---|
1633 | 1537 | { |
---|
1634 | 1538 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1635 | 1539 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
1655 | 1559 | return count; |
---|
1656 | 1560 | } |
---|
1657 | 1561 | |
---|
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); |
---|
1667 | 1565 | |
---|
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) |
---|
1670 | 1569 | { |
---|
1671 | 1570 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1672 | 1571 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
1675 | 1574 | data->auto_pwm_min_hyst[nr / 2], mode)); |
---|
1676 | 1575 | } |
---|
1677 | 1576 | |
---|
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) |
---|
1681 | 1580 | { |
---|
1682 | 1581 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1683 | 1582 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
1703 | 1602 | return count; |
---|
1704 | 1603 | } |
---|
1705 | 1604 | |
---|
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); |
---|
1715 | 1608 | |
---|
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) |
---|
1718 | 1611 | { |
---|
1719 | 1612 | struct sensor_device_attribute *s_attr = to_sensor_dev_attr(attr); |
---|
1720 | 1613 | int nr = s_attr->index; |
---|
.. | .. |
---|
1723 | 1616 | return sprintf(buf, "%d\n", LM93_FAN_FROM_REG(data->block5[nr])); |
---|
1724 | 1617 | } |
---|
1725 | 1618 | |
---|
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); |
---|
1730 | 1623 | |
---|
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) |
---|
1733 | 1626 | { |
---|
1734 | 1627 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1735 | 1628 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
1737 | 1630 | return sprintf(buf, "%d\n", LM93_FAN_FROM_REG(data->block8[nr])); |
---|
1738 | 1631 | } |
---|
1739 | 1632 | |
---|
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) |
---|
1742 | 1636 | { |
---|
1743 | 1637 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1744 | 1638 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
1757 | 1651 | return count; |
---|
1758 | 1652 | } |
---|
1759 | 1653 | |
---|
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); |
---|
1768 | 1658 | |
---|
1769 | 1659 | /* |
---|
1770 | 1660 | * some tedious bit-twiddling here to deal with the register format: |
---|
.. | .. |
---|
1780 | 1670 | * T4 T3 T2 T1 |
---|
1781 | 1671 | */ |
---|
1782 | 1672 | |
---|
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) |
---|
1785 | 1675 | { |
---|
1786 | 1676 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1787 | 1677 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
1819 | 1709 | lm93_write_byte(client, LM93_REG_SFC2, data->sfc2); |
---|
1820 | 1710 | } |
---|
1821 | 1711 | |
---|
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) |
---|
1825 | 1715 | { |
---|
1826 | 1716 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1827 | 1717 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
1849 | 1739 | return count; |
---|
1850 | 1740 | } |
---|
1851 | 1741 | |
---|
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); |
---|
1860 | 1746 | |
---|
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, |
---|
1862 | 1748 | char *buf) |
---|
1863 | 1749 | { |
---|
1864 | 1750 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
.. | .. |
---|
1876 | 1762 | return sprintf(buf, "%ld\n", rc); |
---|
1877 | 1763 | } |
---|
1878 | 1764 | |
---|
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) |
---|
1881 | 1767 | { |
---|
1882 | 1768 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1883 | 1769 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
1904 | 1790 | return count; |
---|
1905 | 1791 | } |
---|
1906 | 1792 | |
---|
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); |
---|
1909 | 1795 | |
---|
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) |
---|
1912 | 1798 | { |
---|
1913 | 1799 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1914 | 1800 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
1923 | 1809 | return sprintf(buf, "%ld\n", rc); |
---|
1924 | 1810 | } |
---|
1925 | 1811 | |
---|
1926 | | -static ssize_t store_pwm_enable(struct device *dev, |
---|
| 1812 | +static ssize_t pwm_enable_store(struct device *dev, |
---|
1927 | 1813 | struct device_attribute *attr, |
---|
1928 | 1814 | const char *buf, size_t count) |
---|
1929 | 1815 | { |
---|
.. | .. |
---|
1961 | 1847 | return count; |
---|
1962 | 1848 | } |
---|
1963 | 1849 | |
---|
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); |
---|
1968 | 1852 | |
---|
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) |
---|
1971 | 1855 | { |
---|
1972 | 1856 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
1973 | 1857 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
2001 | 1885 | lm93_write_byte(client, LM93_REG_SFC2, data->sfc2); |
---|
2002 | 1886 | } |
---|
2003 | 1887 | |
---|
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) |
---|
2007 | 1891 | { |
---|
2008 | 1892 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2009 | 1893 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
2028 | 1912 | return count; |
---|
2029 | 1913 | } |
---|
2030 | 1914 | |
---|
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); |
---|
2035 | 1917 | |
---|
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) |
---|
2038 | 1921 | { |
---|
2039 | 1922 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2040 | 1923 | struct lm93_data *data = lm93_update_device(dev); |
---|
2041 | 1924 | return sprintf(buf, "%d\n", data->block9[nr][LM93_PWM_CTL1]); |
---|
2042 | 1925 | } |
---|
2043 | 1926 | |
---|
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) |
---|
2047 | 1930 | { |
---|
2048 | 1931 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2049 | 1932 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
2063 | 1946 | return count; |
---|
2064 | 1947 | } |
---|
2065 | 1948 | |
---|
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); |
---|
2070 | 1951 | |
---|
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) |
---|
2073 | 1955 | { |
---|
2074 | 1956 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2075 | 1957 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
2082 | 1964 | LM93_PWM_MAP_LO_FREQ : LM93_PWM_MAP_HI_FREQ)); |
---|
2083 | 1965 | } |
---|
2084 | 1966 | |
---|
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) |
---|
2088 | 1970 | { |
---|
2089 | 1971 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2090 | 1972 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
2109 | 1991 | return count; |
---|
2110 | 1992 | } |
---|
2111 | 1993 | |
---|
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); |
---|
2118 | 1996 | |
---|
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) |
---|
2121 | 2000 | { |
---|
2122 | 2001 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2123 | 2002 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
2125 | 2004 | data->block9[nr][LM93_PWM_CTL3])); |
---|
2126 | 2005 | } |
---|
2127 | 2006 | |
---|
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) |
---|
2131 | 2010 | { |
---|
2132 | 2011 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2133 | 2012 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
2149 | 2028 | return count; |
---|
2150 | 2029 | } |
---|
2151 | 2030 | |
---|
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); |
---|
2158 | 2033 | |
---|
2159 | 2034 | static ssize_t pwm_auto_prochot_ramp_show(struct device *dev, |
---|
2160 | 2035 | struct device_attribute *attr, char *buf) |
---|
.. | .. |
---|
2220 | 2095 | |
---|
2221 | 2096 | static DEVICE_ATTR_RW(pwm_auto_vrdhot_ramp); |
---|
2222 | 2097 | |
---|
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, |
---|
2224 | 2099 | char *buf) |
---|
2225 | 2100 | { |
---|
2226 | 2101 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
.. | .. |
---|
2228 | 2103 | return sprintf(buf, "%d\n", LM93_VID_FROM_REG(data->vid[nr])); |
---|
2229 | 2104 | } |
---|
2230 | 2105 | |
---|
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); |
---|
2233 | 2108 | |
---|
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) |
---|
2236 | 2111 | { |
---|
2237 | 2112 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2238 | 2113 | struct lm93_data *data = lm93_update_device(dev); |
---|
2239 | 2114 | return sprintf(buf, "%d\n", data->block4[nr].cur); |
---|
2240 | 2115 | } |
---|
2241 | 2116 | |
---|
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); |
---|
2244 | 2119 | |
---|
2245 | | -static ssize_t show_prochot_avg(struct device *dev, |
---|
| 2120 | +static ssize_t prochot_avg_show(struct device *dev, |
---|
2246 | 2121 | struct device_attribute *attr, char *buf) |
---|
2247 | 2122 | { |
---|
2248 | 2123 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
.. | .. |
---|
2250 | 2125 | return sprintf(buf, "%d\n", data->block4[nr].avg); |
---|
2251 | 2126 | } |
---|
2252 | 2127 | |
---|
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); |
---|
2255 | 2130 | |
---|
2256 | | -static ssize_t show_prochot_max(struct device *dev, |
---|
| 2131 | +static ssize_t prochot_max_show(struct device *dev, |
---|
2257 | 2132 | struct device_attribute *attr, char *buf) |
---|
2258 | 2133 | { |
---|
2259 | 2134 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
.. | .. |
---|
2261 | 2136 | return sprintf(buf, "%d\n", data->prochot_max[nr]); |
---|
2262 | 2137 | } |
---|
2263 | 2138 | |
---|
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) |
---|
2267 | 2142 | { |
---|
2268 | 2143 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2269 | 2144 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
2283 | 2158 | return count; |
---|
2284 | 2159 | } |
---|
2285 | 2160 | |
---|
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); |
---|
2290 | 2163 | |
---|
2291 | 2164 | static const u8 prochot_override_mask[] = { 0x80, 0x40 }; |
---|
2292 | 2165 | |
---|
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) |
---|
2295 | 2168 | { |
---|
2296 | 2169 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2297 | 2170 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
2299 | 2172 | (data->prochot_override & prochot_override_mask[nr]) ? 1 : 0); |
---|
2300 | 2173 | } |
---|
2301 | 2174 | |
---|
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) |
---|
2305 | 2178 | { |
---|
2306 | 2179 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2307 | 2180 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
2324 | 2197 | return count; |
---|
2325 | 2198 | } |
---|
2326 | 2199 | |
---|
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); |
---|
2331 | 2202 | |
---|
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) |
---|
2334 | 2205 | { |
---|
2335 | 2206 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2336 | 2207 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
2342 | 2213 | return sprintf(buf, "%d\n", LM93_INTERVAL_FROM_REG(tmp)); |
---|
2343 | 2214 | } |
---|
2344 | 2215 | |
---|
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) |
---|
2348 | 2219 | { |
---|
2349 | 2220 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2350 | 2221 | struct lm93_data *data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
2369 | 2240 | return count; |
---|
2370 | 2241 | } |
---|
2371 | 2242 | |
---|
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); |
---|
2376 | 2245 | |
---|
2377 | 2246 | static ssize_t prochot_override_duty_cycle_show(struct device *dev, |
---|
2378 | 2247 | struct device_attribute *attr, |
---|
.. | .. |
---|
2438 | 2307 | |
---|
2439 | 2308 | static DEVICE_ATTR_RW(prochot_short); |
---|
2440 | 2309 | |
---|
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) |
---|
2443 | 2312 | { |
---|
2444 | 2313 | int nr = (to_sensor_dev_attr(attr))->index; |
---|
2445 | 2314 | struct lm93_data *data = lm93_update_device(dev); |
---|
.. | .. |
---|
2447 | 2316 | data->block1.host_status_1 & (1 << (nr + 4)) ? 1 : 0); |
---|
2448 | 2317 | } |
---|
2449 | 2318 | |
---|
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); |
---|
2452 | 2321 | |
---|
2453 | 2322 | static ssize_t gpio_show(struct device *dev, struct device_attribute *attr, |
---|
2454 | 2323 | char *buf) |
---|
.. | .. |
---|
2714 | 2583 | return 0; |
---|
2715 | 2584 | } |
---|
2716 | 2585 | |
---|
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) |
---|
2719 | 2587 | { |
---|
2720 | 2588 | struct device *dev = &client->dev; |
---|
2721 | 2589 | struct lm93_data *data; |
---|
.. | .. |
---|
2767 | 2635 | .driver = { |
---|
2768 | 2636 | .name = "lm93", |
---|
2769 | 2637 | }, |
---|
2770 | | - .probe = lm93_probe, |
---|
| 2638 | + .probe_new = lm93_probe, |
---|
2771 | 2639 | .id_table = lm93_id, |
---|
2772 | 2640 | .detect = lm93_detect, |
---|
2773 | 2641 | .address_list = normal_i2c, |
---|