hwrng: bcm2835 - use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Wed, 16 Oct 2019 10:46:10 +0000 (18:46 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 25 Oct 2019 15:09:53 +0000 (02:09 +1100)
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/bcm2835-rng.c

index f759790c3cdb60607dd85d5c3eafedccdf6c5df5..d2a5791eb49f19bd16a1edc92263e8595bbf9bd3 100644 (file)
@@ -142,7 +142,6 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
        struct device_node *np = dev->of_node;
        const struct of_device_id *rng_id;
        struct bcm2835_rng_priv *priv;
-       struct resource *r;
        int err;
 
        priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -151,10 +150,8 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, priv);
 
-       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
        /* map peripheral */
-       priv->base = devm_ioremap_resource(dev, r);
+       priv->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(priv->base))
                return PTR_ERR(priv->base);