diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/iio/adc/ti_am335x_adc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index 8ffe52d58829..4427e8e46a7f 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c | |||
@@ -145,6 +145,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
145 | int i; | 145 | int i; |
146 | unsigned int fifo1count, read; | 146 | unsigned int fifo1count, read; |
147 | u32 step = UINT_MAX; | 147 | u32 step = UINT_MAX; |
148 | bool found = false; | ||
148 | 149 | ||
149 | /* | 150 | /* |
150 | * When the sub-system is first enabled, | 151 | * When the sub-system is first enabled, |
@@ -169,11 +170,14 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
169 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); | 170 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); |
170 | for (i = 0; i < fifo1count; i++) { | 171 | for (i = 0; i < fifo1count; i++) { |
171 | read = tiadc_readl(adc_dev, REG_FIFO1); | 172 | read = tiadc_readl(adc_dev, REG_FIFO1); |
172 | if (read >> 16 == step) | 173 | if (read >> 16 == step) { |
173 | *val = read & 0xfff; | 174 | *val = read & 0xfff; |
175 | found = true; | ||
176 | } | ||
174 | } | 177 | } |
175 | am335x_tsc_se_update(adc_dev->mfd_tscadc); | 178 | am335x_tsc_se_update(adc_dev->mfd_tscadc); |
176 | 179 | if (found == false) | |
180 | return -EBUSY; | ||
177 | return IIO_VAL_INT; | 181 | return IIO_VAL_INT; |
178 | } | 182 | } |
179 | 183 | ||