On 05/25/2012 12:10 PM, Peter Korsgaard :
>>>>>> "Nicolas" == Nicolas Ferre <[email protected]> writes:
> 
> Hi,
> 
>  Nicolas> What about a single read to ISR like this:
> 
>  Nicolas> tmp = readl(trng->base + TRNG_ODATA);
>  Nicolas> if (readl(trng->base + TRNG_ISR) & 1) {
>  Nicolas>     *data = tmp;
>  Nicolas>     return 4;
>  Nicolas> } else {
>  Nicolas>     return 0;
>  Nicolas> }
> 
> No, that won't work as you then have another race. Data might not be
> ready when you read ODATA, but then become ready just in time for when
> you read ISR, so you end up using stale data.

Yes, sure.

> It all would have been easier if the ready bit would get cleared on
> reads from ODATA instead of/as well as from ISR, but that's
> unfortunately not the case.

I will talk about that idea to my friends designers and see if we can
improve things, in the future...

Thanks, bye,
-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to