iio: Replace occurrences of magic number 0 by IIO_CHAN_INFO_RAW
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>
This commit is contained in:
parent
f22fb87d4c
commit
67464a54e5
@ -155,7 +155,7 @@ static int accel_3d_read_raw(struct iio_dev *indio_dev,
|
|||||||
*val = 0;
|
*val = 0;
|
||||||
*val2 = 0;
|
*val2 = 0;
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case 0:
|
case IIO_CHAN_INFO_RAW:
|
||||||
hid_sensor_power_state(&accel_state->common_attributes, true);
|
hid_sensor_power_state(&accel_state->common_attributes, true);
|
||||||
report_id = accel_state->accel[chan->scan_index].report_id;
|
report_id = accel_state->accel[chan->scan_index].report_id;
|
||||||
address = accel_3d_addresses[chan->scan_index];
|
address = accel_3d_addresses[chan->scan_index];
|
||||||
|
@ -158,7 +158,7 @@ static unsigned int ad5380_info_to_reg(struct iio_chan_spec const *chan,
|
|||||||
long info)
|
long info)
|
||||||
{
|
{
|
||||||
switch (info) {
|
switch (info) {
|
||||||
case 0:
|
case IIO_CHAN_INFO_RAW:
|
||||||
return AD5380_REG_DATA(chan->address);
|
return AD5380_REG_DATA(chan->address);
|
||||||
case IIO_CHAN_INFO_CALIBBIAS:
|
case IIO_CHAN_INFO_CALIBBIAS:
|
||||||
return AD5380_REG_OFFSET(chan->address);
|
return AD5380_REG_OFFSET(chan->address);
|
||||||
|
@ -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)
|
static int ad5764_chan_info_to_reg(struct iio_chan_spec const *chan, long info)
|
||||||
{
|
{
|
||||||
switch (info) {
|
switch (info) {
|
||||||
case 0:
|
case IIO_CHAN_INFO_RAW:
|
||||||
return AD5764_REG_DATA(chan->address);
|
return AD5764_REG_DATA(chan->address);
|
||||||
case IIO_CHAN_INFO_CALIBBIAS:
|
case IIO_CHAN_INFO_CALIBBIAS:
|
||||||
return AD5764_REG_OFFSET(chan->address);
|
return AD5764_REG_OFFSET(chan->address);
|
||||||
|
@ -115,7 +115,7 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev,
|
|||||||
*val = 0;
|
*val = 0;
|
||||||
*val2 = 0;
|
*val2 = 0;
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case 0:
|
case IIO_CHAN_INFO_RAW:
|
||||||
hid_sensor_power_state(&gyro_state->common_attributes, true);
|
hid_sensor_power_state(&gyro_state->common_attributes, true);
|
||||||
report_id = gyro_state->gyro[chan->scan_index].report_id;
|
report_id = gyro_state->gyro[chan->scan_index].report_id;
|
||||||
address = gyro_3d_addresses[chan->scan_index];
|
address = gyro_3d_addresses[chan->scan_index];
|
||||||
|
@ -97,7 +97,7 @@ static int als_read_raw(struct iio_dev *indio_dev,
|
|||||||
*val = 0;
|
*val = 0;
|
||||||
*val2 = 0;
|
*val2 = 0;
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case 0:
|
case IIO_CHAN_INFO_RAW:
|
||||||
switch (chan->scan_index) {
|
switch (chan->scan_index) {
|
||||||
case CHANNEL_SCAN_INDEX_INTENSITY:
|
case CHANNEL_SCAN_INDEX_INTENSITY:
|
||||||
case CHANNEL_SCAN_INDEX_ILLUM:
|
case CHANNEL_SCAN_INDEX_ILLUM:
|
||||||
|
@ -199,7 +199,7 @@ static int lm3533_als_read_raw(struct iio_dev *indio_dev,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case 0:
|
case IIO_CHAN_INFO_RAW:
|
||||||
switch (chan->type) {
|
switch (chan->type) {
|
||||||
case IIO_LIGHT:
|
case IIO_LIGHT:
|
||||||
ret = lm3533_als_get_adc(indio_dev, false, val);
|
ret = lm3533_als_get_adc(indio_dev, false, val);
|
||||||
|
Loading…
Reference in New Issue
Block a user