Re: [PATCH v2 02/12] hwrng: bcm2835-rng: Define a driver private context

From: Eric Anholt
Date: Wed Nov 08 2017 - 13:22:40 EST


Florian Fainelli <f.fainelli@xxxxxxxxx> writes:

> Instead of making hwrng::priv host the base register address, define a
> driver private context, make it per platform device instance and pass it
> down the different functions.
>
> Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
> ---
> drivers/char/hw_random/bcm2835-rng.c | 55 ++++++++++++++++++++++--------------
> 1 file changed, 34 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
> index a818418a7e4c..0d72147ab45b 100644
> --- a/drivers/char/hw_random/bcm2835-rng.c
> +++ b/drivers/char/hw_random/bcm2835-rng.c

> -static struct hwrng bcm2835_rng_ops = {
> - .name = "bcm2835",
> - .read = bcm2835_rng_read,
> -};
> -

> /* map peripheral */
> - rng_base = devm_ioremap_resource(dev, r);
> - if (IS_ERR(rng_base)) {
> + priv->base = devm_ioremap_resource(dev, r);
> + if (IS_ERR(priv->base)) {
> dev_err(dev, "failed to remap rng regs");
> - return PTR_ERR(rng_base);
> + return PTR_ERR(priv->base);
> }
> - bcm2835_rng_ops.priv = (unsigned long)rng_base;
> +
> + priv->rng.name = "bcm2835-rng";

Looks like an unintentional change from the previous "bcm2835" here?

Other than that, 1-2 are:

Reviewed-by: Eric Anholt <eric@xxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature