* [PATCH 0/9] i2c: Switch .probe() to not take an id parameter
@ 2023-02-24 12:05 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
` (8 more replies)
0 siblings, 9 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,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Ajay Gupta, Peter Senna Tschudin, Vladimir Oltean, Luca Ceresoli,
linux-mtd, Jiri Slaby, linux-serial, Evgeniy Polyakov, Crt Mori,
Jonathan Cameron, Jean Delvare, Javier Martinez Canillas,
Shunqian Zheng, Mauro Carvalho Chehab, linux-media, linux-i2c,
Michael Hennerich, Peter Rosin, Guenter Roeck, Lee Jones
Hello,
back in 2016 a conversion was started to drop the id parameter from the
.probe() callback of i2c drivers. This series (somewhat) completes this
quest: As of next-20230224 all but very few drivers are converted to the
temporary .probe_new() callback such that .probe() can be changed
accordingly. There are currently no new drivers in next making use of
the old .probe() callback.
The first 6 patches convert the remaining drivers. Three of them have
their maintainer's ack, I didn't get feedback for the other three.
The Link footer in these patches document the earlier submissions.
The 7th patch changes .probe() to the prototype without the id
parameter. The remaining two patches convert the drivers contained in
the i2c subsystem to the new .probe().
I chose v6.2 as a base for this series but note that there a few more
drivers in there that are still unconverted. Linus Torvalds's tree (as
of d2980d8d826554fa6981d621e569a453787472f8) contains 60 more
conversions after v6.2. In next there is another set of 22 conversions
that are required before this series can go in. My expectation is that
these 82 change sets will be all contained in 6.3-rc1 such that this
series can be applied on top of that tag.
For reference the complete set of patches is available at
https://git.pengutronix.de/git/ukl/linux i2c-probe-new
I'll rebase that from time to time such that the set of remaining
patches can be checked there.
@Wolfram: It would be great to get this series into next soon after
v6.3-rc1 is published, maybe with a tag for other subsystems to pull.
(This would be required if new drivers want to make use of the new
.probe() callback only.)
I intend to convert all drivers to the new .probe() callback after this
series landed and then eventually drop .probe_new() to complete the
effort.
Best regards
Uwe
Uwe Kleine-König (9):
misc: ad525x_dpot-i2c: Convert to i2c's .probe_new()
mtd: maps: pismo: Convert to i2c's .probe_new()
serial: sc16is7xx: Convert to i2c's .probe_new()
w1: ds2482: Convert to i2c's .probe_new()
media: i2c: ov5695: convert to i2c's .probe_new()
media: i2c: ov2685: convert to i2c's .probe_new()
i2c: Switch .probe() to not take an id parameter
i2c: mux: Convert all drivers to new .probe() callback
i2c: Convert drivers to new .probe() callback
drivers/i2c/i2c-core-base.c | 13 +++----------
drivers/i2c/i2c-slave-eeprom.c | 2 +-
drivers/i2c/i2c-slave-testunit.c | 2 +-
drivers/i2c/i2c-smbus.c | 2 +-
drivers/i2c/muxes/i2c-mux-ltc4306.c | 2 +-
drivers/i2c/muxes/i2c-mux-pca9541.c | 2 +-
drivers/i2c/muxes/i2c-mux-pca954x.c | 2 +-
drivers/media/i2c/ov2685.c | 5 ++---
drivers/media/i2c/ov5695.c | 5 ++---
drivers/misc/ad525x_dpot-i2c.c | 6 +++---
drivers/mtd/maps/pismo.c | 5 ++---
drivers/tty/serial/sc16is7xx.c | 6 +++---
drivers/w1/masters/ds2482.c | 5 ++---
include/linux/i2c.h | 14 +++++++++-----
14 files changed, 32 insertions(+), 39 deletions(-)
base-commit: c9c3395d5e3dcc6daee66c6908354d47bf98cb0c
prerequisite-patch-id: 2e7d7db8c0a90b8cd1deb6bbc51ead4c89c89b62
prerequisite-patch-id: 68960e1b9d6064d3a1b5e65699830129e8246a4d
prerequisite-patch-id: 3f2fbc0129a6390cba155106044ea8ef74c17547
prerequisite-patch-id: ad1ad4e8d7be0c055e6258cdb7ff6c6921daebb2
prerequisite-patch-id: 2a5cb71deca2e3980dc30f76defea32d0640c1cc
prerequisite-patch-id: 1acdc555ce5259b31b51b345e9fa28f15cdebd9b
prerequisite-patch-id: 64eff2614a7f3dab745282a1852fee41837c0c59
prerequisite-patch-id: da2168484e5e34e2b9f788f20b7fe9c4c6f24b24
prerequisite-patch-id: 6228c4eccc6e84f3b4fba822f3bddbfd86f5b97b
prerequisite-patch-id: 398c68a80a9647aeea73cdd7852290e1abe4623d
prerequisite-patch-id: e7f7330b18d5ad5b0cc25329325bb24ef7023cec
prerequisite-patch-id: 5a8d299e8285d1725a0b088de6bcf72e972b399c
prerequisite-patch-id: 10d9ee70ff66026de20fc103dd98fe1df36b6d73
prerequisite-patch-id: d91adb87d04d1760d6e79568fcfc2605c623e3cd
prerequisite-patch-id: 5e47e64999246ca2a52dab36754c5c35945bdf90
prerequisite-patch-id: 63c39943b3d6f2e7435f9864b56e7e7a379f0b8d
prerequisite-patch-id: 06376bfa1ea41691206da7f0607d748fabd74f23
prerequisite-patch-id: e984c0d0f267ce186895cdc4f464da3704f2efa9
prerequisite-patch-id: 6d4a24d2821eb225e86024c21b366cb7c2bb7c87
prerequisite-patch-id: 95c7334d368f3a64ab6c7d41440ac4221c316356
prerequisite-patch-id: 83716102d794ceeccad68a8c95dba15ebc97d450
prerequisite-patch-id: 5242684cb9ff2653913164df8e29e7e1c35be1a7
prerequisite-patch-id: 5f4de5c1ab515144141120633810e25d383608fc
prerequisite-patch-id: 396edcd3230e3d18737fa55f71533b4265ba7e5e
prerequisite-patch-id: 2ea5771265eda86b2329d4e9f2c264031254ec2f
prerequisite-patch-id: 660164e81672844768a6caf08450d160b494c0b1
prerequisite-patch-id: 750a5ff9cf0f8ad9bd4dddea74b939e01041de5d
prerequisite-patch-id: d2baa534b684e51e1be3e2d63ee696d87a0be623
prerequisite-patch-id: bc3d769755acfd9d36c1f449428b9c54b35812fb
prerequisite-patch-id: c149de6358e345076ebc240da493f1bf1a508dab
prerequisite-patch-id: 591c093efa389918b5f0adb621e1f4bd6e1adc0e
prerequisite-patch-id: cd7f318600560528aec460e55a452ea0b90ec898
prerequisite-patch-id: 295fa29af26c81c64e7fa6b9244504daa308ee6d
prerequisite-patch-id: f184632401a63479cc8a77b6e9958a279fafa06d
prerequisite-patch-id: 1d01b258df0777934668f5710960c5a2a0f8f3a4
prerequisite-patch-id: a9eafb96ebadff82eafce9843555357a2688c8c9
prerequisite-patch-id: 2ed279b79658d65a13441e2342deb931d5f5b669
prerequisite-patch-id: 3876f1605311328bad00df764927a4164236125a
prerequisite-patch-id: e1522742d247f98b321af3104074c3f82cf67955
prerequisite-patch-id: b268913eee204fae2a3e7779c08df83ce21a6515
prerequisite-patch-id: a4613e66e4de89a87635534e9210d6d1edeb5f7e
prerequisite-patch-id: 824fb91ee278337951fdedaac99432bc753699fe
prerequisite-patch-id: ec4f9a919e45a99b83d52fd9d4fcf42a1f12ef26
prerequisite-patch-id: a95e27ba44f4fc4239d1a62fbe9ff7689d685ff5
prerequisite-patch-id: dba3fc00f472523fab383d79a56c072381ddfe9d
prerequisite-patch-id: f76bf70c077b629b86a65898875e7b552f4db2a4
prerequisite-patch-id: 12a1f88b386c0c05f7a5569637d4c2b798bb8260
prerequisite-patch-id: 4aa1838b3fd22132cca0e6810cf9b33cbe55318b
prerequisite-patch-id: 8dc9c99781af9f341cf2f7872b6cddb70070949c
prerequisite-patch-id: ef47ccfde62411344af4703dcc24959611b85301
prerequisite-patch-id: c7548e392a2e2722140ccab8c6e47fe2c327770f
prerequisite-patch-id: 4f2ccb6f991418021139e11b8c73b901169798f5
prerequisite-patch-id: 88cb2d6e777f60fa6075c4f0f91b46585714dc26
prerequisite-patch-id: 8dbd8552ee97170d1d7c8c655aa1ebde53b97829
prerequisite-patch-id: 1945f551009d075a28ce6da39759c11a4d80d37b
prerequisite-patch-id: 7c7c4bf854e352e316689a6cb3f9e9c04eab7c7e
prerequisite-patch-id: 60f0ae1aa26bbbc699c60b06d97a614432f2e935
prerequisite-patch-id: 5680b5b69bc3feba0e6b4d6baed5fb9d4b1af97e
prerequisite-patch-id: c5644c69ebd0504d0f84d8d671f7157a54da5760
prerequisite-patch-id: 688c306ec00774f734fc675e33606062a19dd50b
prerequisite-patch-id: 77432aab9af85fc9a215443b11f32e10fb504d10
prerequisite-patch-id: ac64c2fdbdc0c483158c157f13d62a98585d02d7
prerequisite-patch-id: 1df528279cfe26308765d0419f98d3c09728715a
prerequisite-patch-id: 80925ce59afc49cd265f3d9b9aa242659514c133
prerequisite-patch-id: 04a21499016b21f8c3ac308dfdc20a49b1d5a741
prerequisite-patch-id: d2e996c3e4b5e7c544e38efe6f6dab43ad0ffb0e
prerequisite-patch-id: 6713e608f82498ec5d174935c2f6c232c2f5e5ff
prerequisite-patch-id: 68d04beedcad14c650a78c8132fb6b9b45205b38
prerequisite-patch-id: 6344e213dec976a90dc275c8a9a166c351d6fe9a
prerequisite-patch-id: 7c01e136bb6e601a80a428037877576f1b342084
prerequisite-patch-id: 9b6b4307c7f53fba00c37971ddbb517cafa22531
prerequisite-patch-id: 09806da1cff3a4924d1ff5045dc17b6b14641d63
prerequisite-patch-id: f143469cfe4d1f94257bbaf5e283daf0ab054f43
prerequisite-patch-id: 021c087e20eb1fbf2cb9b9b99a2c53c892769ba8
prerequisite-patch-id: 4252b2e4fe47331f5bde1f18b44a6ba6c2eb51de
prerequisite-patch-id: 7e5c6557466d39fef01e794ffbec2a3609938573
prerequisite-patch-id: 621dcc5855c64e5402bbe94b2f365f91454618a6
prerequisite-patch-id: 41b9a4aee51447cff810c9e7694b2ccfb74c1ac6
prerequisite-patch-id: eb3c550ee6712b0ff289083dba417804e7f3ce98
prerequisite-patch-id: 6fe10bbbc1913738f093e7deb01bf2f75b64bcec
prerequisite-patch-id: 256857b4eee79540b271b8d4899b9ba0aa3c4c27
prerequisite-patch-id: bb49c9c71311ac1f1056c562f20f26aa356c95a6
--
2.39.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [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
* [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
* [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
* [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
* [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
* [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
* 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
* 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
* 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
* 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
* 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
end of thread, other threads:[~2023-02-27 12:36 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/9] serial: sc16is7xx: " Uwe Kleine-König
2023-02-24 12:05 ` [PATCH 4/9] w1: ds2482: " 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
2023-02-24 12:41 ` Hans Verkuil
2023-02-24 12:05 ` [PATCH 6/9] media: i2c: ov2685: " 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
2023-02-24 16:02 ` Luca Ceresoli
2023-02-24 18:03 ` Uwe Kleine-König
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
2023-02-24 12:06 ` [PATCH 9/9] i2c: Convert " Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox