hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/drivers/hwmon/ds620.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ds620.c - Support for temperature sensor and thermostat DS620
34 *
45 * Copyright (C) 2010, 2011 Roland Stigge <stigge@antcom.de>
56 *
67 * based on ds1621.c by Christian W. Zuckschwerdt <zany@triq.net>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
218 */
229
2310 #include <linux/module.h>
....@@ -139,7 +126,7 @@
139126 return ret;
140127 }
141128
142
-static ssize_t show_temp(struct device *dev, struct device_attribute *da,
129
+static ssize_t temp_show(struct device *dev, struct device_attribute *da,
143130 char *buf)
144131 {
145132 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
....@@ -151,8 +138,8 @@
151138 return sprintf(buf, "%d\n", ((data->temp[attr->index] / 8) * 625) / 10);
152139 }
153140
154
-static ssize_t set_temp(struct device *dev, struct device_attribute *da,
155
- const char *buf, size_t count)
141
+static ssize_t temp_store(struct device *dev, struct device_attribute *da,
142
+ const char *buf, size_t count)
156143 {
157144 int res;
158145 long val;
....@@ -176,7 +163,7 @@
176163 return count;
177164 }
178165
179
-static ssize_t show_alarm(struct device *dev, struct device_attribute *da,
166
+static ssize_t alarm_show(struct device *dev, struct device_attribute *da,
180167 char *buf)
181168 {
182169 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
....@@ -207,13 +194,11 @@
207194 return sprintf(buf, "%d\n", !!(conf & attr->index));
208195 }
209196
210
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
211
-static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp, set_temp, 1);
212
-static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, set_temp, 2);
213
-static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL,
214
- DS620_REG_CONFIG_TLF);
215
-static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL,
216
- DS620_REG_CONFIG_THF);
197
+static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
198
+static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, 1);
199
+static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, 2);
200
+static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, DS620_REG_CONFIG_TLF);
201
+static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, DS620_REG_CONFIG_THF);
217202
218203 static struct attribute *ds620_attrs[] = {
219204 &sensor_dev_attr_temp1_input.dev_attr.attr,
....@@ -226,8 +211,7 @@
226211
227212 ATTRIBUTE_GROUPS(ds620);
228213
229
-static int ds620_probe(struct i2c_client *client,
230
- const struct i2c_device_id *id)
214
+static int ds620_probe(struct i2c_client *client)
231215 {
232216 struct device *dev = &client->dev;
233217 struct device *hwmon_dev;
....@@ -261,7 +245,7 @@
261245 .driver = {
262246 .name = "ds620",
263247 },
264
- .probe = ds620_probe,
248
+ .probe_new = ds620_probe,
265249 .id_table = ds620_id,
266250 };
267251