summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Troast <ntroast@codeaurora.org>2016-11-04 13:51:11 -0700
committerNicholas Troast <ntroast@codeaurora.org>2016-11-14 12:49:58 -0800
commitbb2c232a14d3400da60625342fc730485ef94376 (patch)
treea30a6534939cd3c5651faea665ab8dbaa20a0fe9
parentc74e83d44ccfb21bc40aafcb717900413015c3ff (diff)
iio: adc: qcom-tadc: cast raw ADC readings before conversion
Currently the code depends on implicit type conversion when converting ADC readings. Make the type conversions explicit. Change-Id: I09b5d4cd219b0a53559176525d9b501e5a6dc0c9 Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
-rw-r--r--drivers/iio/adc/qcom-tadc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/qcom-tadc.c b/drivers/iio/adc/qcom-tadc.c
index 3cc2694f9a03..4a56847a43e7 100644
--- a/drivers/iio/adc/qcom-tadc.c
+++ b/drivers/iio/adc/qcom-tadc.c
@@ -398,7 +398,7 @@ static int tadc_do_conversion(struct tadc_chip *chip, u8 channels, s16 *adc)
}
for (i = 0; i < TADC_NUM_CH; i++)
- adc[i] = val[i * 2] | val[i * 2 + 1] << BITS_PER_BYTE;
+ adc[i] = (s16)(val[i * 2] | (u16)val[i * 2 + 1] << 8);
return jiffies_to_msecs(timeout - timeleft);
}