memory: Convert to devm_ioremap_resource()
authorThierry Reding <thierry.reding@avionic-design.de>
Mon, 21 Jan 2013 10:09:08 +0000 (11:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2013 19:41:56 +0000 (11:41 -0800)
Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/memory/emif.c
drivers/memory/tegra20-mc.c
drivers/memory/tegra30-mc.c

index 06d31c99e6ac22e166027a5a3666ca810931581b..df0873694858e74b3fdeaa3066c33840cb2ec7dc 100644 (file)
@@ -10,6 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/reboot.h>
 #include <linux/platform_data/emif_plat.h>
@@ -1468,12 +1469,9 @@ static int __init_or_module emif_probe(struct platform_device *pdev)
                goto error;
        }
 
-       emif->base = devm_request_and_ioremap(emif->dev, res);
-       if (!emif->base) {
-               dev_err(emif->dev, "%s: devm_request_and_ioremap() failed\n",
-                       __func__);
+       emif->base = devm_ioremap_resource(emif->dev, res);
+       if (IS_ERR(emif->base))
                goto error;
-       }
 
        irq = platform_get_irq(pdev, 0);
        if (irq < 0) {
index 186f27d9e5f1ac25e2302f04bcedc1c656c19f4f..2ca5f2814f4a6ab317e995a6f6a3e404617350e2 100644 (file)
@@ -17,6 +17,7 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/ratelimit.h>
@@ -216,9 +217,9 @@ static int tegra20_mc_probe(struct platform_device *pdev)
                res = platform_get_resource(pdev, IORESOURCE_MEM, i);
                if (!res)
                        return -ENODEV;
-               mc->regs[i] = devm_request_and_ioremap(&pdev->dev, res);
-               if (!mc->regs[i])
-                       return -EBUSY;
+               mc->regs[i] = devm_ioremap_resource(&pdev->dev, res);
+               if (IS_ERR(mc->regs[i]))
+                       return PTR_ERR(mc->regs[i]);
        }
 
        irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
index 0b7ab9332a182b867ad0375b5c1a31632eb4969e..0b975986777db93a4db42959e8fe599c040e2810 100644 (file)
@@ -17,6 +17,7 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/ratelimit.h>
@@ -336,9 +337,9 @@ static int tegra30_mc_probe(struct platform_device *pdev)
                res = platform_get_resource(pdev, IORESOURCE_MEM, i);
                if (!res)
                        return -ENODEV;
-               mc->regs[i] = devm_request_and_ioremap(&pdev->dev, res);
-               if (!mc->regs[i])
-                       return -EBUSY;
+               mc->regs[i] = devm_ioremap_resource(&pdev->dev, res);
+               if (IS_ERR(mc->regs[i]))
+                       return PTR_ERR(mc->regs[i]);
        }
 
        irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);