Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Biju Das and committed by
Lee Jones
c4974eea bffa4288

+1 -11
+1 -11
drivers/mfd/max8998.c
··· 152 152 return pd; 153 153 } 154 154 155 - static inline unsigned long max8998_i2c_get_driver_data(struct i2c_client *i2c, 156 - const struct i2c_device_id *id) 157 - { 158 - if (i2c->dev.of_node) 159 - return (unsigned long)of_device_get_match_data(&i2c->dev); 160 - 161 - return id->driver_data; 162 - } 163 - 164 155 static int max8998_i2c_probe(struct i2c_client *i2c) 165 156 { 166 - const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 167 157 struct max8998_platform_data *pdata = dev_get_platdata(&i2c->dev); 168 158 struct max8998_dev *max8998; 169 159 int ret = 0; ··· 173 183 max8998->dev = &i2c->dev; 174 184 max8998->i2c = i2c; 175 185 max8998->irq = i2c->irq; 176 - max8998->type = max8998_i2c_get_driver_data(i2c, id); 186 + max8998->type = (uintptr_t)i2c_get_match_data(i2c); 177 187 max8998->pdata = pdata; 178 188 if (pdata) { 179 189 max8998->ono = pdata->ono;