hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/hwmon/pmbus/ucd9200.c
....@@ -1,21 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Hardware monitoring driver for ucd9200 series Digital PWM System Controllers
34 *
45 * Copyright (C) 2011 Ericsson AB.
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
196 */
207
218 #include <linux/kernel.h>
....@@ -47,7 +34,7 @@
4734 };
4835 MODULE_DEVICE_TABLE(i2c, ucd9200_id);
4936
50
-static const struct of_device_id ucd9200_of_match[] = {
37
+static const struct of_device_id __maybe_unused ucd9200_of_match[] = {
5138 {
5239 .compatible = "ti,cd9200",
5340 .data = (void *)ucd9200
....@@ -84,8 +71,7 @@
8471 };
8572 MODULE_DEVICE_TABLE(of, ucd9200_of_match);
8673
87
-static int ucd9200_probe(struct i2c_client *client,
88
- const struct i2c_device_id *id)
74
+static int ucd9200_probe(struct i2c_client *client)
8975 {
9076 u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1];
9177 struct pmbus_driver_info *info;
....@@ -119,12 +105,12 @@
119105 if (client->dev.of_node)
120106 chip = (enum chips)of_device_get_match_data(&client->dev);
121107 else
122
- chip = id->driver_data;
108
+ chip = mid->driver_data;
123109
124
- if (chip != ucd9200 && chip != mid->driver_data)
110
+ if (chip != ucd9200 && strcmp(client->name, mid->name) != 0)
125111 dev_notice(&client->dev,
126112 "Device mismatch: Configured %s, detected %s\n",
127
- id->name, mid->name);
113
+ client->name, mid->name);
128114
129115 info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
130116 GFP_KERNEL);
....@@ -205,7 +191,7 @@
205191 if (mid->driver_data == ucd9240)
206192 info->func[0] |= PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12;
207193
208
- return pmbus_do_probe(client, mid, info);
194
+ return pmbus_do_probe(client, info);
209195 }
210196
211197 /* This is the driver that will be inserted */
....@@ -214,7 +200,7 @@
214200 .name = "ucd9200",
215201 .of_match_table = of_match_ptr(ucd9200_of_match),
216202 },
217
- .probe = ucd9200_probe,
203
+ .probe_new = ucd9200_probe,
218204 .remove = pmbus_do_remove,
219205 .id_table = ucd9200_id,
220206 };