mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] mfd: madera-i2c: Simplify probe()
@ 2023-08-28 15:49 Biju Das
  2023-08-29 14:51 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Biju Das @ 2023-08-28 15:49 UTC (permalink / raw)
  To: Lee Jones
  Cc: Biju Das, Charles Keepax, Richard Fitzgerald, alsa-devel,
	patches, linux-kernel, Andy Shevchenko

Simplify probe() by replacing of_device_get_match_data() and ID lookup for
retrieving match data by i2c_get_match_data().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
Note:
 This patch is only compile tested.

v1->v2:
 * Added Ack tag from Charles Keepax.
 * Dropped blank line before switch statement.
---
 drivers/mfd/madera-i2c.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/mfd/madera-i2c.c b/drivers/mfd/madera-i2c.c
index a404ea26bc79..33781c631345 100644
--- a/drivers/mfd/madera-i2c.c
+++ b/drivers/mfd/madera-i2c.c
@@ -18,21 +18,14 @@
 
 static int madera_i2c_probe(struct i2c_client *i2c)
 {
-	const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
 	struct madera *madera;
 	const struct regmap_config *regmap_16bit_config = NULL;
 	const struct regmap_config *regmap_32bit_config = NULL;
-	const void *of_data;
 	unsigned long type;
 	const char *name;
 	int ret;
 
-	of_data = of_device_get_match_data(&i2c->dev);
-	if (of_data)
-		type = (unsigned long)of_data;
-	else
-		type = id->driver_data;
-
+	type = (unsigned long)i2c_get_match_data(i2c);
 	switch (type) {
 	case CS47L15:
 		if (IS_ENABLED(CONFIG_MFD_CS47L15)) {
-- 
2.25.1


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

* Re: [PATCH v2] mfd: madera-i2c: Simplify probe()
  2023-08-28 15:49 [PATCH v2] mfd: madera-i2c: Simplify probe() Biju Das
@ 2023-08-29 14:51 ` Andy Shevchenko
  2023-08-29 14:56   ` Biju Das
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2023-08-29 14:51 UTC (permalink / raw)
  To: Biju Das
  Cc: Lee Jones, Charles Keepax, Richard Fitzgerald, alsa-devel,
	patches, linux-kernel

On Mon, Aug 28, 2023 at 04:49:41PM +0100, Biju Das wrote:
> Simplify probe() by replacing of_device_get_match_data() and ID lookup for
> retrieving match data by i2c_get_match_data().

...

> +	type = (unsigned long)i2c_get_match_data(i2c);

uintptr_t ?


-- 
With Best Regards,
Andy Shevchenko



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

* RE: [PATCH v2] mfd: madera-i2c: Simplify probe()
  2023-08-29 14:51 ` Andy Shevchenko
@ 2023-08-29 14:56   ` Biju Das
  0 siblings, 0 replies; 3+ messages in thread
From: Biju Das @ 2023-08-29 14:56 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Lee Jones, Charles Keepax, Richard Fitzgerald, alsa-devel,
	patches, linux-kernel

Hi Andy Shevchenko,

> Subject: Re: [PATCH v2] mfd: madera-i2c: Simplify probe()
> 
> On Mon, Aug 28, 2023 at 04:49:41PM +0100, Biju Das wrote:
> > Simplify probe() by replacing of_device_get_match_data() and ID lookup
> > for retrieving match data by i2c_get_match_data().
> 
> ...
> 
> > +	type = (unsigned long)i2c_get_match_data(i2c);
> 
> uintptr_t ?

Oops, missed it.

Cheers,
Biju

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

end of thread, other threads:[~2023-08-29 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28 15:49 [PATCH v2] mfd: madera-i2c: Simplify probe() Biju Das
2023-08-29 14:51 ` Andy Shevchenko
2023-08-29 14:56   ` Biju Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®