| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * w83781d.c - Part of lm_sensors, Linux kernel modules for hardware |
|---|
| 3 | 4 | * monitoring |
|---|
| .. | .. |
|---|
| 5 | 6 | * Philip Edelbrock <phil@netroedge.com>, |
|---|
| 6 | 7 | * and Mark Studebaker <mdsxyz123@yahoo.com> |
|---|
| 7 | 8 | * 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. |
|---|
| 22 | 9 | */ |
|---|
| 23 | 10 | |
|---|
| 24 | 11 | /* |
|---|
| .. | .. |
|---|
| 827 | 814 | dev_warn(dev, |
|---|
| 828 | 815 | "Sensor type %d is deprecated, please use 4 instead\n", |
|---|
| 829 | 816 | W83781D_DEFAULT_BETA); |
|---|
| 830 | | - /* fall through */ |
|---|
| 817 | + fallthrough; |
|---|
| 831 | 818 | case 4: /* thermistor */ |
|---|
| 832 | 819 | tmp = w83781d_read_value(data, W83781D_REG_SCFG1); |
|---|
| 833 | 820 | w83781d_write_value(data, W83781D_REG_SCFG1, |
|---|
| .. | .. |
|---|
| 907 | 894 | } |
|---|
| 908 | 895 | |
|---|
| 909 | 896 | 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])) { |
|---|
| 912 | 899 | dev_err(&new_client->dev, |
|---|
| 913 | 900 | "Subclient %d registration at address 0x%x failed.\n", |
|---|
| 914 | 901 | i, sc_addr[i]); |
|---|
| 915 | | - err = -ENOMEM; |
|---|
| 902 | + err = PTR_ERR(data->lm75[i]); |
|---|
| 916 | 903 | if (i == 1) |
|---|
| 917 | 904 | goto ERROR_SC_3; |
|---|
| 918 | 905 | goto ERROR_SC_2; |
|---|
| .. | .. |
|---|
| 1205 | 1192 | sysfs_remove_group(&dev->kobj, &w83781d_group_other); |
|---|
| 1206 | 1193 | } |
|---|
| 1207 | 1194 | |
|---|
| 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) |
|---|
| 1210 | 1198 | { |
|---|
| 1211 | 1199 | struct device *dev = &client->dev; |
|---|
| 1212 | 1200 | struct w83781d_data *data; |
|---|
| .. | .. |
|---|
| 1220 | 1208 | mutex_init(&data->lock); |
|---|
| 1221 | 1209 | mutex_init(&data->update_lock); |
|---|
| 1222 | 1210 | |
|---|
| 1223 | | - data->type = id->driver_data; |
|---|
| 1211 | + data->type = i2c_match_id(w83781d_ids, client)->driver_data; |
|---|
| 1224 | 1212 | data->client = client; |
|---|
| 1225 | 1213 | |
|---|
| 1226 | 1214 | /* attach secondary i2c lm75-like clients */ |
|---|
| .. | .. |
|---|
| 1588 | 1576 | .driver = { |
|---|
| 1589 | 1577 | .name = "w83781d", |
|---|
| 1590 | 1578 | }, |
|---|
| 1591 | | - .probe = w83781d_probe, |
|---|
| 1579 | + .probe_new = w83781d_probe, |
|---|
| 1592 | 1580 | .remove = w83781d_remove, |
|---|
| 1593 | 1581 | .id_table = w83781d_ids, |
|---|
| 1594 | 1582 | .detect = w83781d_detect, |
|---|