linux/drivers/hid/i2c-hid
Stephen Kitt baf34f3bbe HID: i2c: 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: Jiri Kosina <jkosina@suse.cz>
2022-10-18 16:13:25 +02:00
..
i2c-hid-acpi.c HID: i2c-hid-of: Expose the touchscreen-inverted properties 2021-12-14 11:38:04 +01:00
i2c-hid-core.c Assorted HID drivers updates and fixes for 6.1 2022-10-07 11:13:42 -07:00
i2c-hid-dmi-quirks.c HID: i2c-hid: add Vero K147 to descriptor override 2020-11-27 16:17:49 +01:00
i2c-hid-of-elan.c HID: i2c: use simple i2c probe 2022-10-18 16:13:25 +02:00
i2c-hid-of-goodix.c HID: i2c: use simple i2c probe 2022-10-18 16:13:25 +02:00
i2c-hid-of.c HID: i2c: use simple i2c probe 2022-10-18 16:13:25 +02:00
i2c-hid.h i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
Kconfig HID: i2c-hid: elan: Add support for Elan eKTH6915 i2c-hid touchscreens 2022-06-08 11:46:23 +02:00
Makefile HID: i2c-hid: elan: Add support for Elan eKTH6915 i2c-hid touchscreens 2022-06-08 11:46:23 +02:00