2021-02-09 08:05:51

by Tian Tao

[permalink] [raw]
Subject: [PATCH] hwrng: xiphera-trng: use devm_platform_ioremap_resource() to simplify

Use devm_platform_ioremap_resource() to simplify the code.

Signed-off-by: Tian Tao <[email protected]>
---
drivers/char/hw_random/xiphera-trng.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/char/hw_random/xiphera-trng.c b/drivers/char/hw_random/xiphera-trng.c
index 7bdab8c..2a9fea7 100644
--- a/drivers/char/hw_random/xiphera-trng.c
+++ b/drivers/char/hw_random/xiphera-trng.c
@@ -63,14 +63,12 @@ static int xiphera_trng_probe(struct platform_device *pdev)
int ret;
struct xiphera_trng *trng;
struct device *dev = &pdev->dev;
- struct resource *res;

trng = devm_kzalloc(dev, sizeof(*trng), GFP_KERNEL);
if (!trng)
return -ENOMEM;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- trng->mem = devm_ioremap_resource(dev, res);
+ trng->mem = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(trng->mem))
return PTR_ERR(trng->mem);

--
2.7.4


2021-03-04 15:14:14

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] hwrng: xiphera-trng: use devm_platform_ioremap_resource() to simplify

On Tue, Feb 09, 2021 at 04:03:37PM +0800, Tian Tao wrote:
> Use devm_platform_ioremap_resource() to simplify the code.
>
> Signed-off-by: Tian Tao <[email protected]>
> ---
> drivers/char/hw_random/xiphera-trng.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt