From: Krzysztof Kozlowski Date: Wed, 26 May 2021 12:47:02 +0000 (-0400) Subject: mfd: da9062: Simplify getting of_device_id match data X-Git-Tag: accepted/tizen/unified/20230118.172025~6893^2~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5783bbe9a434db870891a07cd7826944047368e5;p=platform%2Fkernel%2Flinux-rpi.git mfd: da9062: Simplify getting of_device_id match data Use of_device_get_match_data() to make the code slightly smaller. Signed-off-by: Krzysztof Kozlowski Acked-by: Adam Thomson Signed-off-by: Lee Jones --- diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c index 8d91337..01f8e10 100644 --- a/drivers/mfd/da9062-core.c +++ b/drivers/mfd/da9062-core.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -622,7 +623,6 @@ static int da9062_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct da9062 *chip; - const struct of_device_id *match; unsigned int irq_base; const struct mfd_cell *cell; const struct regmap_irq_chip *irq_chip; @@ -635,15 +635,10 @@ static int da9062_i2c_probe(struct i2c_client *i2c, if (!chip) return -ENOMEM; - if (i2c->dev.of_node) { - match = of_match_node(da9062_dt_ids, i2c->dev.of_node); - if (!match) - return -EINVAL; - - chip->chip_type = (uintptr_t)match->data; - } else { + if (i2c->dev.of_node) + chip->chip_type = (uintptr_t)of_device_get_match_data(&i2c->dev); + else chip->chip_type = id->driver_data; - } i2c_set_clientdata(i2c, chip); chip->dev = &i2c->dev;