hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/hwmon/adt7x10.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * adt7x10.c - Part of lm_sensors, Linux kernel modules for hardware
34 * monitoring
....@@ -5,20 +6,6 @@
56 * Hartmut Knaack <knaack.h@gmx.de> 2012-07-22
67 * based on lm75.c by Frodo Looijaard <frodol@dds.nl>
78 * and adt7410.c from iio-staging by Sonic Zhang <sonic.zhang@analog.com>
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; either version 2 of the License, or
12
- * (at your option) any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program; if not, write to the Free Software
21
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
229 */
2310
2411 #include <linux/module.h>
....@@ -230,9 +217,8 @@
230217
231218 /* sysfs attributes for hwmon */
232219
233
-static ssize_t adt7x10_show_temp(struct device *dev,
234
- struct device_attribute *da,
235
- char *buf)
220
+static ssize_t adt7x10_temp_show(struct device *dev,
221
+ struct device_attribute *da, char *buf)
236222 {
237223 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
238224 struct adt7x10_data *data = dev_get_drvdata(dev);
....@@ -250,9 +236,9 @@
250236 data->temp[attr->index]));
251237 }
252238
253
-static ssize_t adt7x10_set_temp(struct device *dev,
254
- struct device_attribute *da,
255
- const char *buf, size_t count)
239
+static ssize_t adt7x10_temp_store(struct device *dev,
240
+ struct device_attribute *da,
241
+ const char *buf, size_t count)
256242 {
257243 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
258244 struct adt7x10_data *data = dev_get_drvdata(dev);
....@@ -273,9 +259,8 @@
273259 return count;
274260 }
275261
276
-static ssize_t adt7x10_show_t_hyst(struct device *dev,
277
- struct device_attribute *da,
278
- char *buf)
262
+static ssize_t adt7x10_t_hyst_show(struct device *dev,
263
+ struct device_attribute *da, char *buf)
279264 {
280265 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
281266 struct adt7x10_data *data = dev_get_drvdata(dev);
....@@ -294,9 +279,9 @@
294279 ADT7X10_REG_TO_TEMP(data, data->temp[nr]) - hyst);
295280 }
296281
297
-static ssize_t adt7x10_set_t_hyst(struct device *dev,
298
- struct device_attribute *da,
299
- const char *buf, size_t count)
282
+static ssize_t adt7x10_t_hyst_store(struct device *dev,
283
+ struct device_attribute *da,
284
+ const char *buf, size_t count)
300285 {
301286 struct adt7x10_data *data = dev_get_drvdata(dev);
302287 int limit, ret;
....@@ -317,9 +302,8 @@
317302 return count;
318303 }
319304
320
-static ssize_t adt7x10_show_alarm(struct device *dev,
321
- struct device_attribute *da,
322
- char *buf)
305
+static ssize_t adt7x10_alarm_show(struct device *dev,
306
+ struct device_attribute *da, char *buf)
323307 {
324308 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
325309 int ret;
....@@ -339,25 +323,19 @@
339323 return sprintf(buf, "%s\n", data->name);
340324 }
341325
342
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, adt7x10_show_temp, NULL, 0);
343
-static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
344
- adt7x10_show_temp, adt7x10_set_temp, 1);
345
-static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO,
346
- adt7x10_show_temp, adt7x10_set_temp, 2);
347
-static SENSOR_DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO,
348
- adt7x10_show_temp, adt7x10_set_temp, 3);
349
-static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO,
350
- adt7x10_show_t_hyst, adt7x10_set_t_hyst, 1);
351
-static SENSOR_DEVICE_ATTR(temp1_min_hyst, S_IRUGO,
352
- adt7x10_show_t_hyst, NULL, 2);
353
-static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO,
354
- adt7x10_show_t_hyst, NULL, 3);
355
-static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, adt7x10_show_alarm,
356
- NULL, ADT7X10_STAT_T_LOW);
357
-static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, adt7x10_show_alarm,
358
- NULL, ADT7X10_STAT_T_HIGH);
359
-static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, adt7x10_show_alarm,
360
- NULL, ADT7X10_STAT_T_CRIT);
326
+static SENSOR_DEVICE_ATTR_RO(temp1_input, adt7x10_temp, 0);
327
+static SENSOR_DEVICE_ATTR_RW(temp1_max, adt7x10_temp, 1);
328
+static SENSOR_DEVICE_ATTR_RW(temp1_min, adt7x10_temp, 2);
329
+static SENSOR_DEVICE_ATTR_RW(temp1_crit, adt7x10_temp, 3);
330
+static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, adt7x10_t_hyst, 1);
331
+static SENSOR_DEVICE_ATTR_RO(temp1_min_hyst, adt7x10_t_hyst, 2);
332
+static SENSOR_DEVICE_ATTR_RO(temp1_crit_hyst, adt7x10_t_hyst, 3);
333
+static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, adt7x10_alarm,
334
+ ADT7X10_STAT_T_LOW);
335
+static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, adt7x10_alarm,
336
+ ADT7X10_STAT_T_HIGH);
337
+static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, adt7x10_alarm,
338
+ ADT7X10_STAT_T_CRIT);
361339 static DEVICE_ATTR_RO(name);
362340
363341 static struct attribute *adt7x10_attributes[] = {