mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Lee Jones <lee@kernel.org>, Russell King <linux@arm.linux.org.uk>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Jon Mason <jonmason@broadcom.com>, Matt Mackall <mpm@selenic.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Daniel Thompson <daniel.thompson@linaro.org>,
	Kieran Bingham <kieranbingham@gmail.com>,
	Pankaj Dev <pankaj.dev@st.com>,
	Richard Weinberger <richard@nod.at>,
	noltari@gmail.com,
	Joshua Henderson <joshua.henderson@microchip.com>
Cc: devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	bcm-kernel-feedback-list@broadcom.com,
	linux-crypto@vger.kernel.org,
	Yendapally Reddy Dhananjaya Reddy 
	<yendapally.reddy@broadcom.com>
Subject: Re: [PATCH 4/4] hwrng: bcm2835: Read as much data as available
Date: Mon, 23 May 2016 19:21:00 -0700	[thread overview]
Message-ID: <87k2ik2o37.fsf@eliezer.anholt.net> (raw)
In-Reply-To: <1464020451-16520-5-git-send-email-yendapally.reddy@broadcom.com>

[-- Attachment #1: Type: text/plain, Size: 1412 bytes --]

Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>
writes:

> Read the requested number of data from the fifo
>
> Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.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@anholt.net>

Thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

      reply	other threads:[~2016-05-24  2:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 16:20 [PATCH 0/4] hw rng support for NSP SoC Yendapally Reddy Dhananjaya Reddy
2016-05-23 16:20 ` [PATCH 1/4] dt-bindings: rng: Northstar Plus SoC rng bindings Yendapally Reddy Dhananjaya Reddy
2016-05-23 21:39   ` Rob Herring
2016-05-24  2:22   ` Eric Anholt
2016-05-23 16:20 ` [PATCH 2/4] hwrng: bcm2835: Support Broadcom NSP SoC rng Yendapally Reddy Dhananjaya Reddy
2016-05-24  2:14   ` Eric Anholt
2016-05-23 16:20 ` [PATCH 3/4] ARM: dts: nsp: Add rng device tree entry Yendapally Reddy Dhananjaya Reddy
2016-05-23 16:20 ` [PATCH 4/4] hwrng: bcm2835: Read as much data as available Yendapally Reddy Dhananjaya Reddy
2016-05-24  2:21   ` Eric Anholt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k2ik2o37.fsf@eliezer.anholt.net \
    --to=eric@anholt.net \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=daniel.thompson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jonmason@broadcom.com \
    --cc=joshua.henderson@microchip.com \
    --cc=kieranbingham@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mpm@selenic.com \
    --cc=noltari@gmail.com \
    --cc=pankaj.dev@st.com \
    --cc=pawel.moll@arm.com \
    --cc=richard@nod.at \
    --cc=rjui@broadcom.com \
    --cc=robh+dt@kernel.org \
    --cc=sbranden@broadcom.com \
    --cc=swarren@wwwdotorg.org \
    --cc=yendapally.reddy@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®