Commit f6b17379 authored by Biju Das's avatar Biju Das Committed by Jonathan Cameron

iio: adc: ti-ads1015: 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/20230902163233.56449-1-biju.das.jz@bp.renesas.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 5793ddcf
...@@ -976,16 +976,13 @@ static int ads1015_set_conv_mode(struct ads1015_data *data, int mode) ...@@ -976,16 +976,13 @@ static int ads1015_set_conv_mode(struct ads1015_data *data, int mode)
static int ads1015_probe(struct i2c_client *client) static int ads1015_probe(struct i2c_client *client)
{ {
const struct i2c_device_id *id = i2c_client_get_device_id(client);
const struct ads1015_chip_data *chip; const struct ads1015_chip_data *chip;
struct iio_dev *indio_dev; struct iio_dev *indio_dev;
struct ads1015_data *data; struct ads1015_data *data;
int ret; int ret;
int i; int i;
chip = device_get_match_data(&client->dev); chip = i2c_get_match_data(client);
if (!chip)
chip = (const struct ads1015_chip_data *)id->driver_data;
if (!chip) if (!chip)
return dev_err_probe(&client->dev, -EINVAL, "Unknown chip\n"); return dev_err_probe(&client->dev, -EINVAL, "Unknown chip\n");
......
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