net: mdio: mscc-miim: Use devm_platform_get_and_ioremap_resource()
Use devm_platform_get_and_ioremap_resource() to simplify code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
975f626267
commit
8ee1a0eed1
|
@ -139,10 +139,6 @@ static int mscc_miim_probe(struct platform_device *pdev)
|
|||
struct mscc_miim_dev *dev;
|
||||
int ret;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res)
|
||||
return -ENODEV;
|
||||
|
||||
bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*dev));
|
||||
if (!bus)
|
||||
return -ENOMEM;
|
||||
|
@ -155,7 +151,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
|
|||
bus->parent = &pdev->dev;
|
||||
|
||||
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)) {
|
||||
dev_err(&pdev->dev, "Unable to map MIIM registers\n");
|
||||
return PTR_ERR(dev->regs);
|
||||
|
|
Loading…
Reference in New Issue