Commit 67464a54 authored by Rodrigo Siqueira's avatar Rodrigo Siqueira Committed by Jonathan Cameron
Browse files

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: default avatarRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent f22fb87d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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];
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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];
+1 −1
Original line number Diff line number Diff line
@@ -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:
Loading