summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/axp20x_adc.c
diff options
context:
space:
mode:
authorQuentin Schulz <quentin.schulz@bootlin.com>2018-02-19 13:47:36 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-02-24 12:19:45 +0000
commitadc18ba9061eade402b8d84c6bbcb5ca87add8da (patch)
tree5f75bee8dd3f15f7a3d2dab2436fb2e780436bce /drivers/iio/adc/axp20x_adc.c
parent4c73b809a99fc4df39fb18664288921b052f9649 (diff)
iio: adc: axp20x_adc: remove !! in favor of ternary condition
!!'s behaviour isn't that obvious and sparse complained about it, so let's replace it with a ternary condition. Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/axp20x_adc.c')
-rw-r--r--drivers/iio/adc/axp20x_adc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c
index 7cdb8bc8cde6..5be789269353 100644
--- a/drivers/iio/adc/axp20x_adc.c
+++ b/drivers/iio/adc/axp20x_adc.c
@@ -445,7 +445,7 @@ static int axp20x_adc_offset_voltage(struct iio_dev *indio_dev, int channel,
return -EINVAL;
}
- *val = !!(*val) * 700000;
+ *val = *val ? 700000 : 0;
return IIO_VAL_INT;
}
@@ -542,15 +542,17 @@ static int axp20x_write_raw(struct iio_dev *indio_dev,
if (val != 0 && val != 700000)
return -EINVAL;
+ val = val ? 1 : 0;
+
switch (chan->channel) {
case AXP20X_GPIO0_V:
reg = AXP20X_GPIO10_IN_RANGE_GPIO0;
- regval = AXP20X_GPIO10_IN_RANGE_GPIO0_VAL(!!val);
+ regval = AXP20X_GPIO10_IN_RANGE_GPIO0_VAL(val);
break;
case AXP20X_GPIO1_V:
reg = AXP20X_GPIO10_IN_RANGE_GPIO1;
- regval = AXP20X_GPIO10_IN_RANGE_GPIO1_VAL(!!val);
+ regval = AXP20X_GPIO10_IN_RANGE_GPIO1_VAL(val);
break;
default: