summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/emc2305.c
diff options
context:
space:
mode:
authorStephen Kitt <steve@sk2.org>2022-10-11 16:33:08 +0200
committerGuenter Roeck <linux@roeck-us.net>2022-12-05 01:45:02 +0100
commitdeeab9ea40dbaabdf0e2828b5c3da3418ae7dd39 (patch)
tree8ec9b5247be716a2438059f87c381b6c7876c3b3 /drivers/hwmon/emc2305.c
parenthwmon: (it87) Check for a valid chip before using force_id (diff)
downloadlinux-deeab9ea40dbaabdf0e2828b5c3da3418ae7dd39.tar.xz
linux-deeab9ea40dbaabdf0e2828b5c3da3418ae7dd39.zip
hwmon: use simple i2c probe
All these drivers have an i2c probe function which doesn't use the "struct i2c_device_id *id" parameter, so they can trivially be converted to the "probe_new" style of probe with a single argument. This is part of an ongoing transition to single-argument i2c probe functions. Old-style probe functions involve a call to i2c_match_id: in drivers/i2c/i2c-core-base.c, /* * When there are no more users of probe(), * rename probe_new to probe. */ if (driver->probe_new) status = driver->probe_new(client); else if (driver->probe) status = driver->probe(client, i2c_match_id(driver->id_table, client)); else status = -EINVAL; Drivers which don't need the second parameter can be declared using probe_new instead, avoiding the call to i2c_match_id. Drivers which do can still be converted to probe_new-style, calling i2c_match_id themselves (as is done currently for of_match_id). This change was done using the following Coccinelle script, and fixed up for whitespace changes: @ rule1 @ identifier fn; identifier client, id; @@ - static int fn(struct i2c_client *client, const struct i2c_device_id *id) + static int fn(struct i2c_client *client) { ...when != id } @ rule2 depends on rule1 @ identifier rule1.fn; identifier driver; @@ struct i2c_driver driver = { - .probe + .probe_new = ( fn | - &fn + fn ) , }; Signed-off-by: Stephen Kitt <steve@sk2.org> Link: https://lore.kernel.org/r/20221011143309.3141267-1-steve@sk2.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/emc2305.c')
-rw-r--r--drivers/hwmon/emc2305.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c
index aa1f25add0b6..f222fcf3b6aa 100644
--- a/drivers/hwmon/emc2305.c
+++ b/drivers/hwmon/emc2305.c
@@ -518,7 +518,7 @@ static int emc2305_identify(struct device *dev)
return 0;
}
-static int emc2305_probe(struct i2c_client *client, const struct i2c_device_id *id)
+static int emc2305_probe(struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
struct device *dev = &client->dev;
@@ -607,7 +607,7 @@ static struct i2c_driver emc2305_driver = {
.driver = {
.name = "emc2305",
},
- .probe = emc2305_probe,
+ .probe_new = emc2305_probe,
.remove = emc2305_remove,
.id_table = emc2305_ids,
.address_list = emc2305_normal_i2c,