Skip to contentSkip to conversation

iio:magnetometer: Replace magic number 0 by IIO_CHAN_INFO_RAW

PATCH In review Rodrigo Siqueira 2 participants 2 messages Feb 27, 2018 – Mar 3, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio:magnetometer: Replace magic number 0 by IIO_CHAN_INFO_RAW

The function magn_3d_read_raw has a switch statement handling multiple cases per channel. The first case statement uses the magic number 0, which means IIO_CHAN_INFO_RAW. Additionally, the iio_chan_spec for magn_3d_channels is configured to be IIO_CHAN_INFO_RAW. Therefore, this patch replaces the magic number 0 for the appropriate IIO_CHAN_INFO_RAW.

---
 drivers/iio/magnetometer/hid-sensor-magn-3d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/magnetometer/hid-sensor-magn-3d.c +1 -1
index a1fd9d591818..d55c4885211a 100644
@@ -167,7 +167,7 @@ static int magn_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(&magn_state->magn_flux_attributes, true);
 		report_id  			magn_state->magn[chan->address].report_id;
Signature · 1 line
2.16.2
maintainer
#1 lore raw
Quoted 7 lines · On Tue, 27 Feb 2018 11:47:55 -0300 Rodrigo Siqueira…

The function magn_3d_read_raw has a switch statement handling multiple cases per channel. The first case statement uses the magic number 0, which means IIO_CHAN_INFO_RAW. Additionally, the iio_chan_spec for magn_3d_channels is configured to be IIO_CHAN_INFO_RAW. Therefore, this patch replaces the magic number 0 for the appropriate IIO_CHAN_INFO_RAW.

Applied to the togreg branch of iio.git and pushed out as testing.

Thanks,

Jonathan

Quoted 16 lines
---
 drivers/iio/magnetometer/hid-sensor-magn-3d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/magnetometer/hid-sensor-magn-3d.c +1 -1
index a1fd9d591818..d55c4885211a 100644
@@ -167,7 +167,7 @@ static int magn_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(&magn_state->magn_flux_attributes, true);
 		report_id >  			magn_state->magn[chan->address].report_id;