diff options
author | Stephen Kitt <steve@sk2.org> | 2020-08-08 23:00:04 +0200 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2020-09-23 18:42:39 +0200 |
commit | dd43193976b9a7b2affe8fb71780bb96d16a8449 (patch) | |
tree | 91a68a368fe89780c92d550f97c7e557ec949b58 /drivers/hwmon/pmbus/ucd9000.c | |
parent | hwmon: (drivetemp) Add usage not describing impact on drive spin-down (diff) | |
download | linux-dd43193976b9a7b2affe8fb71780bb96d16a8449.tar.xz linux-dd43193976b9a7b2affe8fb71780bb96d16a8449.zip |
hwmon (pmbus) use simple i2c probe function
pmbus_do_probe doesn't use the id information provided in its second
argument, so this can be removed, which then allows using the
single-parameter i2c probe function ("probe_new") for probes.
This avoids scanning the identifier tables during probes.
Drivers which didn't use the id are converted as-is; drivers which did
are modified as follows:
* if the information in i2c_client is sufficient, that's used instead
(client->name);
* configured v. probed comparisons are performed by comparing the
configured name to the detected name, instead of the ids; this
involves strcmp but is still cheaper than comparing all the device
names when scanning the tables;
* anything else is handled by calling i2c_match_id() with the same
level of error-handling (if any) as before.
Additionally, the mismatch message in the ltc2978 driver is adjusted
so that it no longer assumes that the driver_data is an index into
ltc2978_id.
Signed-off-by: Stephen Kitt <steve@sk2.org>
Acked-by: Wolfram Sang <wsa@kernel.org>
Link: https://lore.kernel.org/r/20200808210004.30880-1-steve@sk2.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/pmbus/ucd9000.c')
-rw-r--r-- | drivers/hwmon/pmbus/ucd9000.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c index 81f4c4f166cd..f8017993e2b4 100644 --- a/drivers/hwmon/pmbus/ucd9000.c +++ b/drivers/hwmon/pmbus/ucd9000.c @@ -487,8 +487,7 @@ static int ucd9000_init_debugfs(struct i2c_client *client, } #endif /* CONFIG_DEBUG_FS */ -static int ucd9000_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int ucd9000_probe(struct i2c_client *client) { u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1]; struct ucd9000_data *data; @@ -523,12 +522,12 @@ static int ucd9000_probe(struct i2c_client *client, if (client->dev.of_node) chip = (enum chips)of_device_get_match_data(&client->dev); else - chip = id->driver_data; + chip = mid->driver_data; - if (chip != ucd9000 && chip != mid->driver_data) + if (chip != ucd9000 && strcmp(client->name, mid->name) != 0) dev_notice(&client->dev, "Device mismatch: Configured %s, detected %s\n", - id->name, mid->name); + client->name, mid->name); data = devm_kzalloc(&client->dev, sizeof(struct ucd9000_data), GFP_KERNEL); @@ -603,7 +602,7 @@ static int ucd9000_probe(struct i2c_client *client, ucd9000_probe_gpio(client, mid, data); - ret = pmbus_do_probe(client, mid, info); + ret = pmbus_do_probe(client, info); if (ret) return ret; @@ -621,7 +620,7 @@ static struct i2c_driver ucd9000_driver = { .name = "ucd9000", .of_match_table = of_match_ptr(ucd9000_of_match), }, - .probe = ucd9000_probe, + .probe_new = ucd9000_probe, .remove = pmbus_do_remove, .id_table = ucd9000_id, }; |