Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1470101

Re: [PATCH] hwrng: pasemi_rng.c: Migrate to managed API

From LABBE Corentin <clabbe.montjoie@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] hwrng: pasemi_rng.c: Migrate to managed API
Date 2016-08-25 14:20 +0200
Message-ID <sa1Nv-PS-1@gated-at.bofh.it> (permalink)
References <sa1aN-nw-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] hwrng: pasemi_rng.c: Migrate to managed API PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> - 2016-08-25 13:40 +0200
  Re: [PATCH] hwrng: pasemi_rng.c: Migrate to managed API LABBE Corentin <clabbe.montjoie@gmail.com> - 2016-08-25 14:20 +0200
    Re: [PATCH] hwrng: pasemi_rng.c: Migrate to managed API PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> - 2016-08-25 15:30 +0200
      Re: hwrng: pasemi_rng.c: Migrate to managed API Darren Stevens <darren@stevens-zone.net> - 2016-08-29 21:00 +0200
        Re: hwrng: pasemi_rng.c: Migrate to managed API PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> - 2016-08-30 09:20 +0200
          Re: hwrng: pasemi_rng.c: Migrate to managed API Darren Stevens <darren@stevens-zone.net> - 2016-08-31 16:10 +0200
            Re: hwrng: pasemi_rng.c: Migrate to managed API PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com> - 2016-09-01 09:10 +0200

csiph-web