Commit f50281df authored by Tian Tao's avatar Tian Tao Committed by Herbert Xu

hwrng: cctrng - use devm_platform_ioremap_resource() to simplify

Use devm_platform_ioremap_resource() to simplify the code.
Signed-off-by: default avatarTian Tao <tiantao6@hisilicon.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e0ba808d
...@@ -486,7 +486,6 @@ static void cc_trng_clk_fini(struct cctrng_drvdata *drvdata) ...@@ -486,7 +486,6 @@ static void cc_trng_clk_fini(struct cctrng_drvdata *drvdata)
static int cctrng_probe(struct platform_device *pdev) static int cctrng_probe(struct platform_device *pdev)
{ {
struct resource *req_mem_cc_regs = NULL;
struct cctrng_drvdata *drvdata; struct cctrng_drvdata *drvdata;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int rc = 0; int rc = 0;
...@@ -510,21 +509,12 @@ static int cctrng_probe(struct platform_device *pdev) ...@@ -510,21 +509,12 @@ static int cctrng_probe(struct platform_device *pdev)
drvdata->circ.buf = (char *)drvdata->data_buf; drvdata->circ.buf = (char *)drvdata->data_buf;
/* Get device resources */ drvdata->cc_base = devm_platform_ioremap_resource(pdev, 0);
/* 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);
if (IS_ERR(drvdata->cc_base)) { if (IS_ERR(drvdata->cc_base)) {
dev_err(dev, "Failed to ioremap registers"); dev_err(dev, "Failed to ioremap registers");
return PTR_ERR(drvdata->cc_base); 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 */ /* Then IRQ */
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment