On 04/10/16 09:52, Lars-Peter Clausen wrote: > On 10/03/2016 09:26 PM, Jonathan Cameron wrote: >> Given the introduction of IIO_NO_MOD was prior to the first submission >> prior to IIO entering staging this has been broken for a while. >> >> Signed-off-by: Jonathan Cameron <jic23@xxxxxxxxxx> >> --- >> drivers/staging/iio/accel/sca3000.c | 21 +++++++++++---------- >> 1 file changed, 11 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/staging/iio/accel/sca3000.c b/drivers/staging/iio/accel/sca3000.c >> index 24685a2f224e..e8f43df65142 100644 >> --- a/drivers/staging/iio/accel/sca3000.c >> +++ b/drivers/staging/iio/accel/sca3000.c >> @@ -933,16 +933,17 @@ static int sca3000_read_event_value(struct iio_dev *indio_dev, >> { >> int ret, i; >> struct sca3000_state *st = iio_priv(indio_dev); >> - int num = chan->channel2; >> + >> switch (info) { >> case IIO_EV_INFO_VALUE: >> mutex_lock(&st->lock); >> - ret = sca3000_read_ctrl_reg(st, sca3000_addresses[num][1]); >> + ret = sca3000_read_ctrl_reg(st, >> + sca3000_addresses[chan->channel2 - IIO_MOD_X][1]); > > How about using channel address? Same comment for similar cases later on. Good idea. done. > > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html