hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/hwmon/ds1621.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ds1621.c - Part of lm_sensors, Linux kernel modules for hardware
34 * monitoring
....@@ -18,20 +19,6 @@
1819 * Since the DS1621 was the first chipset supported by this driver,
1920 * most comments will refer to this chipset, but are actually general
2021 * and concern all supported chipsets, unless mentioned otherwise.
21
- *
22
- * This program is free software; you can redistribute it and/or modify
23
- * it under the terms of the GNU General Public License as published by
24
- * the Free Software Foundation; either version 2 of the License, or
25
- * (at your option) any later version.
26
- *
27
- * This program is distributed in the hope that it will be useful,
28
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30
- * GNU General Public License for more details.
31
- *
32
- * You should have received a copy of the GNU General Public License
33
- * along with this program; if not, write to the Free Software
34
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3522 */
3623
3724 #include <linux/module.h>
....@@ -234,7 +221,7 @@
234221 return data;
235222 }
236223
237
-static ssize_t show_temp(struct device *dev, struct device_attribute *da,
224
+static ssize_t temp_show(struct device *dev, struct device_attribute *da,
238225 char *buf)
239226 {
240227 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
....@@ -243,8 +230,8 @@
243230 DS1621_TEMP_FROM_REG(data->temp[attr->index]));
244231 }
245232
246
-static ssize_t set_temp(struct device *dev, struct device_attribute *da,
247
- const char *buf, size_t count)
233
+static ssize_t temp_store(struct device *dev, struct device_attribute *da,
234
+ const char *buf, size_t count)
248235 {
249236 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
250237 struct ds1621_data *data = dev_get_drvdata(dev);
....@@ -270,7 +257,7 @@
270257 return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->conf));
271258 }
272259
273
-static ssize_t show_alarm(struct device *dev, struct device_attribute *da,
260
+static ssize_t alarm_show(struct device *dev, struct device_attribute *da,
274261 char *buf)
275262 {
276263 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
....@@ -319,13 +306,11 @@
319306 static DEVICE_ATTR_RO(alarms);
320307 static DEVICE_ATTR_RW(update_interval);
321308
322
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
323
-static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp, set_temp, 1);
324
-static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, set_temp, 2);
325
-static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL,
326
- DS1621_ALARM_TEMP_LOW);
327
-static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL,
328
- DS1621_ALARM_TEMP_HIGH);
309
+static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
310
+static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, 1);
311
+static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, 2);
312
+static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, DS1621_ALARM_TEMP_LOW);
313
+static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, DS1621_ALARM_TEMP_HIGH);
329314
330315 static struct attribute *ds1621_attributes[] = {
331316 &sensor_dev_attr_temp1_input.dev_attr.attr,
....@@ -357,8 +342,9 @@
357342 };
358343 __ATTRIBUTE_GROUPS(ds1621);
359344
360
-static int ds1621_probe(struct i2c_client *client,
361
- const struct i2c_device_id *id)
345
+static const struct i2c_device_id ds1621_id[];
346
+
347
+static int ds1621_probe(struct i2c_client *client)
362348 {
363349 struct ds1621_data *data;
364350 struct device *hwmon_dev;
....@@ -370,7 +356,7 @@
370356
371357 mutex_init(&data->update_lock);
372358
373
- data->kind = id->driver_data;
359
+ data->kind = i2c_match_id(ds1621_id, client)->driver_data;
374360 data->client = client;
375361
376362 /* Initialize the DS1621 chip */
....@@ -398,7 +384,7 @@
398384 .driver = {
399385 .name = "ds1621",
400386 },
401
- .probe = ds1621_probe,
387
+ .probe_new = ds1621_probe,
402388 .id_table = ds1621_id,
403389 };
404390