Re: [PATCHv2] hwrng: add support for picoxcell TRNG

From: Jamie Iles
Date: Mon Jan 17 2011 - 05:23:40 EST


On Sat, Jan 15, 2011 at 11:44:16AM +1100, Herbert Xu wrote:
> On Fri, Jan 14, 2011 at 06:44:21PM +0000, Jamie Iles wrote:
> >
> > + /* Wait for some data to become available. */
> > + while (__raw_readl(csr) & CSR_OUT_EMPTY_MASK) {
> > + if (!wait)
> > + return 0;
> > + cpu_relax();
> > + }
>
> This has the potential to loop indefinitely. Please add a time-out
> to prevent that (see existing RNG drivers for example).

Ok, that's a fair point! Here's an updated version with a timeout.
I've also added in support for the fault detection which I previously
overlooked.

Jamie

8<--------