hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/hwmon/smsc47b397.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * smsc47b397.c - Part of lm_sensors, Linux kernel modules
34 * for hardware monitoring
....@@ -10,20 +11,6 @@
1011 * derived in part from smsc47m1.c:
1112 * Copyright (C) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
1213 * Copyright (C) 2004 Jean Delvare <jdelvare@suse.de>
13
- *
14
- * This program is free software; you can redistribute it and/or modify
15
- * it under the terms of the GNU General Public License as published by
16
- * the Free Software Foundation; either version 2 of the License, or
17
- * (at your option) any later version.
18
- *
19
- * This program is distributed in the hope that it will be useful,
20
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- * GNU General Public License for more details.
23
- *
24
- * You should have received a copy of the GNU General Public License
25
- * along with this program; if not, write to the Free Software
26
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2714 */
2815
2916 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -169,18 +156,18 @@
169156 return (s8)reg * 1000;
170157 }
171158
172
-static ssize_t show_temp(struct device *dev, struct device_attribute
173
- *devattr, char *buf)
159
+static ssize_t temp_show(struct device *dev, struct device_attribute *devattr,
160
+ char *buf)
174161 {
175162 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
176163 struct smsc47b397_data *data = smsc47b397_update_device(dev);
177164 return sprintf(buf, "%d\n", temp_from_reg(data->temp[attr->index]));
178165 }
179166
180
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
181
-static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1);
182
-static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2);
183
-static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3);
167
+static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
168
+static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1);
169
+static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2);
170
+static SENSOR_DEVICE_ATTR_RO(temp4_input, temp, 3);
184171
185172 /*
186173 * FAN: 1 RPM/bit
....@@ -193,17 +180,17 @@
193180 return 90000 * 60 / reg;
194181 }
195182
196
-static ssize_t show_fan(struct device *dev, struct device_attribute
197
- *devattr, char *buf)
183
+static ssize_t fan_show(struct device *dev, struct device_attribute *devattr,
184
+ char *buf)
198185 {
199186 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
200187 struct smsc47b397_data *data = smsc47b397_update_device(dev);
201188 return sprintf(buf, "%d\n", fan_from_reg(data->fan[attr->index]));
202189 }
203
-static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0);
204
-static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1);
205
-static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2);
206
-static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3);
190
+static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0);
191
+static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1);
192
+static SENSOR_DEVICE_ATTR_RO(fan3_input, fan, 2);
193
+static SENSOR_DEVICE_ATTR_RO(fan4_input, fan, 3);
207194
208195 static struct attribute *smsc47b397_attrs[] = {
209196 &sensor_dev_attr_temp1_input.dev_attr.attr,