linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] rtc: Convert i2c drivers to .probe_new()
@ 2022-10-21 13:06 Uwe Kleine-König
  2022-10-21 13:06 ` [PATCH 1/9] rtc: abx80x: Convert " Uwe Kleine-König
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 13:06 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Avi Fishman, Tomer Maimon,
	Tali Perry, Patrick Venture, Nancy Yuen
  Cc: Wolfram Sang, linux-rtc, kernel, Benjamin Fair, openbmc

Hello,

See commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back
type") for the rationale.

Best regards
Uwe

Uwe Kleine-König (9):
  rtc: abx80x: Convert to .probe_new()
  rtc: ds1307: Convert to .probe_new()
  rtc: isl1208: Convert to .probe_new()
  rtc: m41t80: Convert to .probe_new()
  rtc: nct3018y: Convert to .probe_new()
  rtc: pcf2127: Convert to .probe_new()
  rtc: rs5c372: Convert to .probe_new()
  rtc: rv8803: Convert to .probe_new()
  rtc: rx8025: Convert to .probe_new()

 drivers/rtc/rtc-abx80x.c   | 36 ++++++++++++++++++------------------
 drivers/rtc/rtc-ds1307.c   |  8 ++++----
 drivers/rtc/rtc-isl1208.c  |  6 ++++--
 drivers/rtc/rtc-m41t80.c   | 11 ++++++-----
 drivers/rtc/rtc-nct3018y.c |  5 ++---
 drivers/rtc/rtc-pcf2127.c  | 22 +++++++++++-----------
 drivers/rtc/rtc-rs5c372.c  | 11 ++++++-----
 drivers/rtc/rtc-rv8803.c   | 30 ++++++++++++++++--------------
 drivers/rtc/rtc-rx8025.c   |  6 +++---
 9 files changed, 70 insertions(+), 65 deletions(-)


base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
-- 
2.37.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/9] rtc: abx80x: Convert to .probe_new()
  2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
@ 2022-10-21 13:06 ` Uwe Kleine-König
  2022-10-21 13:06 ` [PATCH 2/9] rtc: ds1307: " Uwe Kleine-König
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 13:06 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: Wolfram Sang, linux-rtc, 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/rtc/rtc-abx80x.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 9b0138d07232..e7f325ced940 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -673,13 +673,28 @@ static int abx80x_setup_watchdog(struct abx80x_priv *priv)
 }
 #endif
 
-static int abx80x_probe(struct i2c_client *client,
-			const struct i2c_device_id *id)
+static const struct i2c_device_id abx80x_id[] = {
+	{ "abx80x", ABX80X },
+	{ "ab0801", AB0801 },
+	{ "ab0803", AB0803 },
+	{ "ab0804", AB0804 },
+	{ "ab0805", AB0805 },
+	{ "ab1801", AB1801 },
+	{ "ab1803", AB1803 },
+	{ "ab1804", AB1804 },
+	{ "ab1805", AB1805 },
+	{ "rv1805", RV1805 },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, abx80x_id);
+
+static int abx80x_probe(struct i2c_client *client)
 {
 	struct device_node *np = client->dev.of_node;
 	struct abx80x_priv *priv;
 	int i, data, err, trickle_cfg = -EINVAL;
 	char buf[7];
+	const struct i2c_device_id *id = i2c_match_id(abx80x_id, client);
 	unsigned int part = id->driver_data;
 	unsigned int partnumber;
 	unsigned int majrev, minrev;
@@ -847,21 +862,6 @@ static int abx80x_probe(struct i2c_client *client,
 	return devm_rtc_register_device(priv->rtc);
 }
 
-static const struct i2c_device_id abx80x_id[] = {
-	{ "abx80x", ABX80X },
-	{ "ab0801", AB0801 },
-	{ "ab0803", AB0803 },
-	{ "ab0804", AB0804 },
-	{ "ab0805", AB0805 },
-	{ "ab1801", AB1801 },
-	{ "ab1803", AB1803 },
-	{ "ab1804", AB1804 },
-	{ "ab1805", AB1805 },
-	{ "rv1805", RV1805 },
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, abx80x_id);
-
 #ifdef CONFIG_OF
 static const struct of_device_id abx80x_of_match[] = {
 	{
@@ -914,7 +914,7 @@ static struct i2c_driver abx80x_driver = {
 		.name	= "rtc-abx80x",
 		.of_match_table = of_match_ptr(abx80x_of_match),
 	},
-	.probe		= abx80x_probe,
+	.probe_new	= abx80x_probe,
 	.id_table	= abx80x_id,
 };
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/9] rtc: ds1307: Convert to .probe_new()
  2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
  2022-10-21 13:06 ` [PATCH 1/9] rtc: abx80x: Convert " Uwe Kleine-König
