diff mbox series

hwrng: cctrn - use devm_platform_ioremap_resource() to simplify

Message ID 1615599755-28181-1-git-send-email-tiantao6@hisilicon.com
State Accepted
Commit f50281df94d76d40e8afa2433f39c7b4b8bd6868
Headers show
Series hwrng: cctrn - use devm_platform_ioremap_resource() to simplify | expand

Commit Message

Tian Tao March 13, 2021, 1:42 a.m. UTC
Use devm_platform_ioremap_resource() to simplify the code.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/char/hw_random/cctrng.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

Comments

Herbert Xu March 19, 2021, 11:04 a.m. UTC | #1
On Sat, Mar 13, 2021 at 09:42:35AM +0800, Tian Tao wrote:
> Use devm_platform_ioremap_resource() to simplify the code.

> 

> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

> ---

>  drivers/char/hw_random/cctrng.c | 12 +-----------

>  1 file changed, 1 insertion(+), 11 deletions(-)


Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff mbox series

Patch

diff --git a/drivers/char/hw_random/cctrng.c b/drivers/char/hw_random/cctrng.c
index 7a293f2..e7f12953 100644
--- a/drivers/char/hw_random/cctrng.c
+++ b/drivers/char/hw_random/cctrng.c
@@ -486,7 +486,6 @@  static void cc_trng_clk_fini(struct cctrng_drvdata *drvdata)
 
 static int cctrng_probe(struct platform_device *pdev)
 {
-	struct resource *req_mem_cc_regs = NULL;
 	struct cctrng_drvdata *drvdata;
 	struct device *dev = &pdev->dev;
 	int rc = 0;
@@ -510,21 +509,12 @@  static int cctrng_probe(struct platform_device *pdev)
 
 	drvdata->circ.buf = (char *)drvdata->data_buf;
 
-	/* Get device resources */
-	/* First CC registers space */
-	req_mem_cc_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	/* Map registers space */
-	drvdata->cc_base = devm_ioremap_resource(dev, req_mem_cc_regs);
+	drvdata->cc_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(drvdata->cc_base)) {
 		dev_err(dev, "Failed to ioremap registers");
 		return PTR_ERR(drvdata->cc_base);
 	}
 
-	dev_dbg(dev, "Got MEM resource (%s): %pR\n", req_mem_cc_regs->name,
-		req_mem_cc_regs);
-	dev_dbg(dev, "CC registers mapped from %pa to 0x%p\n",
-		&req_mem_cc_regs->start, drvdata->cc_base);
-
 	/* Then IRQ */
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {