| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Hardware monitoring driver for ucd9200 series Digital PWM System Controllers |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 19 | 6 | */ |
|---|
| 20 | 7 | |
|---|
| 21 | 8 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 47 | 34 | }; |
|---|
| 48 | 35 | MODULE_DEVICE_TABLE(i2c, ucd9200_id); |
|---|
| 49 | 36 | |
|---|
| 50 | | -static const struct of_device_id ucd9200_of_match[] = { |
|---|
| 37 | +static const struct of_device_id __maybe_unused ucd9200_of_match[] = { |
|---|
| 51 | 38 | { |
|---|
| 52 | 39 | .compatible = "ti,cd9200", |
|---|
| 53 | 40 | .data = (void *)ucd9200 |
|---|
| .. | .. |
|---|
| 84 | 71 | }; |
|---|
| 85 | 72 | MODULE_DEVICE_TABLE(of, ucd9200_of_match); |
|---|
| 86 | 73 | |
|---|
| 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) |
|---|
| 89 | 75 | { |
|---|
| 90 | 76 | u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1]; |
|---|
| 91 | 77 | struct pmbus_driver_info *info; |
|---|
| .. | .. |
|---|
| 119 | 105 | if (client->dev.of_node) |
|---|
| 120 | 106 | chip = (enum chips)of_device_get_match_data(&client->dev); |
|---|
| 121 | 107 | else |
|---|
| 122 | | - chip = id->driver_data; |
|---|
| 108 | + chip = mid->driver_data; |
|---|
| 123 | 109 | |
|---|
| 124 | | - if (chip != ucd9200 && chip != mid->driver_data) |
|---|
| 110 | + if (chip != ucd9200 && strcmp(client->name, mid->name) != 0) |
|---|
| 125 | 111 | dev_notice(&client->dev, |
|---|
| 126 | 112 | "Device mismatch: Configured %s, detected %s\n", |
|---|
| 127 | | - id->name, mid->name); |
|---|
| 113 | + client->name, mid->name); |
|---|
| 128 | 114 | |
|---|
| 129 | 115 | info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), |
|---|
| 130 | 116 | GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 205 | 191 | if (mid->driver_data == ucd9240) |
|---|
| 206 | 192 | info->func[0] |= PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12; |
|---|
| 207 | 193 | |
|---|
| 208 | | - return pmbus_do_probe(client, mid, info); |
|---|
| 194 | + return pmbus_do_probe(client, info); |
|---|
| 209 | 195 | } |
|---|
| 210 | 196 | |
|---|
| 211 | 197 | /* This is the driver that will be inserted */ |
|---|
| .. | .. |
|---|
| 214 | 200 | .name = "ucd9200", |
|---|
| 215 | 201 | .of_match_table = of_match_ptr(ucd9200_of_match), |
|---|
| 216 | 202 | }, |
|---|
| 217 | | - .probe = ucd9200_probe, |
|---|
| 203 | + .probe_new = ucd9200_probe, |
|---|
| 218 | 204 | .remove = pmbus_do_remove, |
|---|
| 219 | 205 | .id_table = ucd9200_id, |
|---|
| 220 | 206 | }; |
|---|