* [PATCH v1 0/5] i2c: Convert drivers below drivers/i2c to .probe_new()
@ 2022-10-21 7:39 Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 1/5] i2c: Convert the dummy_driver " Uwe Kleine-König
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 7:39 UTC (permalink / raw)
To: Wolfram Sang, Guenter Roeck, Peter Rosin; +Cc: linux-i2c, kernel
Hello,
A set of 5 simple patches to get a bit forward in conversion to .probe_new().
Best regards
Uwe
Uwe Kleine-König (5):
i2c: Convert the dummy_driver to .probe_new()
i2c: slave eeprom: Convert to .probe_new()
i2c: smbus: Convert to .probe_new()
i2c: mux: pca9541: Convert to .probe_new()
i2c: mux: pca954x: Convert to .probe_new()
drivers/i2c/i2c-core-base.c | 5 ++---
drivers/i2c/i2c-slave-eeprom.c | 31 +++++++++++++++--------------
drivers/i2c/i2c-smbus.c | 5 ++---
drivers/i2c/muxes/i2c-mux-pca9541.c | 5 ++---
drivers/i2c/muxes/i2c-mux-pca954x.c | 6 +++---
5 files changed, 25 insertions(+), 27 deletions(-)
base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
--
2.37.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 1/5] i2c: Convert the dummy_driver to .probe_new()
2022-10-21 7:39 [PATCH v1 0/5] i2c: Convert drivers below drivers/i2c to .probe_new() Uwe Kleine-König
@ 2022-10-21 7:39 ` Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 2/5] i2c: slave eeprom: Convert " Uwe Kleine-König
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 7:39 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c, kernel
The probe function doesn't make use of the id parameter, so the driver
can be converted trivially to .probe_new().
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/i2c/i2c-core-base.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index b4edf10e8fd0..f786917a7f44 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1017,15 +1017,14 @@ static const struct i2c_device_id dummy_id[] = {
{ },
};
-static int dummy_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static int dummy_probe(struct i2c_client *client)
{
return 0;
}
static struct i2c_driver dummy_driver = {
.driver.name = "dummy",
- .probe = dummy_probe,
+ .probe_new = dummy_probe,
.id_table = dummy_id,
};
--
2.37.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 2/5] i2c: slave eeprom: Convert to .probe_new()
2022-10-21 7:39 [PATCH v1 0/5] i2c: Convert drivers below drivers/i2c to .probe_new() Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 1/5] i2c: Convert the dummy_driver " Uwe Kleine-König
@ 2022-10-21 7:39 ` Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 3/5] i2c: smbus: " Uwe Kleine-König
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 7:39 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c, kernel
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in .probe(). The device_id array has to move up for that
to work.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/i2c/i2c-slave-eeprom.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/i2c/i2c-slave-eeprom.c b/drivers/i2c/i2c-slave-eeprom.c
index 4abc2d919881..44c14bfd1fda 100644
--- a/drivers/i2c/i2c-slave-eeprom.c
+++ b/drivers/i2c/i2c-slave-eeprom.c
@@ -140,10 +140,24 @@ static int i2c_slave_init_eeprom_data(struct eeprom_data *eeprom, struct i2c_cli
return 0;
}
-static int i2c_slave_eeprom_probe(struct i2c_client *client, const struct i2c_device_id *id)
+static const struct i2c_device_id i2c_slave_eeprom_id[] = {
+ { "slave-24c02", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, 0) },
+ { "slave-24c02ro", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, I2C_SLAVE_FLAG_RO) },
+ { "slave-24c32", I2C_SLAVE_DEVICE_MAGIC(32768 / 8, I2C_SLAVE_FLAG_ADDR16) },
+ { "slave-24c32ro", I2C_SLAVE_DEVICE_MAGIC(32768 / 8, I2C_SLAVE_FLAG_ADDR16 | I2C_SLAVE_FLAG_RO) },
+ { "slave-24c64", I2C_SLAVE_DEVICE_MAGIC(65536 / 8, I2C_SLAVE_FLAG_ADDR16) },
+ { "slave-24c64ro", I2C_SLAVE_DEVICE_MAGIC(65536 / 8, I2C_SLAVE_FLAG_ADDR16 | I2C_SLAVE_FLAG_RO) },
+ { "slave-24c512", I2C_SLAVE_DEVICE_MAGIC(524288 / 8, I2C_SLAVE_FLAG_ADDR16) },
+ { "slave-24c512ro", I2C_SLAVE_DEVICE_MAGIC(524288 / 8, I2C_SLAVE_FLAG_ADDR16 | I2C_SLAVE_FLAG_RO) },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, i2c_slave_eeprom_id);
+
+static int i2c_slave_eeprom_probe(struct i2c_client *client)
{
struct eeprom_data *eeprom;
int ret;
+ const struct i2c_device_id *id = i2c_match_id(i2c_slave_eeprom_id, client);
unsigned int size = FIELD_GET(I2C_SLAVE_BYTELEN, id->driver_data) + 1;
unsigned int flag_addr16 = FIELD_GET(I2C_SLAVE_FLAG_ADDR16, id->driver_data);
@@ -189,24 +203,11 @@ static void i2c_slave_eeprom_remove(struct i2c_client *client)
sysfs_remove_bin_file(&client->dev.kobj, &eeprom->bin);
}
-static const struct i2c_device_id i2c_slave_eeprom_id[] = {
- { "slave-24c02", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, 0) },
- { "slave-24c02ro", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, I2C_SLAVE_FLAG_RO) },
- { "slave-24c32", I2C_SLAVE_DEVICE_MAGIC(32768 / 8, I2C_SLAVE_FLAG_ADDR16) },
- { "slave-24c32ro", I2C_SLAVE_DEVICE_MAGIC(32768 / 8, I2C_SLAVE_FLAG_ADDR16 | I2C_SLAVE_FLAG_RO) },
- { "slave-24c64", I2C_SLAVE_DEVICE_MAGIC(65536 / 8, I2C_SLAVE_FLAG_ADDR16) },
- { "slave-24c64ro", I2C_SLAVE_DEVICE_MAGIC(65536 / 8, I2C_SLAVE_FLAG_ADDR16 | I2C_SLAVE_FLAG_RO) },
- { "slave-24c512", I2C_SLAVE_DEVICE_MAGIC(524288 / 8, I2C_SLAVE_FLAG_ADDR16) },
- { "slave-24c512ro", I2C_SLAVE_DEVICE_MAGIC(524288 / 8, I2C_SLAVE_FLAG_ADDR16 | I2C_SLAVE_FLAG_RO) },
- { }
-};
-MODULE_DEVICE_TABLE(i2c, i2c_slave_eeprom_id);
-
static struct i2c_driver i2c_slave_eeprom_driver = {
.driver = {
.name = "i2c-slave-eeprom",
},
- .probe = i2c_slave_eeprom_probe,
+ .probe_new = i2c_slave_eeprom_probe,
.remove = i2c_slave_eeprom_remove,
.id_table = i2c_slave_eeprom_id,
};
--
2.37.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 3/5] i2c: smbus: Convert to .probe_new()
2022-10-21 7:39 [PATCH v1 0/5] i2c: Convert drivers below drivers/i2c to .probe_new() Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 1/5] i2c: Convert the dummy_driver " Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 2/5] i2c: slave eeprom: Convert " Uwe Kleine-König
@ 2022-10-21 7:39 ` Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 4/5] i2c: mux: pca9541: " Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 5/5] i2c: mux: pca954x: " Uwe Kleine-König
4 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 7:39 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c, kernel
The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/i2c/i2c-smbus.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index 07c92c8495a3..f4c74b9135b3 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -112,8 +112,7 @@ static void smbalert_work(struct work_struct *work)
}
/* Setup SMBALERT# infrastructure */
-static int smbalert_probe(struct i2c_client *ara,
- const struct i2c_device_id *id)
+static int smbalert_probe(struct i2c_client *ara)
{
struct i2c_smbus_alert_setup *setup = dev_get_platdata(&ara->dev);
struct i2c_smbus_alert *alert;
@@ -170,7 +169,7 @@ static struct i2c_driver smbalert_driver = {
.driver = {
.name = "smbus_alert",
},
- .probe = smbalert_probe,
+ .probe_new = smbalert_probe,
.remove = smbalert_remove,
.id_table = smbalert_ids,
};
--
2.37.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 4/5] i2c: mux: pca9541: Convert to .probe_new()
2022-10-21 7:39 [PATCH v1 0/5] i2c: Convert drivers below drivers/i2c to .probe_new() Uwe Kleine-König
` (2 preceding siblings ...)
2022-10-21 7:39 ` [PATCH v1 3/5] i2c: smbus: " Uwe Kleine-König
@ 2022-10-21 7:39 ` Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 5/5] i2c: mux: pca954x: " Uwe Kleine-König
4 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 7:39 UTC (permalink / raw)
To: Guenter Roeck, Peter Rosin; +Cc: linux-i2c, kernel
The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/i2c/muxes/i2c-mux-pca9541.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
index ea83de78f52d..09d1d9e67e31 100644
--- a/drivers/i2c/muxes/i2c-mux-pca9541.c
+++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
@@ -283,8 +283,7 @@ static int pca9541_release_chan(struct i2c_mux_core *muxc, u32 chan)
/*
* I2C init/probing/exit functions
*/
-static int pca9541_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static int pca9541_probe(struct i2c_client *client)
{
struct i2c_adapter *adap = client->adapter;
struct i2c_mux_core *muxc;
@@ -337,7 +336,7 @@ static struct i2c_driver pca9541_driver = {
.name = "pca9541",
.of_match_table = of_match_ptr(pca9541_of_match),
},
- .probe = pca9541_probe,
+ .probe_new = pca9541_probe,
.remove = pca9541_remove,
.id_table = pca9541_id,
};
--
2.37.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 5/5] i2c: mux: pca954x: Convert to .probe_new()
2022-10-21 7:39 [PATCH v1 0/5] i2c: Convert drivers below drivers/i2c to .probe_new() Uwe Kleine-König
` (3 preceding siblings ...)
2022-10-21 7:39 ` [PATCH v1 4/5] i2c: mux: pca9541: " Uwe Kleine-König
@ 2022-10-21 7:39 ` Uwe Kleine-König
4 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 7:39 UTC (permalink / raw)
To: Peter Rosin; +Cc: linux-i2c, kernel
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in .probe().
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/i2c/muxes/i2c-mux-pca954x.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index a5f458b635df..7345032633ee 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -411,9 +411,9 @@ static int pca954x_init(struct i2c_client *client, struct pca954x *data)
/*
* I2C init/probing/exit functions
*/
-static int pca954x_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static int pca954x_probe(struct i2c_client *client)
{
+ const struct i2c_device_id *id = i2c_match_id(pca954x_id, client);
struct i2c_adapter *adap = client->adapter;
struct device *dev = &client->dev;
struct gpio_desc *gpio;
@@ -554,7 +554,7 @@ static struct i2c_driver pca954x_driver = {
.pm = &pca954x_pm,
.of_match_table = pca954x_of_match,
},
- .probe = pca954x_probe,
+ .probe_new = pca954x_probe,
.remove = pca954x_remove,
.id_table = pca954x_id,
};
--
2.37.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-21 7:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 7:39 [PATCH v1 0/5] i2c: Convert drivers below drivers/i2c to .probe_new() Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 1/5] i2c: Convert the dummy_driver " Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 2/5] i2c: slave eeprom: Convert " Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 3/5] i2c: smbus: " Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 4/5] i2c: mux: pca9541: " Uwe Kleine-König
2022-10-21 7:39 ` [PATCH v1 5/5] i2c: mux: pca954x: " Uwe Kleine-König
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.