Commit 8ee1a0ee authored by Yang Yingliang's avatar Yang Yingliang Committed by David S. Miller

net: mdio: mscc-miim: Use devm_platform_get_and_ioremap_resource()

Use devm_platform_get_and_ioremap_resource() to simplify
code.
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 975f6262
...@@ -139,10 +139,6 @@ static int mscc_miim_probe(struct platform_device *pdev) ...@@ -139,10 +139,6 @@ static int mscc_miim_probe(struct platform_device *pdev)
struct mscc_miim_dev *dev; struct mscc_miim_dev *dev;
int ret; int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;
bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*dev)); bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*dev));
if (!bus) if (!bus)
return -ENOMEM; return -ENOMEM;
...@@ -155,7 +151,7 @@ static int mscc_miim_probe(struct platform_device *pdev) ...@@ -155,7 +151,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
bus->parent = &pdev->dev; bus->parent = &pdev->dev;
dev = bus->priv; dev = bus->priv;
dev->regs = devm_ioremap_resource(&pdev->dev, res); dev->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
if (IS_ERR(dev->regs)) { if (IS_ERR(dev->regs)) {
dev_err(&pdev->dev, "Unable to map MIIM registers\n"); dev_err(&pdev->dev, "Unable to map MIIM registers\n");
return PTR_ERR(dev->regs); return PTR_ERR(dev->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