All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: madera-i2c: Simplify probe()
@ 2023-08-26  9:17 Biju Das
  2023-08-28  8:52 ` Charles Keepax
  2023-08-28 10:55 ` Andy Shevchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Biju Das @ 2023-08-26  9:17 UTC (permalink / raw)
  To: Lee Jones
  Cc: Biju Das, Charles Keepax, Richard Fitzgerald, alsa-devel, patches,
	Geert Uytterhoeven, Andy Shevchenko, Prabhakar Mahadev Lad,
	linux-renesas-soc

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>
---
Note:
 This patch is only compile tested.
---
 drivers/mfd/madera-i2c.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/mfd/madera-i2c.c b/drivers/mfd/madera-i2c.c
index a404ea26bc79..b705fd5b90d8 100644
--- a/drivers/mfd/madera-i2c.c
+++ b/drivers/mfd/madera-i2c.c
@@ -18,20 +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:
-- 
2.25.1


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

* Re: [PATCH] mfd: madera-i2c: Simplify probe()
  2023-08-26  9:17 [PATCH] mfd: madera-i2c: Simplify probe() Biju Das
@ 2023-08-28  8:52 ` Charles Keepax
  2023-08-28 10:55 ` Andy Shevchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Charles Keepax @ 2023-08-28  8:52 UTC (permalink / raw)
  To: Biju Das
  Cc: Lee Jones, Richard Fitzgerald, alsa-devel, patches,
	Geert Uytterhoeven, Andy Shevchenko, Prabhakar Mahadev Lad,
	linux-renesas-soc

On Sat, Aug 26, 2023 at 10:17:51AM +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().
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH] mfd: madera-i2c: Simplify probe()
  2023-08-26  9:17 [PATCH] mfd: madera-i2c: Simplify probe() Biju Das
  2023-08-28  8:52 ` Charles Keepax
@ 2023-08-28 10:55 ` Andy Shevchenko
  2023-08-28 11:46   ` Biju Das
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2023-08-28 10:55 UTC (permalink / raw)
  To: Biju Das
  Cc: Lee Jones, Charles Keepax, Richard Fitzgerald, alsa-devel,
	patches, Geert Uytterhoeven, Prabhakar Mahadev Lad,
	linux-renesas-soc

On Sat, Aug 26, 2023 at 10:17:51AM +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().

...

> -	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);

>  

This blank line is not needed after this change.

>  	switch (type) {

-- 
With Best Regards,
Andy Shevchenko



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

* RE: [PATCH] mfd: madera-i2c: Simplify probe()
  2023-08-28 10:55 ` Andy Shevchenko
@ 2023-08-28 11:46   ` Biju Das
  0 siblings, 0 replies; 4+ messages in thread
From: Biju Das @ 2023-08-28 11:46 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Lee Jones, Charles Keepax, Richard Fitzgerald,
	alsa-devel@alsa-project.org, patches@opensource.cirrus.com,
	Geert Uytterhoeven, Prabhakar Mahadev Lad,
	linux-renesas-soc@vger.kernel.org

Hi Andy Shevchenko,

> Subject: Re: [PATCH] mfd: madera-i2c: Simplify probe()
> 
> On Sat, Aug 26, 2023 at 10:17:51AM +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().
> 
> ...
> 
> > -	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);
> 
> >
> 
> This blank line is not needed after this change.


Agreed, will remove it.

Cheers,
Biju
 


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

end of thread, other threads:[~2023-08-28 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-26  9:17 [PATCH] mfd: madera-i2c: Simplify probe() Biju Das
2023-08-28  8:52 ` Charles Keepax
2023-08-28 10:55 ` Andy Shevchenko
2023-08-28 11:46   ` Biju Das

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.