2021-03-13 01:48:32

by Tian Tao

[permalink] [raw]
Subject: [PATCH] hwrng: ba431 - 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/ba431-rng.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/char/hw_random/ba431-rng.c b/drivers/char/hw_random/ba431-rng.c
index 4f514e2..5b7ca04 100644
--- a/drivers/char/hw_random/ba431-rng.c
+++ b/drivers/char/hw_random/ba431-rng.c
@@ -170,7 +170,6 @@ static int ba431_trng_init(struct hwrng *rng)
static int ba431_trng_probe(struct platform_device *pdev)
{
struct ba431_trng *ba431;
- struct resource *res;
int ret;

ba431 = devm_kzalloc(&pdev->dev, sizeof(*ba431), GFP_KERNEL);
@@ -179,8 +178,7 @@ static int ba431_trng_probe(struct platform_device *pdev)

ba431->dev = &pdev->dev;

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

--
2.7.4


2021-03-19 11:05:24

by Herbert Xu

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

On Sat, Mar 13, 2021 at 09:47:38AM +0800, Tian Tao wrote:
> Use devm_platform_ioremap_resource() to simplify the code.
>
> Signed-off-by: Tian Tao <[email protected]>
> ---
> drivers/char/hw_random/ba431-rng.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