staging:iio: Do not use bitmasks for channel info addresses
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 26 Oct 2011 16:41:35 +0000 (17:41 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 27 Nov 2011 00:35:04 +0000 (16:35 -0800)
Currently the iio framework uses bitmasks for the address field of channel info
attributes. This is for historical reasons and no longer required since it will
only ever query a single info attribute at once. This patch changes the code to
use the non-shifted iio_chan_info_enum values for the info attribute address.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
38 files changed:
drivers/staging/iio/accel/adis16201_core.c
drivers/staging/iio/accel/adis16203_core.c
drivers/staging/iio/accel/adis16204_core.c
drivers/staging/iio/accel/adis16209_core.c
drivers/staging/iio/accel/adis16220_core.c
drivers/staging/iio/accel/adis16240_core.c
drivers/staging/iio/accel/kxsd9.c
drivers/staging/iio/accel/lis3l02dq_core.c
drivers/staging/iio/accel/sca3000_core.c
drivers/staging/iio/adc/ad7192.c
drivers/staging/iio/adc/ad7280a.c
drivers/staging/iio/adc/ad7291.c
drivers/staging/iio/adc/ad7298_core.c
drivers/staging/iio/adc/ad7476_core.c
drivers/staging/iio/adc/ad7606_core.c
drivers/staging/iio/adc/ad7780.c
drivers/staging/iio/adc/ad7793.c
drivers/staging/iio/adc/ad7887_core.c
drivers/staging/iio/adc/ad799x_core.c
drivers/staging/iio/adc/max1363_core.c
drivers/staging/iio/cdc/ad7150.c
drivers/staging/iio/cdc/ad7152.c
drivers/staging/iio/cdc/ad7746.c
drivers/staging/iio/dac/ad5064.c
drivers/staging/iio/dac/ad5360.c
drivers/staging/iio/dac/ad5686.c
drivers/staging/iio/dac/ad5791.c
drivers/staging/iio/gyro/adis16060_core.c
drivers/staging/iio/gyro/adis16260_core.c
drivers/staging/iio/gyro/adxrs450_core.c
drivers/staging/iio/iio.h
drivers/staging/iio/iio_simple_dummy.c
drivers/staging/iio/imu/adis16400_core.c
drivers/staging/iio/industrialio-core.c
drivers/staging/iio/light/isl29018.c
drivers/staging/iio/light/tsl2563.c
drivers/staging/iio/magnetometer/ak8975.c
drivers/staging/iio/magnetometer/hmc5843.c

index 1283519317565ff18572aba9aaf8eca668f01b6d..f1c06027a422a8e4412a91e2751a989a22535723 100644 (file)
@@ -322,8 +322,8 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
                *val = val16;
                mutex_unlock(&indio_dev->mlock);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
+       case IIO_CHAN_INFO_SCALE_SHARED:
                switch (chan->type) {
                case IIO_VOLTAGE:
                        *val = 0;
@@ -348,10 +348,10 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
                        return -EINVAL;
                }
                break;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                *val = 25;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                switch (chan->type) {
                case IIO_ACCEL:
                        bits = 12;
@@ -388,7 +388,7 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
        s16 val16;
        u8 addr;
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                switch (chan->type) {
                case IIO_ACCEL:
                        bits = 12;
index 5483b59aea32b04e8d725df6bdf769dbadc2f4b8..5bf944b9ae88416399c4f1b1c48078ff3d5eee32 100644 (file)
@@ -329,8 +329,8 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
                *val = val16;
                mutex_unlock(&indio_dev->mlock);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
+       case IIO_CHAN_INFO_SCALE_SHARED:
                switch (chan->type) {
                case IIO_VOLTAGE:
                        *val = 0;
@@ -350,10 +350,10 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
                default:
                        return -EINVAL;
                }
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                *val = 25;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                bits = 14;
                mutex_lock(&indio_dev->mlock);
                addr = adis16203_addresses[chan->address][1];
index 462f215f8c8d3e864c8db79ebf738fe79db5e754..068f543c938f9fd569c9c4d38a1ad38636642c69 100644 (file)
@@ -366,7 +366,7 @@ static int adis16204_read_raw(struct iio_dev *indio_dev,
                *val = val16;
                mutex_unlock(&indio_dev->mlock);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                switch (chan->type) {
                case IIO_VOLTAGE:
                        *val = 0;
@@ -390,12 +390,12 @@ static int adis16204_read_raw(struct iio_dev *indio_dev,
                        return -EINVAL;
                }
                break;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                *val = 25;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
-       case (1 << IIO_CHAN_INFO_PEAK_SEPARATE):
-               if (mask == (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE)) {
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
+       case IIO_CHAN_INFO_PEAK_SEPARATE:
+               if (mask == IIO_CHAN_INFO_CALIBBIAS_SEPARATE) {
                        bits = 12;
                        addrind = 1;
                } else { /* PEAK_SEPARATE */
@@ -428,7 +428,7 @@ static int adis16204_write_raw(struct iio_dev *indio_dev,
        s16 val16;
        u8 addr;
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                switch (chan->type) {
                case IIO_ACCEL:
                        bits = 12;
index 827499f70af6f198955339cbba414d87344769b3..57540f1058a0b292e13592dc6467bb68f8c21366 100644 (file)
@@ -304,7 +304,7 @@ static int adis16209_write_raw(struct iio_dev *indio_dev,
        s16 val16;
        u8 addr;
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                switch (chan->type) {
                case IIO_ACCEL:
                case IIO_INCLI:
@@ -355,8 +355,8 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
                *val = val16;
                mutex_unlock(&indio_dev->mlock);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
+       case IIO_CHAN_INFO_SCALE_SHARED:
                switch (chan->type) {
                case IIO_VOLTAGE:
                        *val = 0;
@@ -381,10 +381,10 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
                        return -EINVAL;
                }
                break;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                *val = 25;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                switch (chan->type) {
                case IIO_ACCEL:
                        bits = 14;
index 6d4503de192d0da88fe918fd753367bfd5a7b5dd..284f81078d46d698edcbcc459fdbb4ba5820114f 100644 (file)
@@ -510,17 +510,17 @@ static int adis16220_read_raw(struct iio_dev *indio_dev,
        case 0:
                addrind = 0;
                break;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                if (chan->type == IIO_TEMP) {
                        *val = 25;
                        return IIO_VAL_INT;
                }
                addrind = 1;
                break;
-       case (1 << IIO_CHAN_INFO_PEAK_SEPARATE):
+       case IIO_CHAN_INFO_PEAK_SEPARATE:
                addrind = 2;
                break;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                *val = 0;
                switch (chan->type) {
                case IIO_TEMP:
index 8123fe3bd22746933f52819df0a8320a4a299969..482a762ef1b3e78d8250f281f60dbb19db7116ad 100644 (file)
@@ -389,8 +389,8 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,
                *val = val16;
                mutex_unlock(&indio_dev->mlock);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
+       case IIO_CHAN_INFO_SCALE_SHARED:
                switch (chan->type) {
                case IIO_VOLTAGE:
                        *val = 0;
@@ -411,14 +411,14 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,
                        return -EINVAL;
                }
                break;
-       case (1 << IIO_CHAN_INFO_PEAK_SCALE_SHARED):
+       case IIO_CHAN_INFO_PEAK_SCALE_SHARED:
                *val = 6;
                *val2 = 629295;
                return IIO_VAL_INT_PLUS_MICRO;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                *val = 25;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                bits = 10;
                mutex_lock(&indio_dev->mlock);
                addr = adis16240_addresses[chan->address][1];
@@ -432,7 +432,7 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,
                *val = val16;
                mutex_unlock(&indio_dev->mlock);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_PEAK_SEPARATE):
+       case IIO_CHAN_INFO_PEAK_SEPARATE:
                bits = 10;
                mutex_lock(&indio_dev->mlock);
                addr = adis16240_addresses[chan->address][2];
@@ -460,7 +460,7 @@ static int adis16240_write_raw(struct iio_dev *indio_dev,
        s16 val16;
        u8 addr;
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                val16 = val & ((1 << bits) - 1);
                addr = adis16240_addresses[chan->address][1];
                return adis16240_spi_write_reg_16(indio_dev, addr, val16);
index 5238503f68059c440d82ce05d6578c87758ebf58..0ea0b5ccd5934e10d5c49aa932cd1ffc19b3358f 100644 (file)
@@ -140,7 +140,7 @@ static int kxsd9_write_raw(struct iio_dev *indio_dev,
 {
        int ret = -EINVAL;
 
-       if (mask == (1 << IIO_CHAN_INFO_SCALE_SHARED)) {
+       if (mask == IIO_CHAN_INFO_SCALE_SHARED) {
                /* Check no integer component */
                if (val)
                        return -EINVAL;
@@ -164,7 +164,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev,
                        goto error_ret;
                *val = ret;
                break;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
                if (ret)
                        goto error_ret;
index 358a9f6cbb0afa8afb4eb980be642d425f1862e9..d7706ebe8090eb23657311f71f946b477ef06700 100644 (file)
@@ -227,14 +227,14 @@ static int lis3l02dq_write_raw(struct iio_dev *indio_dev,
        u8 uval;
        s8 sval;
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                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 (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                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 (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                *val = 0;
                *val2 = 9580;
                return IIO_VAL_INT_PLUS_MICRO;
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                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 (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                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 */
index 8a46983275bc6106353c45d68e86d59080888597..1586963f56539b3c0be3b3172436dbdc1e1cb176 100644 (file)
@@ -475,7 +475,7 @@ static int sca3000_read_raw(struct iio_dev *indio_dev,
                        (sizeof(*val)*8 - 13);
                mutex_unlock(&st->lock);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                *val = 0;
                if (chan->type == IIO_ACCEL)
                        *val2 = st->info->scale;
index 39ba05db2c0279bbf3163bec84268ec8023a28b8..9416cedcddcb81f8787e5e700afbae25c6cedd2e 100644 (file)
@@ -901,7 +901,7 @@ static int ad7192_read_raw(struct iio_dev *indio_dev,
                }
                return IIO_VAL_INT;
 
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                mutex_lock(&indio_dev->mlock);
                *val = st->scale_avail[AD7192_CONF_GAIN(st->conf)][0];
                *val2 = st->scale_avail[AD7192_CONF_GAIN(st->conf)][1];
@@ -909,7 +909,7 @@ static int ad7192_read_raw(struct iio_dev *indio_dev,
 
                return IIO_VAL_INT_PLUS_NANO;
 
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                *val =  1000;
 
                return IIO_VAL_INT;
@@ -935,7 +935,7 @@ static int ad7192_write_raw(struct iio_dev *indio_dev,
        }
 
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                ret = -EINVAL;
                for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++)
                        if (val2 == st->scale_avail[i][1]) {
index 8f4fac1ce7ae685b2a97f6c24a333ea771942c69..7fb60c5a80e5b6dc7c47c384a8b1c2939d749e82 100644 (file)
@@ -803,7 +803,7 @@ static int ad7280_read_raw(struct iio_dev *indio_dev,
                *val = ret;
 
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                if ((chan->address & 0xFF) <= AD7280A_CELL_VOLTAGE_6)
                        scale_uv = (4000 * 1000) >> AD7280A_BITS;
                else
index e5f352bc4368c5afe82250db22c1bf7e71769ff4..bedd91ad3fdbc0becfc67e864ee4ac169571c23a 100644 (file)
@@ -501,7 +501,7 @@ static int ad7291_read_raw(struct iio_dev *indio_dev,
                default:
                        return -EINVAL;
                }
-       case (1 << IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE):
+       case IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE:
                ret = i2c_smbus_read_word_data(chip->client,
                                               AD7291_T_AVERAGE);
                        if (ret < 0)
@@ -510,12 +510,12 @@ static int ad7291_read_raw(struct iio_dev *indio_dev,
                                AD7291_VALUE_MASK) << 4) >> 4;
                        *val = signval;
                        return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                scale_uv = (chip->int_vref_mv * 1000) >> AD7291_BITS;
                *val =  scale_uv / 1000;
                *val2 = (scale_uv % 1000) * 1000;
                return IIO_VAL_INT_PLUS_MICRO;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                /*
                * One LSB of the ADC corresponds to 0.25 deg C.
                * The temperature reading is in 12-bit twos complement format
index 445b07116d74bfc1debada27d08c41127a5b2d12..2e3b0d979fc5019b78612d692a0f27f327440c04 100644 (file)
@@ -143,12 +143,12 @@ static int ad7298_read_raw(struct iio_dev *indio_dev,
                        *val = ret & RES_MASK(AD7298_BITS);
 
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                scale_uv = (st->int_vref_mv * 1000) >> AD7298_BITS;
                *val =  scale_uv / 1000;
                *val2 = (scale_uv % 1000) * 1000;
                return IIO_VAL_INT_PLUS_MICRO;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                *val =  1;
                *val2 = 0;
                return IIO_VAL_INT_PLUS_MICRO;
index 13473133bbe2fa827e99ee2abf05e486a5b6def3..163a2547a6f61f8755751ccf1deb7ceb4ba29c8f 100644 (file)
@@ -56,7 +56,7 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
                *val = (ret >> st->chip_info->channel[0].scan_type.shift) &
                        RES_MASK(st->chip_info->channel[0].scan_type.realbits);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                scale_uv = (st->int_vref_mv * 1000)
                        >> st->chip_info->channel[0].scan_type.realbits;
                *val =  scale_uv/1000;
index 53174831663c394f64ac1fbcd220ee1bf42d0024..d58a0e3eee9349ca3b09d2e34bf48673877280b6 100644 (file)
@@ -100,7 +100,7 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
                        return ret;
                *val = (short) ret;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                scale_uv = (st->range * 1000 * 2)
                        >> st->chip_info->channels[0].scan_type.realbits;
                *val =  scale_uv / 1000;
index 7a579a1fd696e9427e57218a4bf61c83eba8f78b..b06f9ad48b9a05a4f60219ed5616afbf2c9396ac 100644 (file)
@@ -114,7 +114,7 @@ static int ad7780_read_raw(struct iio_dev *indio_dev,
                        *val *= 128;
 
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                scale_uv = (st->int_vref_mv * 100000)
                        >> (channel.scan_type.realbits - 1);
                *val =  scale_uv / 100000;
index 17fde6669eff241378f0e45e45184acd66fff997..c3fdfedfc994d3976e9ad2f7df3e2407ab89666f 100644 (file)
@@ -667,13 +667,13 @@ static int ad7793_read_raw(struct iio_dev *indio_dev,
 
                return IIO_VAL_INT;
 
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                *val = st->scale_avail[(st->conf >> 8) & 0x7][0];
                *val2 = st->scale_avail[(st->conf >> 8) & 0x7][1];
 
                return IIO_VAL_INT_PLUS_NANO;
 
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                switch (chan->type) {
                case IIO_VOLTAGE:
                        /* 1170mV / 2^23 * 6 */
@@ -716,7 +716,7 @@ static int ad7793_write_raw(struct iio_dev *indio_dev,
        }
 
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                ret = -EINVAL;
                for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++)
                        if (val2 == st->scale_avail[i][1]) {
index a7baa9bb0eaa0bfdaa0255545a89798852f1f419..245c9438359b9c0b030844859fef1d9e7ec4fcc2 100644 (file)
@@ -55,7 +55,7 @@ static int ad7887_read_raw(struct iio_dev *indio_dev,
                *val = (ret >> st->chip_info->channel[0].scan_type.shift) &
                        RES_MASK(st->chip_info->channel[0].scan_type.realbits);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                scale_uv = (st->int_vref_mv * 1000)
                        >> st->chip_info->channel[0].scan_type.realbits;
                *val =  scale_uv/1000;
index 64ac31666739ab7e8a61e8d3813199d4c6155009..60a48a284dd10531490619551c3c69f257e6d700 100644 (file)
@@ -162,7 +162,7 @@ static int ad799x_read_raw(struct iio_dev *indio_dev,
                *val = (ret >> chan->scan_type.shift) &
                        RES_MASK(chan->scan_type.realbits);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                scale_uv = (st->int_vref_mv * 1000) >> chan->scan_type.realbits;
                *val =  scale_uv / 1000;
                *val2 = (scale_uv % 1000) * 1000;
index 73b209f23c73f8e9f50840781706a1fb3e900ef4..6b05e573afc7298e8ded6a66deb3039e173a37a3 100644 (file)
@@ -261,7 +261,7 @@ static int max1363_read_raw(struct iio_dev *indio_dev,
                if (ret < 0)
                        return ret;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                if ((1 << (st->chip_info->bits + 1)) >
                    st->chip_info->int_vref_mv) {
                        *val = 0;
index abe65096c11040e69475825f509d4919521c5312..10737fae25e13118fd7d6df92f7a6b3c1951f9d3 100644 (file)
@@ -111,7 +111,7 @@ static int ad7150_read_raw(struct iio_dev *indio_dev,
                        return ret;
                *val = swab16(ret);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE):
+       case IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE:
                ret = i2c_smbus_read_word_data(chip->client,
                                        ad7150_addresses[chan->channel][1]);
                if (ret < 0)
index 662584d72a74d7339e1bae66b4af1820da649663..e5ca683a7af07ef9fdfa7b7f523fcb4f21e2610a 100644 (file)
@@ -259,7 +259,7 @@ static int ad7152_write_raw(struct iio_dev *indio_dev,
        mutex_lock(&indio_dev->mlock);
 
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                if (val != 1) {
                        ret = -EINVAL;
                        goto out;
@@ -276,7 +276,7 @@ static int ad7152_write_raw(struct iio_dev *indio_dev,
                ret = 0;
                break;
 
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                if ((val < 0) | (val > 0xFFFF)) {
                        ret = -EINVAL;
                        goto out;
@@ -289,7 +289,7 @@ static int ad7152_write_raw(struct iio_dev *indio_dev,
 
                ret = 0;
                break;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                if (val != 0) {
                        ret = -EINVAL;
                        goto out;
@@ -372,7 +372,7 @@ static int ad7152_read_raw(struct iio_dev *indio_dev,
 
                ret = IIO_VAL_INT;
                break;
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
 
                ret = i2c_smbus_read_word_data(chip->client,
                                ad7152_addresses[chan->channel][AD7152_GAIN]);
@@ -384,7 +384,7 @@ static int ad7152_read_raw(struct iio_dev *indio_dev,
 
                ret = IIO_VAL_INT_PLUS_MICRO;
                break;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                ret = i2c_smbus_read_word_data(chip->client,
                                ad7152_addresses[chan->channel][AD7152_OFFS]);
                if (ret < 0)
@@ -393,7 +393,7 @@ static int ad7152_read_raw(struct iio_dev *indio_dev,
 
                ret = IIO_VAL_INT;
                break;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                ret = i2c_smbus_read_byte_data(chip->client,
                                ad7152_addresses[chan->channel][AD7152_SETUP]);
                if (ret < 0)
@@ -416,7 +416,7 @@ static int ad7152_write_raw_get_fmt(struct iio_dev *indio_dev,
                               long mask)
 {
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                return IIO_VAL_INT_PLUS_NANO;
        default:
                return IIO_VAL_INT_PLUS_MICRO;
index 2867943309cc9145f3c36adccfe3c79a31d9a5eb..5deaf857d23cf2342823afa0abf09b0c11515f3c 100644 (file)
@@ -477,7 +477,7 @@ static int ad7746_write_raw(struct iio_dev *indio_dev,
        mutex_lock(&indio_dev->mlock);
 
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                if (val != 1) {
                        ret = -EINVAL;
                        goto out;
@@ -503,7 +503,7 @@ static int ad7746_write_raw(struct iio_dev *indio_dev,
 
                ret = 0;
                break;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SHARED):
+       case IIO_CHAN_INFO_CALIBBIAS_SHARED:
                if ((val < 0) | (val > 0xFFFF)) {
                        ret = -EINVAL;
                        goto out;
@@ -515,7 +515,7 @@ static int ad7746_write_raw(struct iio_dev *indio_dev,
 
                ret = 0;
                break;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                if ((val < 0) | (val > 43008000)) { /* 21pF */
                        ret = -EINVAL;
                        goto out;
@@ -612,7 +612,7 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
 
                ret = IIO_VAL_INT;
                break;
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                switch (chan->type) {
                case IIO_CAPACITANCE:
                        reg = AD7746_REG_CAP_GAINH;
@@ -634,7 +634,7 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
 
                ret = IIO_VAL_INT_PLUS_MICRO;
                break;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SHARED):
+       case IIO_CHAN_INFO_CALIBBIAS_SHARED:
                ret = i2c_smbus_read_word_data(chip->client,
                                               AD7746_REG_CAP_OFFH);
                if (ret < 0)
@@ -643,13 +643,13 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
 
                ret = IIO_VAL_INT;
                break;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                *val = AD7746_CAPDAC_DACP(chip->capdac[chan->channel]
                        [chan->differential]) * 338646;
 
                ret = IIO_VAL_INT;
                break;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                switch (chan->type) {
                case IIO_CAPACITANCE:
                        /* 8.192pf / 2^24 */
index 24279f2ae41f65dadefae5ee69a2d940d42a2140..1c25403620ff409cbed838444ccf3e66888fdeec 100644 (file)
@@ -287,7 +287,7 @@ static int ad5064_read_raw(struct iio_dev *indio_dev,
        case 0:
                *val = st->dac_cache[chan->channel];
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                vref = st->chip_info->shared_vref ? 0 : chan->channel;
                scale_uv = regulator_get_voltage(st->vref_reg[vref].consumer);
                if (scale_uv < 0)
index 72d0f3f0d6ae74e90a0d591ece7fb90a8c781b61..7df19586d1823c2df7a9208bc83acd8ffdae4dec 100644 (file)
@@ -326,21 +326,21 @@ static int ad5360_write_raw(struct iio_dev *indio_dev,
                return ad5360_write(indio_dev, AD5360_CMD_WRITE_DATA,
                                 chan->address, val, chan->scan_type.shift);
 
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                if (val >= max_val || val < 0)
                        return -EINVAL;
 
                return ad5360_write(indio_dev, AD5360_CMD_WRITE_OFFSET,
                                 chan->address, val, chan->scan_type.shift);
 
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                if (val >= max_val || val < 0)
                        return -EINVAL;
 
                return ad5360_write(indio_dev, AD5360_CMD_WRITE_GAIN,
                                 chan->address, val, chan->scan_type.shift);
 
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                if (val <= -max_val || val > 0)
                        return -EINVAL;
 
@@ -383,7 +383,7 @@ static int ad5360_read_raw(struct iio_dev *indio_dev,
                        return ret;
                *val = ret >> chan->scan_type.shift;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                /* vout = 4 * vref * dac_code */
                scale_uv = ad5360_get_channel_vref(st, chan->channel) * 4 * 100;
                if (scale_uv < 0)
@@ -393,21 +393,21 @@ static int ad5360_read_raw(struct iio_dev *indio_dev,
                *val =  scale_uv / 100000;
                *val2 = (scale_uv % 100000) * 10;
                return IIO_VAL_INT_PLUS_MICRO;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                ret = ad5360_read(indio_dev, AD5360_READBACK_OFFSET,
                        chan->address);
                if (ret < 0)
                        return ret;
                *val = ret;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                ret = ad5360_read(indio_dev, AD5360_READBACK_GAIN,
                        chan->address);
                if (ret < 0)
                        return ret;
                *val = ret;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                ofs_index = ad5360_get_channel_vref_index(st, chan->channel);
                ret = ad5360_read(indio_dev, AD5360_READBACK_SF,
                        AD5360_REG_SF_OFS(ofs_index));
index 974c6f5b60c4bd9758381035f4c3ebe42ffd87cd..f2332b3f24a71456217fbceb43d71bdddb960e5d 100644 (file)
@@ -306,7 +306,7 @@ static int ad5686_read_raw(struct iio_dev *indio_dev,
                *val = ret;
                return IIO_VAL_INT;
                break;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                scale_uv = (st->vref_mv * 100000)
                        >> (chan->scan_type.realbits);
                *val =  scale_uv / 100000;
index 6fbca8d961538fcb6ea5ce81886a2a0acf7670d6..d3b3b71c87c1867f13bd6804f6a5ca11a649b74d 100644 (file)
@@ -237,11 +237,11 @@ static int ad5791_read_raw(struct iio_dev *indio_dev,
                *val &= AD5791_DAC_MASK;
                *val >>= chan->scan_type.shift;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                *val = 0;
                *val2 = (((u64)st->vref_mv) * 1000000ULL) >> chan->scan_type.realbits;
                return IIO_VAL_INT_PLUS_MICRO;
-       case (1 << IIO_CHAN_INFO_OFFSET_SHARED):
+       case IIO_CHAN_INFO_OFFSET_SHARED:
                val64 = (((u64)st->vref_neg_mv) << chan->scan_type.realbits);
                do_div(val64, st->vref_mv);
                *val = -val64;
index ff1b5a82b3d62d022ccb2cb13b0a941dcaabee0c..d83c640f4e6bf92dad311a51645ed6a440674488 100644 (file)
@@ -98,11 +98,11 @@ static int adis16060_read_raw(struct iio_dev *indio_dev,
                mutex_unlock(&indio_dev->mlock);
                *val = tval;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                *val = -7;
                *val2 = 461117;
                return IIO_VAL_INT_PLUS_MICRO;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                *val = 0;
                *val2 = 34000;
                return IIO_VAL_INT_PLUS_MICRO;
index 40da95554fa2cff9d4724d029ad02aceaafc8d3a..4f5a7cb3f7e9896abe947c7c283b6f4b2bb77710 100644 (file)
@@ -464,8 +464,8 @@ static int adis16260_read_raw(struct iio_dev *indio_dev,
                *val = val16;
                mutex_unlock(&indio_dev->mlock);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
+       case IIO_CHAN_INFO_SCALE_SHARED:
                switch (chan->type) {
                case IIO_ANGL_VEL:
                        *val = 0;
@@ -489,10 +489,10 @@ static int adis16260_read_raw(struct iio_dev *indio_dev,
                        return -EINVAL;
                }
                break;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                *val = 25;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                switch (chan->type) {
                case IIO_ANGL_VEL:
                        bits = 12;
@@ -512,7 +512,7 @@ static int adis16260_read_raw(struct iio_dev *indio_dev,
                *val = val16;
                mutex_unlock(&indio_dev->mlock);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                switch (chan->type) {
                case IIO_ANGL_VEL:
                        bits = 12;
@@ -544,11 +544,11 @@ static int adis16260_write_raw(struct iio_dev *indio_dev,
        s16 val16;
        u8 addr;
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                val16 = val & ((1 << bits) - 1);
                addr = adis16260_addresses[chan->address][1];
                return adis16260_spi_write_reg_16(indio_dev, addr, val16);
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                val16 = val & ((1 << bits) - 1);
                addr = adis16260_addresses[chan->address][2];
                return adis16260_spi_write_reg_16(indio_dev, addr, val16);
index 3c3ef796d48e6085b4c8499543e9d7c707db2502..18406c7f960f61ed38fbacd22a6b4057ea919720 100644 (file)
@@ -243,7 +243,7 @@ static int adxrs450_write_raw(struct iio_dev *indio_dev,
 {
        int ret;
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                ret = adxrs450_spi_write_reg_16(indio_dev,
                                                ADXRS450_DNC1,
                                                val & 0x3FF);
@@ -287,7 +287,7 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev,
                        break;
                }
                break;
-       case (1 << IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE):
+       case IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE:
                ret = adxrs450_spi_read_reg_16(indio_dev, ADXRS450_QUAD1, &t);
                if (ret)
                        break;
index cf95f74dc9db047a98718fb5016c5645af98391c..4fb4cc42399b6e9e441f8339c02d0d4e5d9e5465 100644 (file)
@@ -26,7 +26,8 @@ enum iio_data_type {
 
 /* Could add the raw attributes as well - allowing buffer only devices */
 enum iio_chan_info_enum {
-       IIO_CHAN_INFO_SCALE_SHARED,
+       /* 0 is reserverd for raw attributes */
+       IIO_CHAN_INFO_SCALE_SHARED = 2,
        IIO_CHAN_INFO_SCALE_SEPARATE,
        IIO_CHAN_INFO_OFFSET_SHARED,
        IIO_CHAN_INFO_OFFSET_SEPARATE,
index 06c022e20943ae734e243b84da08fc5b6880fe6e..2196ff19f7b49922be224273eeda991270a25460 100644 (file)
@@ -229,29 +229,29 @@ static int iio_dummy_read_raw(struct iio_dev *indio_dev,
                        break;
                }
                break;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                /* only single ended adc -> 7 */
                *val = 7;
                ret = IIO_VAL_INT;
                break;
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                /* only single ended adc -> 0.001333 */
                *val = 0;
                *val2 = 1333;
                ret = IIO_VAL_INT_PLUS_MICRO;
                break;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                /* all differential adc channels -> 0.000001344 */
                *val = 0;
                *val2 = 1344;
                ret = IIO_VAL_INT_PLUS_NANO;
                break;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                /* only the acceleration axis - read from cache */
                *val = st->accel_calibbias;
                ret = IIO_VAL_INT;
                break;
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                *val = st->accel_calibscale->val;
                *val2 = st->accel_calibscale->val2;
                ret = IIO_VAL_INT_PLUS_MICRO;
@@ -296,7 +296,7 @@ static int iio_dummy_write_raw(struct iio_dev *indio_dev,
                st->dac_val = val;
                mutex_unlock(&st->lock);
                return 0;
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                mutex_lock(&st->lock);
                /* Compare against table - hard matching here */
                for (i = 0; i < ARRAY_SIZE(dummy_scales); i++)
index e6df4921b55b24174b3c9f256d1fa664c583d8a9..0018272625c34e7d75dd43ebacebcd04a9ac5288 100644 (file)
@@ -464,7 +464,7 @@ static int adis16400_write_raw(struct iio_dev *indio_dev,
        int ret;
 
        switch (mask) {
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                mutex_lock(&indio_dev->mlock);
                ret = adis16400_spi_write_reg_16(indio_dev,
                                adis16400_addresses[chan->address][1],
@@ -504,8 +504,8 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
                *val = val16;
                mutex_unlock(&indio_dev->mlock);
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SHARED:
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                switch (chan->type) {
                case IIO_ANGL_VEL:
                        *val = 0;
@@ -533,7 +533,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
                default:
                        return -EINVAL;
                }
-       case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
+       case IIO_CHAN_INFO_CALIBBIAS_SEPARATE:
                mutex_lock(&indio_dev->mlock);
                ret = adis16400_spi_read_reg_16(indio_dev,
                                adis16400_addresses[chan->address][1],
@@ -544,7 +544,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
                val16 = ((val16 & 0xFFF) << 4) >> 4;
                *val = val16;
                return IIO_VAL_INT;
-       case (1 << IIO_CHAN_INFO_OFFSET_SEPARATE):
+       case IIO_CHAN_INFO_OFFSET_SEPARATE:
                /* currently only temperature */
                *val = 198;
                *val2 = 160000;
index 1c53b9acae81029dd7b9c14d14ee17baae84e1be..63681a61d5ca8fc05ea44e6321fe2b986a4fb0b7 100644 (file)
@@ -603,7 +603,7 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
                                             chan,
                                             &iio_read_channel_info,
                                             &iio_write_channel_info,
-                                            (1 << i),
+                                            i,
                                             !(i%2),
                                             &indio_dev->dev,
                                             &indio_dev->channel_attr_list);
index 9dc9e6358394e73a727937556c5b99b84b92d48d..bed18a74d30cc9247c8c0b7f178d33ff3efd5ab6 100644 (file)
@@ -362,7 +362,7 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
        int ret = -EINVAL;
 
        mutex_lock(&chip->lock);
-       if (mask == (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE) &&
+       if (mask == IIO_CHAN_INFO_CALIBSCALE_SEPARATE &&
            chan->type == IIO_LIGHT) {
                chip->lux_scale = val;
                ret = 0;
@@ -402,7 +402,7 @@ static int isl29018_read_raw(struct iio_dev *indio_dev,
                if (!ret)
                        ret = IIO_VAL_INT;
                break;
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                if (chan->type == IIO_LIGHT) {
                        *val = chip->lux_scale;
                        ret = IIO_VAL_INT;
index 32dfce0a644fcd37628aae60bad106cb2c8484a6..45d04a1b19403fcd7b8589370426ea9758cc16f4 100644 (file)
@@ -513,7 +513,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
                }
                break;
 
-       case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+       case IIO_CHAN_INFO_CALIBSCALE_SEPARATE:
                if (chan->channel == 0)
                        *val = calib_to_sysfs(chip->calib0);
                else
index 8b017127fd4d983fd392b702d10383935126f549..b7d8cbb58c37f4af5c0766a4c6a9981cb31cbb10 100644 (file)
@@ -431,7 +431,7 @@ static int ak8975_read_raw(struct iio_dev *indio_dev,
        switch (mask) {
        case 0:
                return ak8975_read_axis(indio_dev, chan->address, val);
-       case (1 << IIO_CHAN_INFO_SCALE_SEPARATE):
+       case IIO_CHAN_INFO_SCALE_SEPARATE:
                *val = data->raw_to_gauss[chan->address];
                return IIO_VAL_INT;
        }
index fc9ee970888d08886f6baf350c2928b090b15fc6..4a42707a20efab9ec85edd8f44771668a876f945 100644 (file)
@@ -463,7 +463,7 @@ static int hmc5843_read_raw(struct iio_dev *indio_dev,
                return hmc5843_read_measurement(indio_dev,
                                                chan->address,
                                                val);
-       case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+       case IIO_CHAN_INFO_SCALE_SHARED:
                *val = 0;
                *val2 = hmc5843_regval_to_nanoscale[data->range];
                return IIO_VAL_INT_PLUS_NANO;