From: LABBE Corentin <clabbe.montjoie@gmail.com>
To: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Cc: herbert@gondor.apana.org.au, linux-kernel@vger.kernel.org,
linux-crypto@vger.kernel.org, mpm@selenic.com, olof@lixom.net,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] hwrng: pasemi_rng.c: Migrate to managed API
Date: Thu, 25 Aug 2016 14:15:46 +0200 [thread overview]
Message-ID: <20160825121546.GA25650@Red> (raw)
In-Reply-To: <1472124856-12767-1-git-send-email-prasannatsmkumar@gmail.com>
On Thu, Aug 25, 2016 at 05:04:16PM +0530, PrasannaKumar Muralidharan wrote:
> Use devm_ioremap and devm_hwrng_register instead of ioremap and
> hwrng_register. This removes unregistering and error handling code.
>
> This patch is not tested with hardware as I don't have access to it.
>
> Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
> ---
> drivers/char/hw_random/pasemi-rng.c | 26 +++-----------------------
> 1 file changed, 3 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c
> index 699b725..0f03397 100644
> --- a/drivers/char/hw_random/pasemi-rng.c
> +++ b/drivers/char/hw_random/pasemi-rng.c
> @@ -100,37 +100,18 @@ static int rng_probe(struct platform_device *ofdev)
> void __iomem *rng_regs;
> struct device_node *rng_np = ofdev->dev.of_node;
> struct resource res;
> - int err = 0;
>
> - err = of_address_to_resource(rng_np, 0, &res);
> - if (err)
> + if (of_address_to_resource(rng_np, 0, &res))
> return -ENODEV;
>
> - rng_regs = ioremap(res.start, 0x100);
> -
> + rng_regs = devm_ioremap(&ofdev->dev, res.start, 0x100);
> if (!rng_regs)
> return -ENOMEM;
>
I will propose to use devm_ioremap_resource() instead for removing this hardcoded 0x100, but i cannot find any user of this driver in any dts. (And so cannot check that this 0x100 is given in any DT resource node)
Is this normal ?
Regard
WARNING: multiple messages have this Message-ID (diff)
From: LABBE Corentin <clabbe.montjoie@gmail.com>
To: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Cc: olof@lixom.net, mpm@selenic.com, herbert@gondor.apana.org.au,
linuxppc-dev@lists.ozlabs.org, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwrng: pasemi_rng.c: Migrate to managed API
Date: Thu, 25 Aug 2016 14:15:46 +0200 [thread overview]
Message-ID: <20160825121546.GA25650@Red> (raw)
In-Reply-To: <1472124856-12767-1-git-send-email-prasannatsmkumar@gmail.com>
On Thu, Aug 25, 2016 at 05:04:16PM +0530, PrasannaKumar Muralidharan wrote:
> Use devm_ioremap and devm_hwrng_register instead of ioremap and
> hwrng_register. This removes unregistering and error handling code.
>
> This patch is not tested with hardware as I don't have access to it.
>
> Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
> ---
> drivers/char/hw_random/pasemi-rng.c | 26 +++-----------------------
> 1 file changed, 3 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c
> index 699b725..0f03397 100644
> --- a/drivers/char/hw_random/pasemi-rng.c
> +++ b/drivers/char/hw_random/pasemi-rng.c
> @@ -100,37 +100,18 @@ static int rng_probe(struct platform_device *ofdev)
> void __iomem *rng_regs;
> struct device_node *rng_np = ofdev->dev.of_node;
> struct resource res;
> - int err = 0;
>
> - err = of_address_to_resource(rng_np, 0, &res);
> - if (err)
> + if (of_address_to_resource(rng_np, 0, &res))
> return -ENODEV;
>
> - rng_regs = ioremap(res.start, 0x100);
> -
> + rng_regs = devm_ioremap(&ofdev->dev, res.start, 0x100);
> if (!rng_regs)
> return -ENOMEM;
>
I will propose to use devm_ioremap_resource() instead for removing this hardcoded 0x100, but i cannot find any user of this driver in any dts. (And so cannot check that this 0x100 is given in any DT resource node)
Is this normal ?
Regard
next prev parent reply other threads:[~2016-08-25 12:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 11:34 [PATCH] hwrng: pasemi_rng.c: Migrate to managed API PrasannaKumar Muralidharan
2016-08-25 12:15 ` LABBE Corentin [this message]
2016-08-25 12:15 ` LABBE Corentin
2016-08-25 13:25 ` PrasannaKumar Muralidharan
2016-08-29 17:52 ` Darren Stevens
2016-08-30 7:16 ` PrasannaKumar Muralidharan
2016-08-31 14:02 ` Darren Stevens
2016-09-01 6:59 ` PrasannaKumar Muralidharan
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=20160825121546.GA25650@Red \
--to=clabbe.montjoie@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpm@selenic.com \
--cc=olof@lixom.net \
--cc=prasannatsmkumar@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.