Re: [PATCH 1/2] iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access

From: Vignesh R
Date: Wed Aug 17 2016 - 07:14:17 EST




On Monday 15 August 2016 09:15 PM, Jonathan Cameron wrote:
> On 08/08/16 12:05, Vignesh R wrote:
>> It is possible that two or more ADC channels can be simultaneously
>> requested for raw samples, in which case there can be race in access to
>> FIFO data resulting in loss of samples.
>> If am335x_tsc_se_set_once() is called again from tiadc_read_raw(), when
>> ADC is still acquired to sample one of the channels, the second process
>> might be put into uninterruptible sleep state. Fix these issues, by
>> protecting FIFO access and channel configurations with a mutex. Since
>> tiadc_read_raw() might take anywhere between few microseconds to few
>> milliseconds to finish execution (depending on averaging and delay
>> values supplied via DT), its better to use mutex instead of spinlock.
>>
>> Signed-off-by: Vignesh R <vigneshr@xxxxxx>
> Hi,
>
> Thanks for the patch.
>
> As this is clearly a fix for a long standing issue, I'd like to send
> it for stable inclusion. Would you mind doing a bit of detective work
> to added a Fixes tag to say which original patch introduced the issue?
>

Looks to be due to the commit 7ca6740cd1cd4 ("mfd: input: iio:
ti_amm335x: Rework TSC/ADC synchronization")
Will send v2 with fixes tag. Thanks!

--
Regards
Vignesh