diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2021-06-08 16:56:22 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-09 02:36:57 +0300 |
commit | 5b38b97f40a7bd8295260c59b997bf47b79c3675 (patch) | |
tree | 094a8f1e8bc88f3d19b60fcf8b9fec2175f6d64d /drivers/net/ethernet/ni | |
parent | de274be32cb288d96b91494aeaafccc34cf4e00f (diff) | |
download | linux-5b38b97f40a7bd8295260c59b997bf47b79c3675.tar.xz |
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: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ni')
-rw-r--r-- | drivers/net/ethernet/ni/nixge.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c index a6861df9904f..2d097dcb7bda 100644 --- a/drivers/net/ethernet/ni/nixge.c +++ b/drivers/net/ethernet/ni/nixge.c @@ -1224,7 +1224,6 @@ static int nixge_of_get_resources(struct platform_device *pdev) const struct of_device_id *of_id; enum nixge_version version; struct resource *ctrlres; - struct resource *dmares; struct net_device *ndev; struct nixge_priv *priv; @@ -1236,12 +1235,9 @@ static int nixge_of_get_resources(struct platform_device *pdev) version = (enum nixge_version)of_id->data; 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 - dmares = platform_get_resource_byname(pdev, IORESOURCE_MEM, - "dma"); - - priv->dma_regs = devm_ioremap_resource(&pdev->dev, dmares); + priv->dma_regs = devm_platform_ioremap_resource_byname(pdev, "dma"); if (IS_ERR(priv->dma_regs)) { netdev_err(ndev, "failed to map dma regs\n"); return PTR_ERR(priv->dma_regs); |