diff options
author | Grygorii Strashko <grygorii.strashko@ti.com> | 2014-04-30 16:23:36 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-03 00:16:26 +0400 |
commit | 9728e1a7d331fab8d1b625657596afa7391d0a95 (patch) | |
tree | 3f990d00fca12ef29d8c9dfbbe2c54b4e57c1f65 /drivers/net/ethernet/ti/davinci_mdio.c | |
parent | 4e8b4c802cb829d29a87fd905e4d74ecf22ef4b4 (diff) | |
download | linux-9728e1a7d331fab8d1b625657596afa7391d0a95.tar.xz |
net: davinci_mdio: simplify IO memory mapping
Simplify IO memory mapping by using devm_ioremap_resource()
which will do all errors handling and reporting for us.
Acked-and-tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti/davinci_mdio.c')
-rw-r--r-- | drivers/net/ethernet/ti/davinci_mdio.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 47571980f7ed..34e97eca561c 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c @@ -363,24 +363,9 @@ static int davinci_mdio_probe(struct platform_device *pdev) spin_lock_init(&data->lock); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, "could not find register map resource\n"); - ret = -ENOENT; - goto bail_out; - } - - res = devm_request_mem_region(dev, res->start, resource_size(res), - dev_name(dev)); - if (!res) { - dev_err(dev, "could not allocate register map resource\n"); - ret = -ENXIO; - goto bail_out; - } - - data->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); - if (!data->regs) { - dev_err(dev, "could not map mdio registers\n"); - ret = -ENOMEM; + data->regs = devm_ioremap_resource(dev, res); + if (IS_ERR(data->regs)) { + ret = PTR_ERR(data->regs); goto bail_out; } |