forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/hwmon/w83781d.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * w83781d.c - Part of lm_sensors, Linux kernel modules for hardware
34 * monitoring
....@@ -5,20 +6,6 @@
56 * Philip Edelbrock <phil@netroedge.com>,
67 * and Mark Studebaker <mdsxyz123@yahoo.com>
78 * Copyright (c) 2007 - 2008 Jean Delvare <jdelvare@suse.de>
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 /*
....@@ -827,7 +814,7 @@
827814 dev_warn(dev,
828815 "Sensor type %d is deprecated, please use 4 instead\n",
829816 W83781D_DEFAULT_BETA);
830
- /* fall through */
817
+ fallthrough;
831818 case 4: /* thermistor */
832819 tmp = w83781d_read_value(data, W83781D_REG_SCFG1);
833820 w83781d_write_value(data, W83781D_REG_SCFG1,
....@@ -907,12 +894,12 @@
907894 }
908895
909896 for (i = 0; i < num_sc; i++) {
910
- data->lm75[i] = i2c_new_dummy(adapter, sc_addr[i]);
911
- if (!data->lm75[i]) {
897
+ data->lm75[i] = i2c_new_dummy_device(adapter, sc_addr[i]);
898
+ if (IS_ERR(data->lm75[i])) {
912899 dev_err(&new_client->dev,
913900 "Subclient %d registration at address 0x%x failed.\n",
914901 i, sc_addr[i]);
915
- err = -ENOMEM;
902
+ err = PTR_ERR(data->lm75[i]);
916903 if (i == 1)
917904 goto ERROR_SC_3;
918905 goto ERROR_SC_2;
....@@ -1205,8 +1192,9 @@
12051192 sysfs_remove_group(&dev->kobj, &w83781d_group_other);
12061193 }
12071194
1208
-static int
1209
-w83781d_probe(struct i2c_client *client, const struct i2c_device_id *id)
1195
+static const struct i2c_device_id w83781d_ids[];
1196
+
1197
+static int w83781d_probe(struct i2c_client *client)
12101198 {
12111199 struct device *dev = &client->dev;
12121200 struct w83781d_data *data;
....@@ -1220,7 +1208,7 @@
12201208 mutex_init(&data->lock);
12211209 mutex_init(&data->update_lock);
12221210
1223
- data->type = id->driver_data;
1211
+ data->type = i2c_match_id(w83781d_ids, client)->driver_data;
12241212 data->client = client;
12251213
12261214 /* attach secondary i2c lm75-like clients */
....@@ -1588,7 +1576,7 @@
15881576 .driver = {
15891577 .name = "w83781d",
15901578 },
1591
- .probe = w83781d_probe,
1579
+ .probe_new = w83781d_probe,
15921580 .remove = w83781d_remove,
15931581 .id_table = w83781d_ids,
15941582 .detect = w83781d_detect,