Commit 47651c51 authored by Yang Yingliang's avatar Yang Yingliang Committed by David S. Miller

net: axienet: Use devm_platform_get_and_ioremap_resource()

Use devm_platform_get_and_ioremap_resource() to simplify
code.
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0b462d01
...@@ -1894,8 +1894,7 @@ static int axienet_probe(struct platform_device *pdev) ...@@ -1894,8 +1894,7 @@ static int axienet_probe(struct platform_device *pdev)
goto cleanup_clk; goto cleanup_clk;
/* Map device registers */ /* Map device registers */
ethres = platform_get_resource(pdev, IORESOURCE_MEM, 0); lp->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &ethres);
lp->regs = devm_ioremap_resource(&pdev->dev, ethres);
if (IS_ERR(lp->regs)) { if (IS_ERR(lp->regs)) {
ret = PTR_ERR(lp->regs); ret = PTR_ERR(lp->regs);
goto cleanup_clk; goto cleanup_clk;
...@@ -2010,9 +2009,7 @@ static int axienet_probe(struct platform_device *pdev) ...@@ -2010,9 +2009,7 @@ static int axienet_probe(struct platform_device *pdev)
lp->eth_irq = platform_get_irq_optional(pdev, 0); lp->eth_irq = platform_get_irq_optional(pdev, 0);
} else { } else {
/* Check for these resources directly on the Ethernet node. */ /* Check for these resources directly on the Ethernet node. */
struct resource *res = platform_get_resource(pdev, lp->dma_regs = devm_platform_get_and_ioremap_resource(pdev, 1, NULL);
IORESOURCE_MEM, 1);
lp->dma_regs = devm_ioremap_resource(&pdev->dev, res);
lp->rx_irq = platform_get_irq(pdev, 1); lp->rx_irq = platform_get_irq(pdev, 1);
lp->tx_irq = platform_get_irq(pdev, 0); lp->tx_irq = platform_get_irq(pdev, 0);
lp->eth_irq = platform_get_irq_optional(pdev, 2); lp->eth_irq = platform_get_irq_optional(pdev, 2);
......
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