Message ID | 20230826094905.64430-1-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | mfd: max8997: Simplify probe() and drop max8997_i2c_get_driver_data() | expand |
On Sat, Aug 26, 2023 at 10:49:05AM +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. ... > - max8997->type = max8997_i2c_get_driver_data(i2c, id); > + max8997->type = (unsigned long)i2c_get_match_data(i2c); You need to be consistent inside your patches with the casting...
Hi Andy Shevchenko, > Subject: Re: [PATCH] mfd: max8997: Simplify probe() and drop > max8997_i2c_get_driver_data() > > On Sat, Aug 26, 2023 at 10:49:05AM +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. > > ... > > > - max8997->type = max8997_i2c_get_driver_data(i2c, id); > > + max8997->type = (unsigned long)i2c_get_match_data(i2c); > > You need to be consistent inside your patches with the casting... OK, will use uintptr_t for enum casting. Cheers, Biju
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 110bef71f208..fcb8fd1ec25d 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 = (unsigned long)i2c_get_match_data(i2c); max8997->irq = i2c->irq; if (IS_ENABLED(CONFIG_OF) && max8997->dev->of_node) {
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. --- drivers/mfd/max8997.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)