summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-tpic2810.c
diff options
context:
space:
mode:
authorStephen Kitt <steve@sk2.org>2022-10-12 16:25:23 +0200
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2022-10-17 10:36:19 +0200
commitbf08ce132cd069afc45635e1ffeb6adb0523cc60 (patch)
tree0c5ff3fe7da50653a85c996105ca928f8126b9cb /drivers/gpio/gpio-tpic2810.c
parent9abf2313adc1ca1b6180c508c25f22f9395cc780 (diff)
downloadlinux-stable-bf08ce132cd069afc45635e1ffeb6adb0523cc60.tar.gz
linux-stable-bf08ce132cd069afc45635e1ffeb6adb0523cc60.tar.bz2
linux-stable-bf08ce132cd069afc45635e1ffeb6adb0523cc60.zip
drivers/gpio: 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> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-tpic2810.c')
-rw-r--r--drivers/gpio/gpio-tpic2810.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-tpic2810.c b/drivers/gpio/gpio-tpic2810.c
index d642c35cb97c..349c5fbd9b02 100644
--- a/drivers/gpio/gpio-tpic2810.c
+++ b/drivers/gpio/gpio-tpic2810.c
@@ -98,8 +98,7 @@ static const struct of_device_id tpic2810_of_match_table[] = {
};
MODULE_DEVICE_TABLE(of, tpic2810_of_match_table);
-static int tpic2810_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static int tpic2810_probe(struct i2c_client *client)
{
struct tpic2810 *gpio;
int ret;
@@ -144,7 +143,7 @@ static struct i2c_driver tpic2810_driver = {
.name = "tpic2810",
.of_match_table = tpic2810_of_match_table,
},
- .probe = tpic2810_probe,
+ .probe_new = tpic2810_probe,
.remove = tpic2810_remove,
.id_table = tpic2810_id_table,
};