Skip to content

Commit d0871b5

Browse files
ye xingchenlag-linaro
authored andcommitted
mfd: palmas: Use device_get_match_data() to simplify the code
Directly get the match data with device_get_match_data(). Signed-off-by: ye xingchen <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c8cf6e2 commit d0871b5

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

drivers/mfd/palmas.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,6 @@ static int palmas_i2c_probe(struct i2c_client *i2c)
511511
int ret = 0, i;
512512
unsigned int reg, addr;
513513
int slave;
514-
const struct of_device_id *match;
515514

516515
pdata = dev_get_platdata(&i2c->dev);
517516

@@ -535,12 +534,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c)
535534
palmas->dev = &i2c->dev;
536535
palmas->irq = i2c->irq;
537536

538-
match = of_match_device(of_palmas_match_tbl, &i2c->dev);
539-
540-
if (!match)
541-
return -ENODATA;
542-
543-
driver_data = (struct palmas_driver_data *)match->data;
537+
driver_data = (struct palmas_driver_data *) device_get_match_data(&i2c->dev);
544538
palmas->features = *driver_data->features;
545539

546540
for (i = 0; i < PALMAS_NUM_CLIENTS; i++) {

0 commit comments

Comments
 (0)