2022-11-19 00:39:44

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 606/606] [DON'T APPLY] i2c: Switch .probe() to not take an id parameter

---
drivers/i2c/i2c-core-base.c | 11 ++---------
include/linux/i2c.h | 12 +++++++-----
2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 087e480b624c..1fbe16221085 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -558,15 +558,8 @@ static int i2c_device_probe(struct device *dev)
goto err_detach_pm_domain;
}

- /*
- * 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));
+ if (driver->probe)
+ status = driver->probe(client);
else
status = -EINVAL;

diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index d84e0e99f084..7414ec3ba858 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -272,14 +272,16 @@ enum i2c_driver_flags {
struct i2c_driver {
unsigned int class;

+ union {
/* Standard driver model interfaces */
- int (*probe)(struct i2c_client *client, const struct i2c_device_id *id);
+ int (*probe)(struct i2c_client *client);
+ /* New driver model interface to aid the seamless removal of the
+ * current probe()'s, more commonly unused than used second parameter.
+ */
+ int (*probe_new)(struct i2c_client *client);
+ };
void (*remove)(struct i2c_client *client);

- /* New driver model interface to aid the seamless removal of the
- * current probe()'s, more commonly unused than used second parameter.
- */
- int (*probe_new)(struct i2c_client *client);

/* driver model interfaces that don't relate to enumeration */
void (*shutdown)(struct i2c_client *client);
--
2.38.1