From dd43193976b9a7b2affe8fb71780bb96d16a8449 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Sat, 8 Aug 2020 23:00:04 +0200 Subject: 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 Acked-by: Wolfram Sang Link: https://lore.kernel.org/r/20200808210004.30880-1-steve@sk2.org Signed-off-by: Guenter Roeck --- Documentation/hwmon/pmbus-core.rst | 3 +-- Documentation/hwmon/pmbus.rst | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'Documentation/hwmon') diff --git a/Documentation/hwmon/pmbus-core.rst b/Documentation/hwmon/pmbus-core.rst index 501b37b0610d..e22c4f6808bc 100644 --- a/Documentation/hwmon/pmbus-core.rst +++ b/Documentation/hwmon/pmbus-core.rst @@ -270,8 +270,7 @@ obtain the chip status. Therefore, it must _not_ be called from that function. :: - int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, - struct pmbus_driver_info *info); + int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info); Execute probe function. Similar to standard probe function for other drivers, with the pointer to struct pmbus_driver_info as additional argument. Calls diff --git a/Documentation/hwmon/pmbus.rst b/Documentation/hwmon/pmbus.rst index 67284bd5f4cd..fb3ad67dedc1 100644 --- a/Documentation/hwmon/pmbus.rst +++ b/Documentation/hwmon/pmbus.rst @@ -143,10 +143,9 @@ Emerson DS1200 power modules might look as follows:: | PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12, }; - static int ds1200_probe(struct i2c_client *client, - const struct i2c_device_id *id) + static int ds1200_probe(struct i2c_client *client) { - return pmbus_do_probe(client, id, &ds1200_info); + return pmbus_do_probe(client, &ds1200_info); } static int ds1200_remove(struct i2c_client *client) @@ -166,7 +165,7 @@ Emerson DS1200 power modules might look as follows:: .driver = { .name = "ds1200", }, - .probe = ds1200_probe, + .probe_new = ds1200_probe, .remove = ds1200_remove, .id_table = ds1200_id, }; -- cgit v1.2.3-59-g8ed1b