提交 aba30f6f 编写于 作者: Y YueHaibing 提交者: Linus Walleij

gpio: creg-snps: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190906131032.22148-1-yuehaibing@huawei.comAcked-by: NEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 ac571991
...@@ -137,7 +137,6 @@ static int creg_gpio_probe(struct platform_device *pdev) ...@@ -137,7 +137,6 @@ static int creg_gpio_probe(struct platform_device *pdev)
const struct of_device_id *match; const struct of_device_id *match;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct creg_gpio *hcg; struct creg_gpio *hcg;
struct resource *mem;
u32 ngpios; u32 ngpios;
int ret; int ret;
...@@ -145,8 +144,7 @@ static int creg_gpio_probe(struct platform_device *pdev) ...@@ -145,8 +144,7 @@ static int creg_gpio_probe(struct platform_device *pdev)
if (!hcg) if (!hcg)
return -ENOMEM; return -ENOMEM;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcg->regs = devm_platform_ioremap_resource(pdev, 0);
hcg->regs = devm_ioremap_resource(dev, mem);
if (IS_ERR(hcg->regs)) if (IS_ERR(hcg->regs))
return PTR_ERR(hcg->regs); return PTR_ERR(hcg->regs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册