Skip to content

Commit

Permalink
net: ethernet: bgmac: Use devm_platform_ioremap_resource_byname
Browse files Browse the repository at this point in the history
Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yang Yingliang authored and davem330 committed Jun 7, 2021
1 parent b5d64b4 commit 3710e80
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions drivers/net/ethernet/broadcom/bgmac-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ static int bgmac_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct bgmac *bgmac;
struct resource *regs;
int ret;

bgmac = bgmac_alloc(&pdev->dev);
Expand Down Expand Up @@ -206,21 +205,15 @@ static int bgmac_probe(struct platform_device *pdev)
if (IS_ERR(bgmac->plat.base))
return PTR_ERR(bgmac->plat.base);

regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
if (regs) {
bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
if (IS_ERR(bgmac->plat.idm_base))
return PTR_ERR(bgmac->plat.idm_base);
bgmac->plat.idm_base = devm_platform_ioremap_resource_byname(pdev, "idm_base");
if (IS_ERR(bgmac->plat.idm_base))
return PTR_ERR(bgmac->plat.idm_base);
else
bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
}

regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base");
if (regs) {
bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev,
regs);
if (IS_ERR(bgmac->plat.nicpm_base))
return PTR_ERR(bgmac->plat.nicpm_base);
}
bgmac->plat.nicpm_base = devm_platform_ioremap_resource_byname(pdev, "nicpm_base");
if (IS_ERR(bgmac->plat.nicpm_base))
return PTR_ERR(bgmac->plat.nicpm_base);

bgmac->read = platform_bgmac_read;
bgmac->write = platform_bgmac_write;
Expand Down

0 comments on commit 3710e80

Please sign in to comment.