iio: adc: ltc2497: Simplify probe()
authorBiju Das <biju.das.jz@bp.renesas.com>
Sat, 2 Sep 2023 17:05:29 +0000 (18:05 +0100)
committerJonathan Cameron <jonathan.cameron@huawei.com>
Tue, 12 Sep 2023 09:42:04 +0000 (10:42 +0100)
Simpilfy probe() by replacing device_get_match_data() and id lookup for
retrieving match data by using i2c_get_match_data().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230902170529.62297-1-biju.das.jz@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ltc2497.c

index 5bdd4072961158370798f2febc957215489abd78..6401a7727c31a512ca84f95657e9da480a111af3 100644 (file)
@@ -95,7 +95,6 @@ static int ltc2497_result_and_measure(struct ltc2497core_driverdata *ddata,
 
 static int ltc2497_probe(struct i2c_client *client)
 {
-       const struct i2c_device_id *id = i2c_client_get_device_id(client);
        const struct ltc2497_chip_info *chip_info;
        struct iio_dev *indio_dev;
        struct ltc2497_driverdata *st;
@@ -115,9 +114,7 @@ static int ltc2497_probe(struct i2c_client *client)
        st->client = client;
        st->common_ddata.result_and_measure = ltc2497_result_and_measure;
 
-       chip_info = device_get_match_data(dev);
-       if (!chip_info)
-               chip_info = (const struct ltc2497_chip_info *)id->driver_data;
+       chip_info = i2c_get_match_data(client);
        st->common_ddata.chip_info = chip_info;
 
        resolution = chip_info->resolution;