mfd: mc13xxx: Simplify device data fetching in probe()

Simplify probe() by replacing of_match_device() and ID lookup
for retrieving match data by i2c_get_match_data().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230819183155.22335-1-biju.das.jz@bp.renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
Biju Das 2023-08-19 19:31:55 +01:00 committed by Lee Jones
parent d92df6fb81
commit 9aab92bc3a

View File

@ -53,7 +53,6 @@ static const struct regmap_config mc13xxx_regmap_i2c_config = {
static int mc13xxx_i2c_probe(struct i2c_client *client) static int mc13xxx_i2c_probe(struct i2c_client *client)
{ {
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct mc13xxx *mc13xxx; struct mc13xxx *mc13xxx;
int ret; int ret;
@ -73,13 +72,7 @@ static int mc13xxx_i2c_probe(struct i2c_client *client)
return ret; return ret;
} }
if (client->dev.of_node) { mc13xxx->variant = i2c_get_match_data(client);
const struct of_device_id *of_id =
of_match_device(mc13xxx_dt_ids, &client->dev);
mc13xxx->variant = of_id->data;
} else {
mc13xxx->variant = (void *)id->driver_data;
}
return mc13xxx_common_init(&client->dev); return mc13xxx_common_init(&client->dev);
} }