Commit 6c70012d authored by Biju Das's avatar Biju Das Committed by Jonathan Cameron

iio: adc: ltc2497: Simplify probe()

Simpilfy probe() by replacing device_get_match_data() and id lookup for
retrieving match data by using i2c_get_match_data().
Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230902170529.62297-1-biju.das.jz@bp.renesas.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent f6b17379
...@@ -95,7 +95,6 @@ static int ltc2497_result_and_measure(struct ltc2497core_driverdata *ddata, ...@@ -95,7 +95,6 @@ static int ltc2497_result_and_measure(struct ltc2497core_driverdata *ddata,
static int ltc2497_probe(struct i2c_client *client) 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; const struct ltc2497_chip_info *chip_info;
struct iio_dev *indio_dev; struct iio_dev *indio_dev;
struct ltc2497_driverdata *st; struct ltc2497_driverdata *st;
...@@ -115,9 +114,7 @@ static int ltc2497_probe(struct i2c_client *client) ...@@ -115,9 +114,7 @@ static int ltc2497_probe(struct i2c_client *client)
st->client = client; st->client = client;
st->common_ddata.result_and_measure = ltc2497_result_and_measure; st->common_ddata.result_and_measure = ltc2497_result_and_measure;
chip_info = device_get_match_data(dev); chip_info = i2c_get_match_data(client);
if (!chip_info)
chip_info = (const struct ltc2497_chip_info *)id->driver_data;
st->common_ddata.chip_info = chip_info; st->common_ddata.chip_info = chip_info;
resolution = chip_info->resolution; resolution = chip_info->resolution;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment