public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mfd: max8997: Simplify probe() and drop max8997_i2c_get_driver_data()
@ 2023-08-28 16:02 Biju Das
  2023-08-29 14:51 ` Andy Shevchenko
  2023-09-19 15:19 ` (subset) " Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Biju Das @ 2023-08-28 16:02 UTC (permalink / raw)
  To: Lee Jones; +Cc: Biju Das, linux-kernel, Andy Shevchenko

Simplify probe() by using i2c_get_match_data() instead of
max8997_i2c_get_driver_data() for retrieving match data from
OF/ID tables.

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

v1->v2:
 * Used uintptr_t for enum casting.
---
 drivers/mfd/max8997.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
index 110bef71f208..ffe96b40368e 100644
--- a/drivers/mfd/max8997.c
+++ b/drivers/mfd/max8997.c
@@ -142,18 +142,8 @@ static struct max8997_platform_data *max8997_i2c_parse_dt_pdata(
 	return pd;
 }
 
-static inline unsigned long max8997_i2c_get_driver_data(struct i2c_client *i2c,
-						const struct i2c_device_id *id)
-{
-	if (i2c->dev.of_node)
-		return (unsigned long)of_device_get_match_data(&i2c->dev);
-
-	return id->driver_data;
-}
-
 static int max8997_i2c_probe(struct i2c_client *i2c)
 {
-	const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
 	struct max8997_dev *max8997;
 	struct max8997_platform_data *pdata = dev_get_platdata(&i2c->dev);
 	int ret = 0;
@@ -166,7 +156,7 @@ static int max8997_i2c_probe(struct i2c_client *i2c)
 	i2c_set_clientdata(i2c, max8997);
 	max8997->dev = &i2c->dev;
 	max8997->i2c = i2c;
-	max8997->type = max8997_i2c_get_driver_data(i2c, id);
+	max8997->type = (uintptr_t)i2c_get_match_data(i2c);
 	max8997->irq = i2c->irq;
 
 	if (IS_ENABLED(CONFIG_OF) && max8997->dev->of_node) {
-- 
2.25.1


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

* Re: [PATCH v2] mfd: max8997: Simplify probe() and drop max8997_i2c_get_driver_data()
  2023-08-28 16:02 [PATCH v2] mfd: max8997: Simplify probe() and drop max8997_i2c_get_driver_data() Biju Das
@ 2023-08-29 14:51 ` Andy Shevchenko
  2023-09-19 15:19 ` (subset) " Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-08-29 14:51 UTC (permalink / raw)
  To: Biju Das; +Cc: Lee Jones, linux-kernel

On Mon, Aug 28, 2023 at 05:02:24PM +0100, Biju Das wrote:
> Simplify probe() by using i2c_get_match_data() instead of
> max8997_i2c_get_driver_data() for retrieving match data from
> OF/ID tables.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



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

* Re: (subset) [PATCH v2] mfd: max8997: Simplify probe() and drop max8997_i2c_get_driver_data()
  2023-08-28 16:02 [PATCH v2] mfd: max8997: Simplify probe() and drop max8997_i2c_get_driver_data() Biju Das
  2023-08-29 14:51 ` Andy Shevchenko
@ 2023-09-19 15:19 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2023-09-19 15:19 UTC (permalink / raw)
  To: Lee Jones, Biju Das; +Cc: linux-kernel, Andy Shevchenko

On Mon, 28 Aug 2023 17:02:24 +0100, Biju Das wrote:
> Simplify probe() by using i2c_get_match_data() instead of
> max8997_i2c_get_driver_data() for retrieving match data from
> OF/ID tables.
> 
> 

Applied, thanks!

[1/1] mfd: max8997: Simplify probe() and drop max8997_i2c_get_driver_data()
      commit: a17eaf36319c7e209f50f3da7d5a5ebc104e5bb6

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2023-09-19 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-28 16:02 [PATCH v2] mfd: max8997: Simplify probe() and drop max8997_i2c_get_driver_data() Biju Das
2023-08-29 14:51 ` Andy Shevchenko
2023-09-19 15:19 ` (subset) " Lee Jones

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