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 09:42:39 -0700 |
commit | dd43193976b9a7b2affe8fb71780bb96d16a8449 (patch) | |
tree | 91a68a368fe89780c92d550f97c7e557ec949b58 /drivers/hwmon/pmbus/max31785.c | |
parent | e40358390928f9ab9d8d7dde5c60c08981dc1d81 (diff) |
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/max31785.c')
-rw-r--r-- | drivers/hwmon/pmbus/max31785.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/hwmon/pmbus/max31785.c b/drivers/hwmon/pmbus/max31785.c index d9aa5c873d21..839b957bc03e 100644 --- a/drivers/hwmon/pmbus/max31785.c +++ b/drivers/hwmon/pmbus/max31785.c @@ -324,8 +324,7 @@ static int max31785_configure_dual_tach(struct i2c_client *client, return 0; } -static int max31785_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int max31785_probe(struct i2c_client *client) { struct device *dev = &client->dev; struct pmbus_driver_info *info; @@ -354,7 +353,7 @@ static int max31785_probe(struct i2c_client *client, if (ret == MAX31785A) { dual_tach = true; } else if (ret == MAX31785) { - if (!strcmp("max31785a", id->name)) + if (!strcmp("max31785a", client->name)) dev_warn(dev, "Expected max3175a, found max31785: cannot provide secondary tachometer readings\n"); } else { return -ENODEV; @@ -366,7 +365,7 @@ static int max31785_probe(struct i2c_client *client, return ret; } - return pmbus_do_probe(client, id, info); + return pmbus_do_probe(client, info); } static const struct i2c_device_id max31785_id[] = { @@ -390,7 +389,7 @@ static struct i2c_driver max31785_driver = { .name = "max31785", .of_match_table = max31785_of_match, }, - .probe = max31785_probe, + .probe_new = max31785_probe, .remove = pmbus_do_remove, .id_table = max31785_id, }; |