Commit 5b38b97f authored by Yang Yingliang's avatar Yang Yingliang Committed by David S. Miller

net: nixge: simplify code with devm platform functions

Use devm_platform_get_and_ioremap_resource() and
devm_platform_ioremap_resource_byname to simplify
code.
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent de274be3
...@@ -1224,7 +1224,6 @@ static int nixge_of_get_resources(struct platform_device *pdev) ...@@ -1224,7 +1224,6 @@ static int nixge_of_get_resources(struct platform_device *pdev)
const struct of_device_id *of_id; const struct of_device_id *of_id;
enum nixge_version version; enum nixge_version version;
struct resource *ctrlres; struct resource *ctrlres;
struct resource *dmares;
struct net_device *ndev; struct net_device *ndev;
struct nixge_priv *priv; struct nixge_priv *priv;
...@@ -1236,12 +1235,9 @@ static int nixge_of_get_resources(struct platform_device *pdev) ...@@ -1236,12 +1235,9 @@ static int nixge_of_get_resources(struct platform_device *pdev)
version = (enum nixge_version)of_id->data; version = (enum nixge_version)of_id->data;
if (version <= NIXGE_V2) if (version <= NIXGE_V2)
dmares = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->dma_regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
else else
dmares = platform_get_resource_byname(pdev, IORESOURCE_MEM, priv->dma_regs = devm_platform_ioremap_resource_byname(pdev, "dma");
"dma");
priv->dma_regs = devm_ioremap_resource(&pdev->dev, dmares);
if (IS_ERR(priv->dma_regs)) { if (IS_ERR(priv->dma_regs)) {
netdev_err(ndev, "failed to map dma regs\n"); netdev_err(ndev, "failed to map dma regs\n");
return PTR_ERR(priv->dma_regs); return PTR_ERR(priv->dma_regs);
......
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