Skip to content

Commit

Permalink
net: mdio: mscc-miim: Make use of the helper function devm_platform_i…
Browse files Browse the repository at this point in the history
…oremap_resource()

Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Cai Huoqing authored and David S. Miller committed Aug 31, 2021
1 parent fa14d03 commit 672a1c3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/net/mdio/mdio-mscc-miim.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ static int mscc_miim_reset(struct mii_bus *bus)

static int mscc_miim_probe(struct platform_device *pdev)
{
struct resource *res;
struct mii_bus *bus;
struct mscc_miim_dev *dev;
int ret;
Expand All @@ -157,13 +156,10 @@ static int mscc_miim_probe(struct platform_device *pdev)
return PTR_ERR(dev->regs);
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (res) {
dev->phy_regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(dev->phy_regs)) {
dev_err(&pdev->dev, "Unable to map internal phy registers\n");
return PTR_ERR(dev->phy_regs);
}
dev->phy_regs = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(dev->phy_regs)) {
dev_err(&pdev->dev, "Unable to map internal phy registers\n");
return PTR_ERR(dev->phy_regs);
}

ret = of_mdiobus_register(bus, pdev->dev.of_node);
Expand Down

0 comments on commit 672a1c3

Please sign in to comment.