Simpilfy probe() by replacing device_get_match_data() and id lookup for retrieving match data by i2c_get_match_data(). Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> --- Note: * This patch is only compile tested. --- drivers/rtc/rtc-ds1307.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 506b7d1c2397..d41cbb5a1cbd 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -1714,9 +1714,7 @@ static const struct regmap_config regmap_config = { static int ds1307_probe(struct i2c_client *client) { - const struct i2c_device_id *id = i2c_client_get_device_id(client); struct ds1307 *ds1307; - const void *match; int err = -ENODEV; int tmp; const struct chip_desc *chip; @@ -1742,17 +1740,11 @@ static int ds1307_probe(struct i2c_client *client) i2c_set_clientdata(client, ds1307); - match = device_get_match_data(&client->dev); - if (match) { - ds1307->type = (uintptr_t)match; - chip = &chips[ds1307->type]; - } else if (id) { - chip = &chips[id->driver_data]; - ds1307->type = id->driver_data; - } else { + ds1307->type = (uintptr_t)i2c_get_match_data(client); + if (!ds1307->type) return -ENODEV; - } + chip = &chips[ds1307->type]; want_irq = client->irq > 0 && chip->alarm; if (!pdata) -- 2.25.1