Skip to contentSkip to conversation

mfd: palmas: Use device_get_match_data() to simplify the code

PATCH Applied [email protected] 2 participants 2 messages Nov 17, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: palmas: Use device_get_match_data() to simplify the code

From: ye xingchen <[email protected]>

Directly get the match data with device_get_match_data().

---
 drivers/mfd/palmas.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/mfd/palmas.c +1 -7
index 8b7429bd2e3e..5105c6488d3d 100644
@@ -512,7 +512,6 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
 	int ret = 0, i;
 	unsigned int reg, addr;
 	int slave;
-	const struct of_device_id *match;
 
 	pdata = dev_get_platdata(&i2c->dev);
 
@@ -536,12 +535,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
 	palmas->dev = &i2c->dev;
 	palmas->irq = i2c->irq;
 
-	match = of_match_device(of_palmas_match_tbl, &i2c->dev);
-
-	if (!match)
-		return -ENODATA;
-
-	driver_data = (struct palmas_driver_data *)match->data;
+	driver_data = (struct palmas_driver_data *) device_get_match_data(&i2c->dev);
 	palmas->features = *driver_data->features;
 
 	for (i = 0; i < PALMAS_NUM_CLIENTS; i++) {
Signature · 1 line
2.25.1