mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
mfd: max8998: Simplify obtaining I2C match data and drop max8998_i2c_get_driver_data()
Simplify probe() by using i2c_get_match_data() instead of max8998_i2c_get_driver_data() for retrieving match data from OF/ID tables. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230923174928.56824-5-biju.das.jz@bp.renesas.com Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
bffa42885f
commit
c4974eea6c
@ -152,18 +152,8 @@ static struct max8998_platform_data *max8998_i2c_parse_dt_pdata(
|
||||
return pd;
|
||||
}
|
||||
|
||||
static inline unsigned long max8998_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 max8998_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
||||
struct max8998_platform_data *pdata = dev_get_platdata(&i2c->dev);
|
||||
struct max8998_dev *max8998;
|
||||
int ret = 0;
|
||||
@ -183,7 +173,7 @@ static int max8998_i2c_probe(struct i2c_client *i2c)
|
||||
max8998->dev = &i2c->dev;
|
||||
max8998->i2c = i2c;
|
||||
max8998->irq = i2c->irq;
|
||||
max8998->type = max8998_i2c_get_driver_data(i2c, id);
|
||||
max8998->type = (uintptr_t)i2c_get_match_data(i2c);
|
||||
max8998->pdata = pdata;
|
||||
if (pdata) {
|
||||
max8998->ono = pdata->ono;
|
||||
|
Loading…
Reference in New Issue
Block a user