diff mbox series

[2/2] mfd: palmas: Make similar OF and ID table

Message ID 20230826082217.41967-3-biju.das.jz@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series Match data improvements for palmas driver | expand

Commit Message

Biju Das Aug. 26, 2023, 8:22 a.m. UTC
Make similar OF and ID table to extend support for ID match using
i2c_match_data(). Currently it works only for OF match tables as the
driver_data is wrong for ID match.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/mfd/palmas.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Andy Shevchenko Aug. 28, 2023, 11:19 a.m. UTC | #1
On Sat, Aug 26, 2023 at 09:22:17AM +0100, Biju Das wrote:
> Make similar OF and ID table to extend support for ID match using
> i2c_match_data(). Currently it works only for OF match tables as the
> driver_data is wrong for ID match.

...

> -static const struct i2c_device_id palmas_i2c_id[] = {
> -	{ "palmas", },
> -	{ "twl6035", },
> -	{ "twl6037", },
> -	{ "tps65913", },
> -	{ /* end */ }
> -};
> -MODULE_DEVICE_TABLE(i2c, palmas_i2c_id);

Why do you move it up?
The first user of the table is below this code.
Biju Das Aug. 28, 2023, 11:32 a.m. UTC | #2
Hi Andy Shevchenko,

> Subject: Re: [PATCH 2/2] mfd: palmas: Make similar OF and ID table
> 
> On Sat, Aug 26, 2023 at 09:22:17AM +0100, Biju Das wrote:
> > Make similar OF and ID table to extend support for ID match using
> > i2c_match_data(). Currently it works only for OF match tables as the
> > driver_data is wrong for ID match.
> 
> ...
> 
> > -static const struct i2c_device_id palmas_i2c_id[] = {
> > -	{ "palmas", },
> > -	{ "twl6035", },
> > -	{ "twl6037", },
> > -	{ "tps65913", },
> > -	{ /* end */ }
> > -};
> > -MODULE_DEVICE_TABLE(i2c, palmas_i2c_id);
> 
> Why do you move it up?
> The first user of the table is below this code.

Agreed, will fix it in v2.

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 71df70e1bd33..9f614bbca007 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -489,6 +489,15 @@  static const struct of_device_id of_palmas_match_tbl[] = {
 };
 MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);
 
+static const struct i2c_device_id palmas_i2c_id[] = {
+	{ "palmas", (kernel_ulong_t)&palmas_data },
+	{ "twl6035", (kernel_ulong_t)&palmas_data },
+	{ "twl6037", (kernel_ulong_t)&palmas_data },
+	{ "tps65913", (kernel_ulong_t)&palmas_data },
+	{ /* end */ }
+};
+MODULE_DEVICE_TABLE(i2c, palmas_i2c_id);
+
 static int palmas_i2c_probe(struct i2c_client *i2c)
 {
 	struct palmas *palmas;
@@ -521,7 +530,7 @@  static int palmas_i2c_probe(struct i2c_client *i2c)
 	palmas->dev = &i2c->dev;
 	palmas->irq = i2c->irq;
 
-	driver_data = device_get_match_data(&i2c->dev);
+	driver_data = i2c_get_match_data(i2c);
 	palmas->features = driver_data->features;
 
 	for (i = 0; i < PALMAS_NUM_CLIENTS; i++) {
@@ -698,15 +707,6 @@  static void palmas_i2c_remove(struct i2c_client *i2c)
 	}
 }
 
-static const struct i2c_device_id palmas_i2c_id[] = {
-	{ "palmas", },
-	{ "twl6035", },
-	{ "twl6037", },
-	{ "tps65913", },
-	{ /* end */ }
-};
-MODULE_DEVICE_TABLE(i2c, palmas_i2c_id);
-
 static struct i2c_driver palmas_i2c_driver = {
 	.driver = {
 		   .name = "palmas",