diff mbox series

mfd: madera-i2c: Simplify probe()

Message ID 20230826091751.51634-1-biju.das.jz@bp.renesas.com
State Superseded
Headers show
Series mfd: madera-i2c: Simplify probe() | expand

Commit Message

Biju Das Aug. 26, 2023, 9:17 a.m. UTC
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(-)

Comments

Charles Keepax Aug. 28, 2023, 8:52 a.m. UTC | #1
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
Andy Shevchenko Aug. 28, 2023, 10:55 a.m. UTC | #2
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) {
Biju Das Aug. 28, 2023, 11:46 a.m. UTC | #3
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
diff mbox series

Patch

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: