[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k2ik2o37.fsf@eliezer.anholt.net>
Date: Mon, 23 May 2016 19:21:00 -0700
From: Eric Anholt <eric@...olt.net>
To: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@...adcom.com>,
Rob Herring <robh+dt@...nel.org>,
Pawel Moll <pawel.moll@....com>,
Mark Rutland <mark.rutland@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
Stephen Warren <swarren@...dotorg.org>,
Lee Jones <lee@...nel.org>,
Russell King <linux@....linux.org.uk>,
Ray Jui <rjui@...adcom.com>,
Scott Branden <sbranden@...adcom.com>,
Jon Mason <jonmason@...adcom.com>,
Matt Mackall <mpm@...enic.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Daniel Thompson <daniel.thompson@...aro.org>,
Kieran Bingham <kieranbingham@...il.com>,
Pankaj Dev <pankaj.dev@...com>,
Richard Weinberger <richard@....at>, noltari@...il.com,
Joshua Henderson <joshua.henderson@...rochip.com>
Cc: devicetree@...r.kernel.org, linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
bcm-kernel-feedback-list@...adcom.com,
linux-crypto@...r.kernel.org,
Yendapally Reddy Dhananjaya Reddy
<yendapally.reddy@...adcom.com>
Subject: Re: [PATCH 4/4] hwrng: bcm2835: Read as much data as available
Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@...adcom.com>
writes:
> Read the requested number of data from the fifo
>
> Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@...adcom.com>
> ---
> drivers/char/hw_random/bcm2835-rng.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
> index b1e8b78..9bbdc07 100644
> --- a/drivers/char/hw_random/bcm2835-rng.c
> +++ b/drivers/char/hw_random/bcm2835-rng.c
> @@ -43,6 +43,8 @@ static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max,
> bool wait)
> {
> void __iomem *rng_base = (void __iomem *)rng->priv;
> + u32 max_words = max/sizeof(u32);
Style fix: Binary operators get a space on each side, so
"max / sizeof(u32);"
> @@ -50,8 +52,14 @@ static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max,
> cpu_relax();
> }
>
> - *(u32 *)buf = __raw_readl(rng_base + RNG_DATA);
> - return sizeof(u32);
> + num_words = (readl(rng_base + RNG_STATUS) >> 24);
Optional cleanup: here and in the return statement, drop the extra
parenthesis.
Functionality-wise, this patch looks great to me, and should make the
driver more efficient. With at least the binary operators change done,
it will be:
Reviewed-by: Eric Anholt <eric@...olt.net>
Thanks!
Download attachment "signature.asc" of type "application/pgp-signature" (819 bytes)
Powered by blists - more mailing lists