From c8a9f8056f40f6201b84fdddb49a1c62630902c5 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Wed, 26 Oct 2011 17:41:36 +0100 Subject: staging:iio:treewide only use shared to decide on interfaces Internally the fact that say scale is shared across channels is actually of remarkably little interest. Hence lets not store it. Numerous devices have weird combinations of channels sharing scale anyway so it is not as though this was really telling us much. Note however that we do still use the shared sysfs attrs thus massively reducing the number of attrs in complex drivers. Side effect is that certain drivers that were abusing this (mostly my work) needed to do a few more checks on what the channel they are being queried on actually is. This is also helpful for in kernel interfaces where we just want to query the scale and don't care whether it is shared with other channels or not. Signed-off-by: Jonathan Cameron Acked-by: Lars-Peter Clausen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/lis3l02dq_core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging/iio/accel/lis3l02dq_core.c') diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c index d7706ebe809..6d715a6e420 100644 --- a/drivers/staging/iio/accel/lis3l02dq_core.c +++ b/drivers/staging/iio/accel/lis3l02dq_core.c @@ -227,14 +227,14 @@ static int lis3l02dq_write_raw(struct iio_dev *indio_dev, u8 uval; s8 sval; switch (mask) { - case IIO_CHAN_INFO_CALIBBIAS_SEPARATE: + case IIO_CHAN_INFO_CALIBBIAS: if (val > 255 || val < -256) return -EINVAL; sval = val; reg = lis3l02dq_axis_map[LIS3L02DQ_BIAS][chan->address]; ret = lis3l02dq_spi_write_reg_8(indio_dev, reg, sval); break; - case IIO_CHAN_INFO_CALIBSCALE_SEPARATE: + case IIO_CHAN_INFO_CALIBSCALE: if (val & ~0xFF) return -EINVAL; uval = val; @@ -272,11 +272,11 @@ static int lis3l02dq_read_raw(struct iio_dev *indio_dev, } mutex_unlock(&indio_dev->mlock); return IIO_VAL_INT; - case IIO_CHAN_INFO_SCALE_SHARED: + case IIO_CHAN_INFO_SCALE: *val = 0; *val2 = 9580; return IIO_VAL_INT_PLUS_MICRO; - case IIO_CHAN_INFO_CALIBSCALE_SEPARATE: + case IIO_CHAN_INFO_CALIBSCALE: reg = lis3l02dq_axis_map[LIS3L02DQ_GAIN][chan->address]; ret = lis3l02dq_spi_read_reg_8(indio_dev, reg, &utemp); if (ret) @@ -285,7 +285,7 @@ static int lis3l02dq_read_raw(struct iio_dev *indio_dev, *val = utemp; return IIO_VAL_INT; - case IIO_CHAN_INFO_CALIBBIAS_SEPARATE: + case IIO_CHAN_INFO_CALIBBIAS: reg = lis3l02dq_axis_map[LIS3L02DQ_BIAS][chan->address]; ret = lis3l02dq_spi_read_reg_8(indio_dev, reg, (u8 *)&stemp); /* to match with what previous code does */ @@ -516,9 +516,9 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private) } #define LIS3L02DQ_INFO_MASK \ - ((1 << IIO_CHAN_INFO_SCALE_SHARED) | \ - (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE) | \ - (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE)) + (IIO_CHAN_INFO_SCALE_SHARED_BIT | \ + IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT | \ + IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT) #define LIS3L02DQ_EVENT_MASK \ (IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) | \ -- cgit v1.2.3