OSDN Git Service

iio: Replace occurrences of magic number 0 by IIO_CHAN_INFO_RAW
authorRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Tue, 6 Mar 2018 12:02:57 +0000 (09:02 -0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 7 Mar 2018 20:14:36 +0000 (20:14 +0000)
Usually, functions responsible for reading raw data typically relies on
values from iio_chan_info_enum to correctly identify the type of data to
be read. There is a set of a device driver that uses the magic number 0
instead of IIO_CHAN_INFO_RAW. This patch improves the readability by
replaces the magic number 0 for the appropriate IIO_CHAN_INFO_RAW in six
devices driver in the IIO subsystem.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/hid-sensor-accel-3d.c
drivers/iio/dac/ad5380.c
drivers/iio/dac/ad5764.c
drivers/iio/gyro/hid-sensor-gyro-3d.c
drivers/iio/light/hid-sensor-als.c
drivers/iio/light/lm3533-als.c

index c066a3b..41d97fa 100644 (file)
@@ -155,7 +155,7 @@ static int accel_3d_read_raw(struct iio_dev *indio_dev,
        *val = 0;
        *val2 = 0;
        switch (mask) {
-       case 0:
+       case IIO_CHAN_INFO_RAW:
                hid_sensor_power_state(&accel_state->common_attributes, true);
                report_id = accel_state->accel[chan->scan_index].report_id;
                address = accel_3d_addresses[chan->scan_index];
index 845fd1c..873c2bf 100644 (file)
@@ -158,7 +158,7 @@ static unsigned int ad5380_info_to_reg(struct iio_chan_spec const *chan,
        long info)
 {
        switch (info) {
-       case 0:
+       case IIO_CHAN_INFO_RAW:
                return AD5380_REG_DATA(chan->address);
        case IIO_CHAN_INFO_CALIBBIAS:
                return AD5380_REG_OFFSET(chan->address);
index 033f20e..9333177 100644 (file)
@@ -168,7 +168,7 @@ static int ad5764_read(struct iio_dev *indio_dev, unsigned int reg,
 static int ad5764_chan_info_to_reg(struct iio_chan_spec const *chan, long info)
 {
        switch (info) {
-       case 0:
+       case IIO_CHAN_INFO_RAW:
                return AD5764_REG_DATA(chan->address);
        case IIO_CHAN_INFO_CALIBBIAS:
                return AD5764_REG_OFFSET(chan->address);
index f59995a..36941e6 100644 (file)
@@ -115,7 +115,7 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev,
        *val = 0;
        *val2 = 0;
        switch (mask) {
-       case 0:
+       case IIO_CHAN_INFO_RAW:
                hid_sensor_power_state(&gyro_state->common_attributes, true);
                report_id = gyro_state->gyro[chan->scan_index].report_id;
                address = gyro_3d_addresses[chan->scan_index];
index befd693..406caae 100644 (file)
@@ -97,7 +97,7 @@ static int als_read_raw(struct iio_dev *indio_dev,
        *val = 0;
        *val2 = 0;
        switch (mask) {
-       case 0:
+       case IIO_CHAN_INFO_RAW:
                switch (chan->scan_index) {
                case  CHANNEL_SCAN_INDEX_INTENSITY:
                case  CHANNEL_SCAN_INDEX_ILLUM:
index 36208a3..ff5a332 100644 (file)
@@ -199,7 +199,7 @@ static int lm3533_als_read_raw(struct iio_dev *indio_dev,
        int ret;
 
        switch (mask) {
-       case 0:
+       case IIO_CHAN_INFO_RAW:
                switch (chan->type) {
                case IIO_LIGHT:
                        ret = lm3533_als_get_adc(indio_dev, false, val);