public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mfd: arizona-i2c: Simplify probe()
@ 2023-08-28 15:56 Biju Das
  2023-08-29 14:53 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Biju Das @ 2023-08-28 15:56 UTC (permalink / raw)
  To: Lee Jones
  Cc: Biju Das, patches, linux-kernel, Andy Shevchenko, Charles Keepax

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>
---
Note:
 This patch is only compile tested.

v1->v2:
 * Added Ack and Tested-by tag from Charles Keepax
 * Dropped unnecessary blank line before switch statement.
---
 drivers/mfd/arizona-i2c.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c
index 9b7183ffc928..5f830907d2e6 100644
--- a/drivers/mfd/arizona-i2c.c
+++ b/drivers/mfd/arizona-i2c.c
@@ -22,19 +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:
 		if (IS_ENABLED(CONFIG_MFD_WM5102))
-- 
2.25.1


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

* Re: [PATCH v2] mfd: arizona-i2c: Simplify probe()
  2023-08-28 15:56 [PATCH v2] mfd: arizona-i2c: Simplify probe() Biju Das
@ 2023-08-29 14:53 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2023-08-29 14:53 UTC (permalink / raw)
  To: Biju Das; +Cc: Lee Jones, patches, linux-kernel, Charles Keepax

On Mon, Aug 28, 2023 at 04:56:17PM +0100, Biju Das wrote:
> Simplify probe() by replacing 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] 2+ messages in thread

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

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

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