On Fri, Nov 22, 2024 at 1:34 PM Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx> wrote: > > If the maximal count of channels the driver supports isn't fully > utilized, add an attribute providing the internal temperature. ... > case IIO_CHAN_INFO_SCALE: > - mutex_lock(&st->cfgs_lock); > + switch (chan->type) { > + case IIO_VOLTAGE: > + mutex_lock(&st->cfgs_lock); Side note 1: cleanup.h at some point? ... > case IIO_CHAN_INFO_OFFSET: > - mutex_lock(&st->cfgs_lock); > - if (st->channels[chan->address].cfg.bipolar) > - *val = -(1 << (chan->scan_type.realbits - 1)); > - else > - *val = 0; > + switch (chan->type) { > + case IIO_VOLTAGE: > + mutex_lock(&st->cfgs_lock); > + if (st->channels[chan->address].cfg.bipolar) > + *val = -(1 << (chan->scan_type.realbits - 1)); Side note 2: BIT() ? ... > case IIO_CHAN_INFO_SAMP_FREQ: > mutex_lock(&st->cfgs_lock); > *val = st->channels[chan->address].cfg.odr; > mutex_unlock(&st->cfgs_lock); > > return IIO_VAL_INT; > + > case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: > mutex_lock(&st->cfgs_lock); > *val = ad7124_get_3db_filter_freq(st, chan->scan_index); > mutex_unlock(&st->cfgs_lock); > > return IIO_VAL_INT; > + Seems like stray / unrelated changes. Do you really want to combine this with style changing? Usually we either change style first followed by featuring, or vice versa. > default: > return -EINVAL; > } > @@ -645,6 +685,7 @@ static int ad7124_write_raw(struct iio_dev *indio_dev, > > ad7124_set_channel_odr(st, chan->address, val); > break; > + > case IIO_CHAN_INFO_SCALE: > if (val != 0) { > ret = -EINVAL; > @@ -666,6 +707,7 @@ static int ad7124_write_raw(struct iio_dev *indio_dev, > > st->channels[chan->address].cfg.pga_bits = res; > break; > + > case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: > if (val2 != 0) { > ret = -EINVAL; Ditto. ... > + /* Add one for temperature */ > + st->num_channels = min(num_channels + 1, AD7124_MAX_CHANNELS); Is the type of both arguments the same? -- With Best Regards, Andy Shevchenko