diff mbox series

mfd: arizona-i2c: Simplify probe()

Message ID 20230826092721.55225-1-biju.das.jz@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series mfd: arizona-i2c: Simplify probe() | expand

Commit Message

Biju Das Aug. 26, 2023, 9:27 a.m. UTC
Simplify probe() by replacing 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/arizona-i2c.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Charles Keepax Aug. 28, 2023, 8:52 a.m. UTC | #1
On Sat, Aug 26, 2023 at 10:27:21AM +0100, Biju Das wrote:
> Simplify probe() by replacing 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>
Tested-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:27:21AM +0100, Biju Das wrote:
> Simplify probe() by replacing device_get_match_data() and ID lookup for
> retrieving match data by i2c_get_match_data().

...

> -	match_data = device_get_match_data(&i2c->dev);
> -	if (match_data)
> -		type = (unsigned long)match_data;
> -	else if (id)
> -		type = id->driver_data;
> +	type = (unsigned long)i2c_get_match_data(i2c);

>  

You now can drop this blank line.

>  	switch (type) {
Biju Das Aug. 28, 2023, 11:24 a.m. UTC | #3
Hi Andy Shevchenko,

Thanks for the feedback.

> Subject: Re: [PATCH] mfd: arizona-i2c: Simplify probe()
> 
> On Sat, Aug 26, 2023 at 10:27:21AM +0100, Biju Das wrote:
> > Simplify probe() by replacing device_get_match_data() and ID lookup
> > for retrieving match data by i2c_get_match_data().
> 
> ...
> 
> > -	match_data = device_get_match_data(&i2c->dev);
> > -	if (match_data)
> > -		type = (unsigned long)match_data;
> > -	else if (id)
> > -		type = id->driver_data;
> > +	type = (unsigned long)i2c_get_match_data(i2c);
> 
> >
> 
> You now can drop this blank line.

Agreed.

Cheers,
Biju

> 
> >  	switch (type) {
> 
> --
> With Best Regards,
> Andy Shevchenko
>
diff mbox series

Patch

diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c
index 9b7183ffc928..3ee00fac10aa 100644
--- a/drivers/mfd/arizona-i2c.c
+++ b/drivers/mfd/arizona-i2c.c
@@ -22,18 +22,12 @@ 
 
 static int arizona_i2c_probe(struct i2c_client *i2c)
 {
-	const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
-	const void *match_data;
 	struct arizona *arizona;
 	const struct regmap_config *regmap_config = NULL;
-	unsigned long type = 0;
+	unsigned long type;
 	int ret;
 
-	match_data = device_get_match_data(&i2c->dev);
-	if (match_data)
-		type = (unsigned long)match_data;
-	else if (id)
-		type = id->driver_data;
+	type = (unsigned long)i2c_get_match_data(i2c);
 
 	switch (type) {
 	case WM5102: