Commit 672a1c39 authored by Cai Huoqing's avatar Cai Huoqing Committed by David S. Miller

net: mdio: mscc-miim: Make use of the helper function devm_platform_ioremap_resource()

Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately
Signed-off-by: default avatarCai Huoqing <caihuoqing@baidu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fa14d03e
...@@ -134,7 +134,6 @@ static int mscc_miim_reset(struct mii_bus *bus) ...@@ -134,7 +134,6 @@ static int mscc_miim_reset(struct mii_bus *bus)
static int mscc_miim_probe(struct platform_device *pdev) static int mscc_miim_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct mii_bus *bus; struct mii_bus *bus;
struct mscc_miim_dev *dev; struct mscc_miim_dev *dev;
int ret; int ret;
...@@ -157,14 +156,11 @@ static int mscc_miim_probe(struct platform_device *pdev) ...@@ -157,14 +156,11 @@ static int mscc_miim_probe(struct platform_device *pdev)
return PTR_ERR(dev->regs); return PTR_ERR(dev->regs);
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); dev->phy_regs = devm_platform_ioremap_resource(pdev, 1);
if (res) {
dev->phy_regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(dev->phy_regs)) { if (IS_ERR(dev->phy_regs)) {
dev_err(&pdev->dev, "Unable to map internal phy registers\n"); dev_err(&pdev->dev, "Unable to map internal phy registers\n");
return PTR_ERR(dev->phy_regs); return PTR_ERR(dev->phy_regs);
} }
}
ret = of_mdiobus_register(bus, pdev->dev.of_node); ret = of_mdiobus_register(bus, pdev->dev.of_node);
if (ret < 0) { if (ret < 0) {
......
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