@ 2022-10-21 13:06 ` Uwe Kleine-König
  2022-11-02 16:24   ` Alexandre Belloni
  2022-10-21 13:07 ` [PATCH 3/9] rtc: isl1208: " Uwe Kleine-König
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 13:06 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: Wolfram Sang, linux-rtc, 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/rtc/rtc-ds1307.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index d51565bcc189..70a6755a7d69 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1712,9 +1712,9 @@ static const struct regmap_config regmap_config = {
 	.val_bits = 8,
 };
 
-static int ds1307_probe(struct i2c_client *client,
-			const struct i2c_device_id *id)
+static int ds1307_probe(struct i2c_client *client)
 {
+	const struct i2c_device_id *id;
 	struct ds1307		*ds1307;
 	const void		*match;
 	int			err = -ENODEV;
@@ -1746,7 +1746,7 @@ static int ds1307_probe(struct i2c_client *client,
 	if (match) {
 		ds1307->type = (enum ds_type)match;
 		chip = &chips[ds1307->type];
-	} else if (id) {
+	} else if ((id = i2c_match_id(ds1307_id, client))) {
 		chip = &chips[id->driver_data];
 		ds1307->type = id->driver_data;
 	} else {
@@ -2011,7 +2011,7 @@ static struct i2c_driver ds1307_driver = {
 		.name	= "rtc-ds1307",
 		.of_match_table = ds1307_of_match,
 	},
-	.probe		= ds1307_probe,
+	.probe_new	= ds1307_probe,
 	.id_table	= ds1307_id,
 };
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/9] rtc: isl1208: Convert to .probe_new()
  2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
  2022-10-21 13:06 ` [PATCH 1/9] rtc: abx80x: Convert " Uwe Kleine-König
  2022-10-21 13:06 ` [PATCH 2/9] rtc: ds1307: " Uwe Kleine-König
@ 2022-10-21 13:07 ` Uwe Kleine-König
  2022-10-21 13:07 ` [PATCH 4/9] rtc: m41t80: " Uwe Kleine-König
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 13:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: Wolfram Sang, linux-rtc, 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/rtc/rtc-isl1208.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index f448a525333e..73cc6aaf9b8b 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -797,7 +797,7 @@ static int isl1208_setup_irq(struct i2c_client *client, int irq)
 }
 
 static int
-isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
+isl1208_probe(struct i2c_client *client)
 {
 	int rc = 0;
 	struct isl1208_state *isl1208;
@@ -821,6 +821,8 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		if (!isl1208->config)
 			return -ENODEV;
 	} else {
+		const struct i2c_device_id *id = i2c_match_id(isl1208_id, client);
+
 		if (id->driver_data >= ISL_LAST_ID)
 			return -ENODEV;
 		isl1208->config = &isl1208_configs[id->driver_data];
@@ -906,7 +908,7 @@ static struct i2c_driver isl1208_driver = {
 		.name = "rtc-isl1208",
 		.of_match_table = of_match_ptr(isl1208_of_match),
 	},
-	.probe = isl1208_probe,
+	.probe_new = isl1208_probe,
 	.id_table = isl1208_id,
 };
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/9] rtc: m41t80: Convert to .probe_new()
  2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2022-10-21 13:07 ` [PATCH 3/9] rtc: isl1208: " Uwe Kleine-König
