* [PATCH 1/9] misc: ad525x_dpot-i2c: Convert to i2c's .probe_new()
2023-02-24 12:05 [PATCH 0/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
@ 2023-02-24 12:05 ` Uwe Kleine-König
2023-02-24 12:05 ` [PATCH 2/9] mtd: maps: pismo: " Uwe Kleine-König
` (7 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Uwe Kleine-König @ 2023-02-24 12:05 UTC (permalink / raw)
To: Wolfram Sang; +Cc: kernel, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/lkml/20221118224540.619276-483-uwe@kleine-koenig.org
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/ad525x_dpot-i2c.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/ad525x_dpot-i2c.c b/drivers/misc/ad525x_dpot-i2c.c
index 28ffb4377d98..3856d5c04c5f 100644
--- a/drivers/misc/ad525x_dpot-i2c.c
+++ b/drivers/misc/ad525x_dpot-i2c.c
@@ -50,9 +50,9 @@ static const struct ad_dpot_bus_ops bops = {
.write_r8d16 = write_r8d16,
};
-static int ad_dpot_i2c_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static int ad_dpot_i2c_probe(struct i2c_client *client)
{
+ const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct ad_dpot_bus_data bdata = {
.client = client,
.bops = &bops,
@@ -106,7 +106,7 @@ static struct i2c_driver ad_dpot_i2c_driver = {
.driver = {
.name = "ad_dpot",
},
- .probe = ad_dpot_i2c_probe,
+ .probe_new = ad_dpot_i2c_probe,
.remove = ad_dpot_i2c_remove,
.id_table = ad_dpot_id,
};
--
2.39.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 2/9] mtd: maps: pismo: Convert to i2c's .probe_new()
2023-02-24 12:05 [PATCH 0/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
2023-02-24 12:05 ` [PATCH 1/9] misc: ad525x_dpot-i2c: Convert to i2c's .probe_new() Uwe Kleine-König
@ 2023-02-24 12:05 ` Uwe Kleine-König
2023-02-24 12:05 ` [PATCH 3/9] serial: sc16is7xx: " Uwe Kleine-König
` (6 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Uwe Kleine-König @ 2023-02-24 12:05 UTC (permalink / raw)
To: Wolfram Sang
Cc: kernel, Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Ajay Gupta, Peter Senna Tschudin, Vladimir Oltean, Luca Ceresoli,
linux-mtd, linux-kernel
The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.
Acked-by: Richard Weinberger <richard@nod.at>
Link: https://lore.kernel.org/lkml/20221118224540.619276-497-uwe@kleine-koenig.org
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/mtd/maps/pismo.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c
index 5fcefcd0baca..3e0fff3f129e 100644
--- a/drivers/mtd/maps/pismo.c
+++ b/drivers/mtd/maps/pismo.c
@@ -206,8 +206,7 @@ static void pismo_remove(struct i2c_client *client)
kfree(pismo);
}
-static int pismo_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static int pismo_probe(struct i2c_client *client)
{
struct pismo_pdata *pdata = client->dev.platform_data;
struct pismo_eeprom eeprom;
@@ -260,7 +259,7 @@ static struct i2c_driver pismo_driver = {
.driver = {
.name = "pismo",
},
- .probe = pismo_probe,
+ .probe_new = pismo_probe,
.remove = pismo_remove,
.id_table = pismo_id,
};
--
2.39.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 3/9] serial: sc16is7xx: Convert to i2c's .probe_new()
2023-02-24 12:05 [PATCH 0/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
2023-02-24 12:05 ` [PATCH 1/9] misc: ad525x_dpot-i2c: Convert to i2c's .probe_new() Uwe Kleine-König
2023-02-24 12:05 ` [PATCH 2/9] mtd: maps: pismo: " Uwe Kleine-König
@ 2023-02-24 12:05 ` Uwe Kleine-König
2023-02-24 12:05 ` [PATCH 4/9] w1: ds2482: " Uwe Kleine-König
` (5 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Uwe Kleine-König @ 2023-02-24 12:05 UTC (permalink / raw)
To: Wolfram Sang
Cc: kernel, Greg Kroah-Hartman, Jiri Slaby, linux-serial,
linux-kernel
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/lkml/20221118224540.619276-572-uwe@kleine-koenig.org
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/tty/serial/sc16is7xx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 39f92eb1e698..8412b25eac86 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1665,9 +1665,9 @@ MODULE_ALIAS("spi:sc16is7xx");
#endif
#ifdef CONFIG_SERIAL_SC16IS7XX_I2C
-static int sc16is7xx_i2c_probe(struct i2c_client *i2c,
- const struct i2c_device_id *id)
+static int sc16is7xx_i2c_probe(struct i2c_client *i2c)
{
+ const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
const struct sc16is7xx_devtype *devtype;
struct regmap *regmap;
@@ -1708,7 +1708,7 @@ static struct i2c_driver sc16is7xx_i2c_uart_driver = {
.name = SC16IS7XX_NAME,
.of_match_table = sc16is7xx_dt_ids,
},
- .probe = sc16is7xx_i2c_probe,
+ .probe_new = sc16is7xx_i2c_probe,
.remove = sc16is7xx_i2c_remove,
.id_table = sc16is7xx_i2c_id_table,
};
--
2.39.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 4/9] w1: ds2482: Convert to i2c's .probe_new()
2023-02-24 12:05 [PATCH 0/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
` (2 preceding siblings ...)
2023-02-24 12:05 ` [PATCH 3/9] serial: sc16is7xx: " Uwe Kleine-König
@ 2023-02-24 12:05 ` Uwe Kleine-König
2023-02-27 12:36 ` Jean Delvare
2023-02-24 12:05 ` [PATCH 5/9] media: i2c: ov5695: convert " Uwe Kleine-König
` (4 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Uwe Kleine-König @ 2023-02-24 12:05 UTC (permalink / raw)
To: Wolfram Sang
Cc: kernel, Evgeniy Polyakov, Crt Mori, Jonathan Cameron,
Jean Delvare, Javier Martinez Canillas, linux-kernel
The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.
Link: https://lore.kernel.org/lkml/20221118224540.619276-596-uwe@kleine-koenig.org
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/w1/masters/ds2482.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
index 62c44616d8a9..3d8b51316bef 100644
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -442,8 +442,7 @@ static u8 ds2482_w1_set_pullup(void *data, int delay)
}
-static int ds2482_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static int ds2482_probe(struct i2c_client *client)
{
struct ds2482_data *data;
int err = -ENODEV;
@@ -553,7 +552,7 @@ static struct i2c_driver ds2482_driver = {
.driver = {
.name = "ds2482",
},
- .probe = ds2482_probe,
+ .probe_new = ds2482_probe,
.remove = ds2482_remove,
.id_table = ds2482_id,
};
--
2.39.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 4/9] w1: ds2482: Convert to i2c's .probe_new()
2023-02-24 12:05 ` [PATCH 4/9] w1: ds2482: " Uwe Kleine-König
@ 2023-02-27 12:36 ` Jean Delvare
0 siblings, 0 replies; 17+ messages in thread
From: Jean Delvare @ 2023-02-27 12:36 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Wolfram Sang, kernel, Evgeniy Polyakov, Crt Mori,
Jonathan Cameron, Javier Martinez Canillas, linux-kernel
On Fri, 24 Feb 2023 13:05:55 +0100, Uwe Kleine-König wrote:
> The probe function doesn't make use of the i2c_device_id * parameter so it
> can be trivially converted.
>
> Link: https://lore.kernel.org/lkml/20221118224540.619276-596-uwe@kleine-koenig.org
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/w1/masters/ds2482.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
> index 62c44616d8a9..3d8b51316bef 100644
> --- a/drivers/w1/masters/ds2482.c
> +++ b/drivers/w1/masters/ds2482.c
> @@ -442,8 +442,7 @@ static u8 ds2482_w1_set_pullup(void *data, int delay)
> }
>
>
> -static int ds2482_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +static int ds2482_probe(struct i2c_client *client)
> {
> struct ds2482_data *data;
> int err = -ENODEV;
> @@ -553,7 +552,7 @@ static struct i2c_driver ds2482_driver = {
> .driver = {
> .name = "ds2482",
> },
> - .probe = ds2482_probe,
> + .probe_new = ds2482_probe,
> .remove = ds2482_remove,
> .id_table = ds2482_id,
> };
Reviewed-by: Jean Delvare <jdelvare@suse.de>
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 5/9] media: i2c: ov5695: convert to i2c's .probe_new()
2023-02-24 12:05 [PATCH 0/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
` (3 preceding siblings ...)
2023-02-24 12:05 ` [PATCH 4/9] w1: ds2482: " Uwe Kleine-König
@ 2023-02-24 12:05 ` Uwe Kleine-König
2023-02-24 12:41 ` Hans Verkuil
2023-02-24 12:05 ` [PATCH 6/9] media: i2c: ov2685: " Uwe Kleine-König
` (3 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Uwe Kleine-König @ 2023-02-24 12:05 UTC (permalink / raw)
To: Wolfram Sang
Cc: kernel, Shunqian Zheng, Mauro Carvalho Chehab, linux-media,
linux-kernel, Kieran Bingham
The probe function doesn't make use of the i2c_device_id * parameter so
it can be trivially converted.
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Link: https://lore.kernel.org/lkml/20221121102705.16092-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/media/i2c/ov5695.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c
index 61906fc54e37..b287c28920a6 100644
--- a/drivers/media/i2c/ov5695.c
+++ b/drivers/media/i2c/ov5695.c
@@ -1267,8 +1267,7 @@ static int ov5695_configure_regulators(struct ov5695 *ov5695)
ov5695->supplies);
}
-static int ov5695_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static int ov5695_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct ov5695 *ov5695;
@@ -1393,7 +1392,7 @@ static struct i2c_driver ov5695_i2c_driver = {
.pm = &ov5695_pm_ops,
.of_match_table = of_match_ptr(ov5695_of_match),
},
- .probe = &ov5695_probe,
+ .probe_new = &ov5695_probe,
.remove = &ov5695_remove,
};
--
2.39.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 5/9] media: i2c: ov5695: convert to i2c's .probe_new()
2023-02-24 12:05 ` [PATCH 5/9] media: i2c: ov5695: convert " Uwe Kleine-König
@ 2023-02-24 12:41 ` Hans Verkuil
0 siblings, 0 replies; 17+ messages in thread
From: Hans Verkuil @ 2023-02-24 12:41 UTC (permalink / raw)
To: Uwe Kleine-König, Wolfram Sang
Cc: kernel, Shunqian Zheng, Mauro Carvalho Chehab, linux-media,
linux-kernel, Kieran Bingham
On 24/02/2023 13:05, Uwe Kleine-König wrote:
> The probe function doesn't make use of the i2c_device_id * parameter so
> it can be trivially converted.
>
> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Link: https://lore.kernel.org/lkml/20221121102705.16092-1-u.kleine-koenig@pengutronix.de
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/media/i2c/ov5695.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c
> index 61906fc54e37..b287c28920a6 100644
> --- a/drivers/media/i2c/ov5695.c
> +++ b/drivers/media/i2c/ov5695.c
> @@ -1267,8 +1267,7 @@ static int ov5695_configure_regulators(struct ov5695 *ov5695)
> ov5695->supplies);
> }
>
> -static int ov5695_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +static int ov5695_probe(struct i2c_client *client)
> {
> struct device *dev = &client->dev;
> struct ov5695 *ov5695;
> @@ -1393,7 +1392,7 @@ static struct i2c_driver ov5695_i2c_driver = {
> .pm = &ov5695_pm_ops,
> .of_match_table = of_match_ptr(ov5695_of_match),
> },
> - .probe = &ov5695_probe,
> + .probe_new = &ov5695_probe,
> .remove = &ov5695_remove,
> };
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 6/9] media: i2c: ov2685: convert to i2c's .probe_new()
2023-02-24 12:05 [PATCH 0/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
` (4 preceding siblings ...)
2023-02-24 12:05 ` [PATCH 5/9] media: i2c: ov5695: convert " Uwe Kleine-König
@ 2023-02-24 12:05 ` Uwe Kleine-König
2023-02-24 12:41 ` Hans Verkuil
2023-02-24 12:05 ` [PATCH 7/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
` (2 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Uwe Kleine-König @ 2023-02-24 12:05 UTC (permalink / raw)
To: Wolfram Sang
Cc: kernel, Shunqian Zheng, Mauro Carvalho Chehab, linux-media,
linux-kernel, Kieran Bingham
The probe function doesn't make use of the i2c_device_id * parameter so
it can be trivially converted.
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Link: https://lore.kernel.org/lkml/20221121102838.16448-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/media/i2c/ov2685.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/ov2685.c b/drivers/media/i2c/ov2685.c
index a3b524f15d89..1c80b121e7d6 100644
--- a/drivers/media/i2c/ov2685.c
+++ b/drivers/media/i2c/ov2685.c
@@ -707,8 +707,7 @@ static int ov2685_configure_regulators(struct ov2685 *ov2685)
ov2685->supplies);
}
-static int ov2685_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static int ov2685_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct ov2685 *ov2685;
@@ -830,7 +829,7 @@ static struct i2c_driver ov2685_i2c_driver = {
.pm = &ov2685_pm_ops,
.of_match_table = of_match_ptr(ov2685_of_match),
},
- .probe = &ov2685_probe,
+ .probe_new = &ov2685_probe,
.remove = &ov2685_remove,
};
--
2.39.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 6/9] media: i2c: ov2685: convert to i2c's .probe_new()
2023-02-24 12:05 ` [PATCH 6/9] media: i2c: ov2685: " Uwe Kleine-König
@ 2023-02-24 12:41 ` Hans Verkuil
0 siblings, 0 replies; 17+ messages in thread
From: Hans Verkuil @ 2023-02-24 12:41 UTC (permalink / raw)
To: Uwe Kleine-König, Wolfram Sang
Cc: kernel, Shunqian Zheng, Mauro Carvalho Chehab, linux-media,
linux-kernel, Kieran Bingham
On 24/02/2023 13:05, Uwe Kleine-König wrote:
> The probe function doesn't make use of the i2c_device_id * parameter so
> it can be trivially converted.
>
> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Link: https://lore.kernel.org/lkml/20221121102838.16448-1-u.kleine-koenig@pengutronix.de
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/media/i2c/ov2685.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/i2c/ov2685.c b/drivers/media/i2c/ov2685.c
> index a3b524f15d89..1c80b121e7d6 100644
> --- a/drivers/media/i2c/ov2685.c
> +++ b/drivers/media/i2c/ov2685.c
> @@ -707,8 +707,7 @@ static int ov2685_configure_regulators(struct ov2685 *ov2685)
> ov2685->supplies);
> }
>
> -static int ov2685_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +static int ov2685_probe(struct i2c_client *client)
> {
> struct device *dev = &client->dev;
> struct ov2685 *ov2685;
> @@ -830,7 +829,7 @@ static struct i2c_driver ov2685_i2c_driver = {
> .pm = &ov2685_pm_ops,
> .of_match_table = of_match_ptr(ov2685_of_match),
> },
> - .probe = &ov2685_probe,
> + .probe_new = &ov2685_probe,
> .remove = &ov2685_remove,
> };
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 7/9] i2c: Switch .probe() to not take an id parameter
2023-02-24 12:05 [PATCH 0/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
` (5 preceding siblings ...)
2023-02-24 12:05 ` [PATCH 6/9] media: i2c: ov2685: " Uwe Kleine-König
@ 2023-02-24 12:05 ` Uwe Kleine-König
2023-02-24 16:02 ` Luca Ceresoli
2023-02-24 12:05 ` [PATCH 8/9] i2c: mux: Convert all drivers to new .probe() callback Uwe Kleine-König
2023-02-24 12:06 ` [PATCH 9/9] i2c: Convert " Uwe Kleine-König
8 siblings, 1 reply; 17+ messages in thread
From: Uwe Kleine-König @ 2023-02-24 12:05 UTC (permalink / raw)
To: Wolfram Sang; +Cc: kernel, linux-i2c, linux-kernel, Lee Jones
Commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back
type") introduced a new probe callback to convert i2c init routines to
not take an i2c_device_id parameter. Now that all in-tree drivers are
converted to the temporary .probe_new() callback, .probe() can be
modified to match the desired prototype.
Now that .probe() and .probe_new() have the same semantic, they can be
defined as members of an anonymous union to save some memory and
simplify the core code a bit.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/i2c/i2c-core-base.c | 11 ++---------
include/linux/i2c.h | 14 +++++++++-----
2 files changed, 11 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..c3e022d53182 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -272,14 +272,18 @@ 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);
+ /*
+ * Legacy callback that was part of a conversion of .probe().
+ * Today it has the same semantic as .probe(). Don't use for new
+ * code.
+ */
+ 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.39.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 7/9] i2c: Switch .probe() to not take an id parameter
2023-02-24 12:05 ` [PATCH 7/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
@ 2023-02-24 16:02 ` Luca Ceresoli
2023-02-24 18:03 ` Uwe Kleine-König
0 siblings, 1 reply; 17+ messages in thread
From: Luca Ceresoli @ 2023-02-24 16:02 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Wolfram Sang, kernel, linux-i2c, linux-kernel, Lee Jones
Hi Uwe,
On Fri, 24 Feb 2023 13:05:58 +0100
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> Commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back
> type") introduced a new probe callback to convert i2c init routines to
> not take an i2c_device_id parameter. Now that all in-tree drivers are
> converted to the temporary .probe_new() callback, .probe() can be
> modified to match the desired prototype.
>
> Now that .probe() and .probe_new() have the same semantic, they can be
> defined as members of an anonymous union to save some memory and
> simplify the core code a bit.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thank you, I love this cleanup!
> ---
> drivers/i2c/i2c-core-base.c | 11 ++---------
> include/linux/i2c.h | 14 +++++++++-----
> 2 files changed, 11 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..c3e022d53182 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -272,14 +272,18 @@ 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);
> + /*
> + * Legacy callback that was part of a conversion of .probe().
> + * Today it has the same semantic as .probe(). Don't use for new
> + * code.
> + */
> + 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);
The kerneldoc for this struct should also be updated:
- * @probe: Callback for device binding - soon to be deprecated
- * @probe_new: New callback for device binding
+ * @probe: Callback for device binding
+ * @probe_new: Transitional callback for device binding - do not use
Otherwise LGTM.
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH 7/9] i2c: Switch .probe() to not take an id parameter
2023-02-24 16:02 ` Luca Ceresoli
@ 2023-02-24 18:03 ` Uwe Kleine-König
0 siblings, 0 replies; 17+ messages in thread
From: Uwe Kleine-König @ 2023-02-24 18:03 UTC (permalink / raw)
To: Luca Ceresoli; +Cc: Wolfram Sang, Lee Jones, linux-i2c, kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1776 bytes --]
Hello Luca,
On Fri, Feb 24, 2023 at 05:02:18PM +0100, Luca Ceresoli wrote:
> On Fri, 24 Feb 2023 13:05:58 +0100
> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> > [...]
> > diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> > index d84e0e99f084..c3e022d53182 100644
> > --- a/include/linux/i2c.h
> > +++ b/include/linux/i2c.h
> > @@ -272,14 +272,18 @@ 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);
> > + /*
> > + * Legacy callback that was part of a conversion of .probe().
> > + * Today it has the same semantic as .probe(). Don't use for new
> > + * code.
> > + */
> > + 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);
>
> The kerneldoc for this struct should also be updated:
>
> - * @probe: Callback for device binding - soon to be deprecated
> - * @probe_new: New callback for device binding
> + * @probe: Callback for device binding
> + * @probe_new: Transitional callback for device binding - do not use
Indeed. I will send an updated patch series near the end of the merge
window, with your suggested change squashed in.
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 8/9] i2c: mux: Convert all drivers to new .probe() callback
2023-02-24 12:05 [PATCH 0/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
` (6 preceding siblings ...)
2023-02-24 12:05 ` [PATCH 7/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
@ 2023-02-24 12:05 ` Uwe Kleine-König
2023-02-24 15:23 ` Guenter Roeck
2023-02-24 15:51 ` Peter Rosin
2023-02-24 12:06 ` [PATCH 9/9] i2c: Convert " Uwe Kleine-König
8 siblings, 2 replies; 17+ messages in thread
From: Uwe Kleine-König @ 2023-02-24 12:05 UTC (permalink / raw)
To: Wolfram Sang
Cc: kernel, Michael Hennerich, Peter Rosin, Guenter Roeck, linux-i2c,
linux-kernel
Now that .probe() was changed not to get the id parameter, drivers can
be converted back to that with the eventual goal to drop .probe_new().
Implement that for the i2c mux drivers.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/i2c/muxes/i2c-mux-ltc4306.c | 2 +-
drivers/i2c/muxes/i2c-mux-pca9541.c | 2 +-
drivers/i2c/muxes/i2c-mux-pca954x.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/muxes/i2c-mux-ltc4306.c b/drivers/i2c/muxes/i2c-mux-ltc4306.c
index 70835825083f..5a03031519be 100644
--- a/drivers/i2c/muxes/i2c-mux-ltc4306.c
+++ b/drivers/i2c/muxes/i2c-mux-ltc4306.c
@@ -306,7 +306,7 @@ static struct i2c_driver ltc4306_driver = {
.name = "ltc4306",
.of_match_table = of_match_ptr(ltc4306_of_match),
},
- .probe_new = ltc4306_probe,
+ .probe = ltc4306_probe,
.remove = ltc4306_remove,
.id_table = ltc4306_id,
};
diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
index 09d1d9e67e31..ce0fb69249a8 100644
--- a/drivers/i2c/muxes/i2c-mux-pca9541.c
+++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
@@ -336,7 +336,7 @@ static struct i2c_driver pca9541_driver = {
.name = "pca9541",
.of_match_table = of_match_ptr(pca9541_of_match),
},
- .probe_new = pca9541_probe,
+ .probe = pca9541_probe,
.remove = pca9541_remove,
.id_table = pca9541_id,
};
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 3639e6d7304c..0ccee2ae5720 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -554,7 +554,7 @@ static struct i2c_driver pca954x_driver = {
.pm = &pca954x_pm,
.of_match_table = pca954x_of_match,
},
- .probe_new = pca954x_probe,
+ .probe = pca954x_probe,
.remove = pca954x_remove,
.id_table = pca954x_id,
};
--
2.39.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 8/9] i2c: mux: Convert all drivers to new .probe() callback
2023-02-24 12:05 ` [PATCH 8/9] i2c: mux: Convert all drivers to new .probe() callback Uwe Kleine-König
@ 2023-02-24 15:23 ` Guenter Roeck
2023-02-24 15:51 ` Peter Rosin
1 sibling, 0 replies; 17+ messages in thread
From: Guenter Roeck @ 2023-02-24 15:23 UTC (permalink / raw)
To: Uwe Kleine-König, Wolfram Sang
Cc: kernel, Michael Hennerich, Peter Rosin, linux-i2c, linux-kernel
On 2/24/23 04:05, Uwe Kleine-König wrote:
> Now that .probe() was changed not to get the id parameter, drivers can
> be converted back to that with the eventual goal to drop .probe_new().
>
> Implement that for the i2c mux drivers.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/i2c/muxes/i2c-mux-ltc4306.c | 2 +-
> drivers/i2c/muxes/i2c-mux-pca9541.c | 2 +-
> drivers/i2c/muxes/i2c-mux-pca954x.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/muxes/i2c-mux-ltc4306.c b/drivers/i2c/muxes/i2c-mux-ltc4306.c
> index 70835825083f..5a03031519be 100644
> --- a/drivers/i2c/muxes/i2c-mux-ltc4306.c
> +++ b/drivers/i2c/muxes/i2c-mux-ltc4306.c
> @@ -306,7 +306,7 @@ static struct i2c_driver ltc4306_driver = {
> .name = "ltc4306",
> .of_match_table = of_match_ptr(ltc4306_of_match),
> },
> - .probe_new = ltc4306_probe,
> + .probe = ltc4306_probe,
> .remove = ltc4306_remove,
> .id_table = ltc4306_id,
> };
> diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
> index 09d1d9e67e31..ce0fb69249a8 100644
> --- a/drivers/i2c/muxes/i2c-mux-pca9541.c
> +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
> @@ -336,7 +336,7 @@ static struct i2c_driver pca9541_driver = {
> .name = "pca9541",
> .of_match_table = of_match_ptr(pca9541_of_match),
> },
> - .probe_new = pca9541_probe,
> + .probe = pca9541_probe,
> .remove = pca9541_remove,
> .id_table = pca9541_id,
> };
> diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
> index 3639e6d7304c..0ccee2ae5720 100644
> --- a/drivers/i2c/muxes/i2c-mux-pca954x.c
> +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
> @@ -554,7 +554,7 @@ static struct i2c_driver pca954x_driver = {
> .pm = &pca954x_pm,
> .of_match_table = pca954x_of_match,
> },
> - .probe_new = pca954x_probe,
> + .probe = pca954x_probe,
> .remove = pca954x_remove,
> .id_table = pca954x_id,
> };
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH 8/9] i2c: mux: Convert all drivers to new .probe() callback
2023-02-24 12:05 ` [PATCH 8/9] i2c: mux: Convert all drivers to new .probe() callback Uwe Kleine-König
2023-02-24 15:23 ` Guenter Roeck
@ 2023-02-24 15:51 ` Peter Rosin
1 sibling, 0 replies; 17+ messages in thread
From: Peter Rosin @ 2023-02-24 15:51 UTC (permalink / raw)
To: Uwe Kleine-König, Wolfram Sang
Cc: kernel, Michael Hennerich, Guenter Roeck, linux-i2c, linux-kernel
Hi!
2023-02-24 at 13:05, Uwe Kleine-König wrote:
> Now that .probe() was changed not to get the id parameter, drivers can
> be converted back to that with the eventual goal to drop .probe_new().
>
> Implement that for the i2c mux drivers.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
*snip*
Acked-by: Peter Rosin <peda@axentia.se>
Cheers,
Peter
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 9/9] i2c: Convert drivers to new .probe() callback
2023-02-24 12:05 [PATCH 0/9] i2c: Switch .probe() to not take an id parameter Uwe Kleine-König
` (7 preceding siblings ...)
2023-02-24 12:05 ` [PATCH 8/9] i2c: mux: Convert all drivers to new .probe() callback Uwe Kleine-König
@ 2023-02-24 12:06 ` Uwe Kleine-König
8 siblings, 0 replies; 17+ messages in thread
From: Uwe Kleine-König @ 2023-02-24 12:06 UTC (permalink / raw)
To: Wolfram Sang; +Cc: kernel, linux-i2c, linux-kernel
Now that .probe() was changed not to get the id parameter, drivers can
be converted back to that with the eventual goal to drop .probe_new().
Implement that for the i2c drivers that are part of the i2c core.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/i2c/i2c-core-base.c | 2 +-
drivers/i2c/i2c-slave-eeprom.c | 2 +-
drivers/i2c/i2c-slave-testunit.c | 2 +-
drivers/i2c/i2c-smbus.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 1fbe16221085..1e38bdaf6ec1 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1018,7 +1018,7 @@ static int dummy_probe(struct i2c_client *client)
static struct i2c_driver dummy_driver = {
.driver.name = "dummy",
- .probe_new = dummy_probe,
+ .probe = dummy_probe,
.id_table = dummy_id,
};
diff --git a/drivers/i2c/i2c-slave-eeprom.c b/drivers/i2c/i2c-slave-eeprom.c
index 5f25f23c4ff8..5946c0d0aef9 100644
--- a/drivers/i2c/i2c-slave-eeprom.c
+++ b/drivers/i2c/i2c-slave-eeprom.c
@@ -207,7 +207,7 @@ static struct i2c_driver i2c_slave_eeprom_driver = {
.driver = {
.name = "i2c-slave-eeprom",
},
- .probe_new = i2c_slave_eeprom_probe,
+ .probe = i2c_slave_eeprom_probe,
.remove = i2c_slave_eeprom_remove,
.id_table = i2c_slave_eeprom_id,
};
diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c
index 75ee7ebdb614..a49642bbae4b 100644
--- a/drivers/i2c/i2c-slave-testunit.c
+++ b/drivers/i2c/i2c-slave-testunit.c
@@ -171,7 +171,7 @@ static struct i2c_driver i2c_slave_testunit_driver = {
.driver = {
.name = "i2c-slave-testunit",
},
- .probe_new = i2c_slave_testunit_probe,
+ .probe = i2c_slave_testunit_probe,
.remove = i2c_slave_testunit_remove,
.id_table = i2c_slave_testunit_id,
};
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index cd19546d31fc..138c3f5e0093 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -169,7 +169,7 @@ static struct i2c_driver smbalert_driver = {
.driver = {
.name = "smbus_alert",
},
- .probe_new = smbalert_probe,
+ .probe = smbalert_probe,
.remove = smbalert_remove,
.id_table = smbalert_ids,
};
--
2.39.1
^ permalink raw reply related [flat|nested] 17+ messages in thread