Re: [PATCH v3 2/3] iio: adc: Add ti-ads1110 support to ti-ads1100 driver

From: Jonathan Cameron

Date: Sun Jun 14 2026 - 10:49:19 EST


On Sat, 13 Jun 2026 21:09:56 +0200
Jakub Szczudlo <jakubszczudlo40@xxxxxxxxx> wrote:

> Add ADS1110 support that have faster datarate than ADS1100, it also uses
> internal voltage reference of 2.048V for measurement.
>
> Signed-off-by: Jakub Szczudlo <jakubszczudlo40@xxxxxxxxx>
Hi Jakub

A few minor things spotted on a fresh read,

Thanks,

Jonathan
> diff --git a/drivers/iio/adc/ti-ads1100.c b/drivers/iio/adc/ti-ads1100.c
> index aa8946063c7d..76de2466dc53 100644
> --- a/drivers/iio/adc/ti-ads1100.c
> +++ b/drivers/iio/adc/ti-ads1100.c

> static int ads1100_data_bits(struct ads1100_data *data)
> {
> return ads1100_data_rate_bits[FIELD_GET(ADS1100_DR_MASK, data->config)];
> @@ -107,9 +145,9 @@ static int ads1100_get_adc_result(struct ads1100_data *data, int chan, int *val)
>
> pm_runtime_put_autosuspend(&data->client->dev);
>
> - if (ret < 0) {
> + if (ret < 2) {

If ret < 0 we don't want to eat the error value. So normally these have some dance
like
if (ret < 0) {
dev_err(&data->client->dev, "I2C read fail: %d\n", ret);
return ret;
} else if (reg < 2) {
dev_err(&data->client->dev, "Short I2C read\n");
return -EIO;
}

> dev_err(&data->client->dev, "I2C read fail: %d\n", ret);
> - return ret;
> + return -EIO;
> }

...

> @@ -338,6 +371,12 @@ static int ads1100_probe(struct i2c_client *client)
> if (ret)
> return ret;
>
> + model = device_get_match_data(dev);
> + if (!model)
> + return dev_err_probe(dev, -EINVAL,
> + "Can't get device data from firmware\n");
> +
> + data->ads_config = (struct ads1100_config *)model;

Why is the cast needed? If you find yourself casting away a const
it normally implies there should be a const somewhere else.
In this case I think the pointer in the structure should simply be const.

> ret = ads1100_setup(data);
> if (ret)
> return dev_err_probe(dev, ret,