@ 2022-10-21 13:07 ` Uwe Kleine-König
  2022-10-21 13:07 ` [PATCH 5/9] rtc: nct3018y: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 13:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: Wolfram Sang, linux-rtc, 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/rtc/rtc-m41t80.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index e0b4d3794320..d3144ffdebb5 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -876,8 +876,7 @@ static struct notifier_block wdt_notifier = {
  *****************************************************************************
  */
 
-static int m41t80_probe(struct i2c_client *client,
-			const struct i2c_device_id *id)
+static int m41t80_probe(struct i2c_client *client)
 {
 	struct i2c_adapter *adapter = client->adapter;
 	int rc = 0;
@@ -897,11 +896,13 @@ static int m41t80_probe(struct i2c_client *client,
 		return -ENOMEM;
 
 	m41t80_data->client = client;
-	if (client->dev.of_node)
+	if (client->dev.of_node) {
 		m41t80_data->features = (unsigned long)
 			of_device_get_match_data(&client->dev);
-	else
+	} else {
+		const struct i2c_device_id *id = i2c_match_id(m41t80_id, client);
 		m41t80_data->features = id->driver_data;
+	}
 	i2c_set_clientdata(client, m41t80_data);
 
 	m41t80_data->rtc =  devm_rtc_allocate_device(&client->dev);
@@ -1007,7 +1008,7 @@ static struct i2c_driver m41t80_driver = {
 		.of_match_table = of_match_ptr(m41t80_of_match),
 		.pm = &m41t80_pm,
 	},
-	.probe = m41t80_probe,
+	.probe_new = m41t80_probe,
 	.remove = m41t80_remove,
 	.id_table = m41t80_id,
 };
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/9] rtc: nct3018y: Convert to .probe_new()
  2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2022-10-21 13:07 ` [PATCH 4/9] rtc: m41t80: " Uwe Kleine-König
@ 2022-10-21 13:07 ` Uwe Kleine-König
  2022-10-21 13:07 ` [PATCH 6/9] rtc: pcf2127: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 13:07 UTC (permalink / raw)
  To: Avi Fishman, Tomer Maimon, Tali Perry, Patrick Venture,
	Nancy Yuen, Alessandro Zummo, Alexandre Belloni
  Cc: Wolfram Sang, Benjamin Fair, openbmc, linux-rtc, 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/rtc/rtc-nct3018y.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-nct3018y.c b/drivers/rtc/rtc-nct3018y.c
index d43acd3920ed..0a3b14c95d90 100644
--- a/drivers/rtc/rtc-nct3018y.c
+++ b/drivers/rtc/rtc-nct3018y.c
@@ -452,8 +452,7 @@ static const struct rtc_class_ops nct3018y_rtc_ops = {
 	.ioctl		= nct3018y_ioctl,
 };
 
-static int nct3018y_probe(struct i2c_client *client,
-			  const struct i2c_device_id *id)
+static int nct3018y_probe(struct i2c_client *client)
 {
 	struct nct3018y *nct3018y;
 	int err, flags;
@@ -541,7 +540,7 @@ static struct i2c_driver nct3018y_driver = {
 		.name	= "rtc-nct3018y",
 		.of_match_table = of_match_ptr(nct3018y_of_match),
 	},
-	.probe		= nct3018y_probe,
+	.probe_new	= nct3018y_probe,
 	.id_table	= nct3018y_id,
 };
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/9] rtc: pcf2127: Convert to .probe_new()
  2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2022-10-21 13:07 ` [PATCH 5/9] rtc: nct3018y: " Uwe Kleine-König
@ 2022-10-21 13:07 ` Uwe Kleine-König
  2022-10-21 13:07 ` [PATCH 7/9] rtc: rs5c372: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 13:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: Wolfram Sang, linux-rtc, 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/rtc/rtc-pcf2127.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 63b275b014bd..87f4fc9df68b 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -885,9 +885,17 @@ static const struct regmap_bus pcf2127_i2c_regmap = {
 
 static struct i2c_driver pcf2127_i2c_driver;
 
-static int pcf2127_i2c_probe(struct i2c_client *client,
-				const struct i2c_device_id *id)
+static const struct i2c_device_id pcf2127_i2c_id[] = {
+	{ "pcf2127", 1 },
+	{ "pcf2129", 0 },
+	{ "pca2129", 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, pcf2127_i2c_id);
+
+static int pcf2127_i2c_probe(struct i2c_client *client)
 {
+	const struct i2c_device_id *id = i2c_match_id(pcf2127_i2c_id, client);
 	struct regmap *regmap;
 	static const struct regmap_config config = {
 		.reg_bits = 8,
@@ -910,20 +918,12 @@ static int pcf2127_i2c_probe(struct i2c_client *client,
 			     pcf2127_i2c_driver.driver.name, id->driver_data);
 }
 
-static const struct i2c_device_id pcf2127_i2c_id[] = {
-	{ "pcf2127", 1 },
-	{ "pcf2129", 0 },
-	{ "pca2129", 0 },
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, pcf2127_i2c_id);
-
 static struct i2c_driver pcf2127_i2c_driver = {
 	.driver		= {
 		.name	= "rtc-pcf2127-i2c",
 		.of_match_table = of_match_ptr(pcf2127_of_match),
 	},
-	.probe		= pcf2127_i2c_probe,
+	.probe_new	= pcf2127_i2c_probe,
 	.id_table	= pcf2127_i2c_id,
 };
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/9] rtc: rs5c372: Convert to .probe_new()
  2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
                   ` (5 preceding siblings ...)
  2022-10-21 13:07 ` [PATCH 6/9] rtc: pcf2127: " Uwe Kleine-König
@ 2022-10-21 13:07 ` Uwe Kleine-König
  2022-10-21 13:07 ` [PATCH 8/9] rtc: rv8803: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 13:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: Wolfram Sang, linux-rtc, 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/rtc/rtc-rs5c372.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 9562c477e1c9..5047afefcceb 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -791,8 +791,7 @@ static int rs5c_oscillator_setup(struct rs5c372 *rs5c372)
 	return 0;
 }
 
-static int rs5c372_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
+static int rs5c372_probe(struct i2c_client *client)
 {
 	int err = 0;
 	int smbus_mode = 0;
@@ -826,11 +825,13 @@ static int rs5c372_probe(struct i2c_client *client,
 
 	rs5c372->client = client;
 	i2c_set_clientdata(client, rs5c372);
-	if (client->dev.of_node)
+	if (client->dev.of_node) {
 		rs5c372->type = (enum rtc_type)
 			of_device_get_match_data(&client->dev);
-	else
+	} else {
+		const struct i2c_device_id *id = i2c_match_id(rs5c372_id, client);
 		rs5c372->type = id->driver_data;
+	}
 
 	/* we read registers 0x0f then 0x00-0x0f; skip the first one */
 	rs5c372->regs = &rs5c372->buf[1];
@@ -920,7 +921,7 @@ static struct i2c_driver rs5c372_driver = {
 		.name	= "rtc-rs5c372",
 		.of_match_table = of_match_ptr(rs5c372_of_match),
 	},
-	.probe		= rs5c372_probe,
+	.probe_new	= rs5c372_probe,
 	.remove		= rs5c372_remove,
 	.id_table	= rs5c372_id,
 };
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 8/9] rtc: rv8803: Convert to .probe_new()
  2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
                   ` (6 preceding siblings ...)
  2022-10-21 13:07 ` [PATCH 7/9] rtc: rs5c372: " Uwe Kleine-König
@ 2022-10-21 13:07 ` Uwe Kleine-König
  2022-10-21 13:07 ` [PATCH 9/9] rtc: rx8025: " Uwe Kleine-König
  2022-11-02 16:23 ` [PATCH 0/9] rtc: Convert i2c drivers " Alexandre Belloni
  9 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 13:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: Wolfram Sang, linux-rtc, 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/rtc/rtc-rv8803.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
index 3527a0521e9b..b581b6d5ad73 100644
--- a/drivers/rtc/rtc-rv8803.c
+++ b/drivers/rtc/rtc-rv8803.c
@@ -576,8 +576,16 @@ static int rv8803_regs_configure(struct rv8803_data *rv8803)
 	return 0;
 }
 
-static int rv8803_probe(struct i2c_client *client,
-			const struct i2c_device_id *id)
+static const struct i2c_device_id rv8803_id[] = {
+	{ "rv8803", rv_8803 },
+	{ "rv8804", rx_8804 },
+	{ "rx8803", rx_8803 },
+	{ "rx8900", rx_8900 },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, rv8803_id);
+
+static int rv8803_probe(struct i2c_client *client)
 {
 	struct i2c_adapter *adapter = client->adapter;
 	struct rv8803_data *rv8803;
@@ -605,11 +613,14 @@ static int rv8803_probe(struct i2c_client *client,
 
 	mutex_init(&rv8803->flags_lock);
 	rv8803->client = client;
-	if (client->dev.of_node)
+	if (client->dev.of_node) {
 		rv8803->type = (enum rv8803_type)
 			of_device_get_match_data(&client->dev);
-	else
+	} else {
+		const struct i2c_device_id *id = i2c_match_id(rv8803_id, client);
+
 		rv8803->type = id->driver_data;
+	}
 	i2c_set_clientdata(client, rv8803);
 
 	flags = rv8803_read_reg(client, RV8803_FLAG);
@@ -666,15 +677,6 @@ static int rv8803_probe(struct i2c_client *client,
 	return 0;
 }
 
-static const struct i2c_device_id rv8803_id[] = {
-	{ "rv8803", rv_8803 },
-	{ "rv8804", rx_8804 },
-	{ "rx8803", rx_8803 },
-	{ "rx8900", rx_8900 },
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, rv8803_id);
-
 static const __maybe_unused struct of_device_id rv8803_of_match[] = {
 	{
 		.compatible = "microcrystal,rv8803",
@@ -701,7 +703,7 @@ static struct i2c_driver rv8803_driver = {
 		.name = "rtc-rv8803",
 		.of_match_table = of_match_ptr(rv8803_of_match),
 	},
-	.probe		= rv8803_probe,
+	.probe_new	= rv8803_probe,
 	.id_table	= rv8803_id,
 };
 module_i2c_driver(rv8803_driver);
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 9/9] rtc: rx8025: Convert to .probe_new()
  2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
                   ` (7 preceding siblings ...)
  2022-10-21 13:07 ` [PATCH 8/9] rtc: rv8803: " Uwe Kleine-König
@ 2022-10-21 13:07 ` Uwe Kleine-König
  2022-11-02 16:23 ` [PATCH 0/9] rtc: Convert i2c drivers " Alexandre Belloni
  9 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2022-10-21 13:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: Wolfram Sang, linux-rtc, 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/rtc/rtc-rx8025.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index dde86f3e2a4b..77d3cb08b5ec 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -519,9 +519,9 @@ static const struct attribute_group rx8025_attr_group = {
 	.attrs	= rx8025_attrs,
 };
 
-static int rx8025_probe(struct i2c_client *client,
-			const struct i2c_device_id *id)
+static int rx8025_probe(struct i2c_client *client)
 {
+	const struct i2c_device_id *id = i2c_match_id(rx8025_id, client);
 	struct i2c_adapter *adapter = client->adapter;
 	struct rx8025_data *rx8025;
 	int err = 0;
@@ -580,7 +580,7 @@ static struct i2c_driver rx8025_driver = {
 	.driver = {
 		.name = "rtc-rx8025",
 	},
-	.probe		= rx8025_probe,
+	.probe_new	= rx8025_probe,
 	.id_table	= rx8025_id,
 };
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/9] rtc: Convert i2c drivers to .probe_new()
  2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
                   ` (8 preceding siblings ...)
  2022-10-21 13:07 ` [PATCH 9/9] rtc: rx8025: " Uwe Kleine-König
@ 2022-11-02 16:23 ` Alexandre Belloni
  9 siblings, 0 replies; 12+ messages in thread
From: Alexandre Belloni @ 2022-11-02 16:23 UTC (permalink / raw)
  To: Tali Perry, Avi Fishman, Nancy Yuen, Patrick Venture,
	Alessandro Zummo, Uwe Kleine-König, Tomer Maimon
  Cc: openbmc, Benjamin Fair, Wolfram Sang, kernel, linux-rtc

On Fri, 21 Oct 2022 15:06:57 +0200, Uwe Kleine-König wrote:
> See commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back
> type") for the rationale.
> 
> Best regards
> Uwe
> 
> Uwe Kleine-König (9):
>   rtc: abx80x: Convert to .probe_new()
>   rtc: ds1307: Convert to .probe_new()
>   rtc: isl1208: Convert to .probe_new()
>   rtc: m41t80: Convert to .probe_new()
>   rtc: nct3018y: Convert to .probe_new()
>   rtc: pcf2127: Convert to .probe_new()
>   rtc: rs5c372: Convert to .probe_new()
>   rtc: rv8803: Convert to .probe_new()
>   rtc: rx8025: Convert to .probe_new()
> 
> [...]

Applied, thanks!

[1/9] rtc: abx80x: Convert to .probe_new()
      commit: 4c112e62e093b216e10fbe568e51447b9e3fee34
[3/9] rtc: isl1208: Convert to .probe_new()
      commit: 44b8ae3ed23f0e2b5bc680c0a3f4be7c5597cb78
[4/9] rtc: m41t80: Convert to .probe_new()
      commit: 52b31f00779690274c2c54eb3cd939004ac077e4
[5/9] rtc: nct3018y: Convert to .probe_new()
      commit: a9e9636a71039f5aa270091209f0580c638e341f
[6/9] rtc: pcf2127: Convert to .probe_new()
      commit: e3be426bc755cb4946ee126ec23cd94cbe42251f
[7/9] rtc: rs5c372: Convert to .probe_new()
      commit: b08e47b0c8a83f4de9676122064bf57baa4ea1e8
[8/9] rtc: rv8803: Convert to .probe_new()
      commit: 1107e384f95eeeeda2ae98f0a162b4fb9f6015cd
[9/9] rtc: rx8025: Convert to .probe_new()
      commit: 789c2c83c89957e9c27e419801c2bab3bbf7a8b0

Note that patch attestation reports bad signature on your patches.

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/9] rtc: ds1307: Convert to .probe_new()
  2022-10-21 13:06 ` [PATCH 2/9] rtc: ds1307: " Uwe Kleine-König
@ 2022-11-02 16:24   ` Alexandre Belloni
  0 siblings, 0 replies; 12+ messages in thread
From: Alexandre Belloni @ 2022-11-02 16:24 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Alessandro Zummo, Wolfram Sang, linux-rtc, kernel

On 21/10/2022 15:06:59+0200, Uwe Kleine-König wrote:
> .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/rtc/rtc-ds1307.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index d51565bcc189..70a6755a7d69 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -1712,9 +1712,9 @@ static const struct regmap_config regmap_config = {
>  	.val_bits = 8,
>  };
>  
> -static int ds1307_probe(struct i2c_client *client,
> -			const struct i2c_device_id *id)
> +static int ds1307_probe(struct i2c_client *client)
>  {
> +	const struct i2c_device_id *id;
>  	struct ds1307		*ds1307;
>  	const void		*match;
>  	int			err = -ENODEV;
> @@ -1746,7 +1746,7 @@ static int ds1307_probe(struct i2c_client *client,
>  	if (match) {
>  		ds1307->type = (enum ds_type)match;
>  		chip = &chips[ds1307->type];
> -	} else if (id) {
> +	} else if ((id = i2c_match_id(ds1307_id, client))) {

This is not proper style for the kernel and it introduces a checkpatch
error.

>  		chip = &chips[id->driver_data];
>  		ds1307->type = id->driver_data;
>  	} else {
> @@ -2011,7 +2011,7 @@ static struct i2c_driver ds1307_driver = {
>  		.name	= "rtc-ds1307",
>  		.of_match_table = ds1307_of_match,
>  	},
> -	.probe		= ds1307_probe,
> +	.probe_new	= ds1307_probe,
>  	.id_table	= ds1307_id,
>  };
>  
> -- 
> 2.37.2
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-11-02 16:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-21 13:06 [PATCH 0/9] rtc: Convert i2c drivers to .probe_new() Uwe Kleine-König
2022-10-21 13:06 ` [PATCH 1/9] rtc: abx80x: Convert " Uwe Kleine-König
2022-10-21 13:06 ` [PATCH 2/9] rtc: ds1307: " Uwe Kleine-König
2022-11-02 16:24   ` Alexandre Belloni
2022-10-21 13:07 ` [PATCH 3/9] rtc: isl1208: " Uwe Kleine-König
2022-10-21 13:07 ` [PATCH 4/9] rtc: m41t80: " Uwe Kleine-König
2022-10-21 13:07 ` [PATCH 5/9] rtc: nct3018y: " Uwe Kleine-König
2022-10-21 13:07 ` [PATCH 6/9] rtc: pcf2127: " Uwe Kleine-König
2022-10-21 13:07 ` [PATCH 7/9] rtc: rs5c372: " Uwe Kleine-König
2022-10-21 13:07 ` [PATCH 8/9] rtc: rv8803: " Uwe Kleine-König
2022-10-21 13:07 ` [PATCH 9/9] rtc: rx8025: " Uwe Kleine-König
2022-11-02 16:23 ` [PATCH 0/9] rtc: Convert i2c drivers " Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).