]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: Convert to devm_ioremap_resource()
authorThierry Reding <thierry.reding@avionic-design.de>
Mon, 21 Jan 2013 10:09:19 +0000 (11:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2013 19:41:57 +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/staging/iio/adc/mxs-lradc.c
drivers/staging/nvec/nvec.c
drivers/staging/omap-thermal/omap-bandgap.c

index fb31b457a56a9b2b50fe96982ce083d25d89a032..1c7d2eb7b0e5d478be952b6df8e95749ff1a032e 100644 (file)
@@ -15,6 +15,7 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/err.h>
 #include <linux/interrupt.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
@@ -487,9 +488,9 @@ static int mxs_lradc_probe(struct platform_device *pdev)
        /* Grab the memory area */
        iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        lradc->dev = &pdev->dev;
-       lradc->base = devm_request_and_ioremap(dev, iores);
-       if (!lradc->base) {
-               ret = -EADDRNOTAVAIL;
+       lradc->base = devm_ioremap_resource(dev, iores);
+       if (IS_ERR(lradc->base)) {
+               ret = PTR_ERR(lradc->base);
                goto err_addr;
        }
 
index 2830946860d11e91d373b547c6050c076bf1f014..492e0b61f1e7918a408865f498a712fcc6385c55 100644 (file)
@@ -759,11 +759,9 @@ static int tegra_nvec_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       base = devm_request_and_ioremap(&pdev->dev, res);
-       if (!base) {
-               dev_err(&pdev->dev, "Can't ioremap I2C region\n");
-               return -ENOMEM;
-       }
+       base = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
 
        res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
        if (!res) {
index 8346e3450f837474ccbe0326772db66d2541e470..21fd91bf97b59f2fa7253261853221b96ea9f866 100644 (file)
@@ -820,15 +820,12 @@ static struct omap_bandgap *omap_bandgap_build(struct platform_device *pdev)
                res = platform_get_resource(pdev, IORESOURCE_MEM, i);
                if (!res)
                        break;
-               chunk = devm_request_and_ioremap(&pdev->dev, res);
+               chunk = devm_ioremap_resource(&pdev->dev, res);
                if (i == 0)
                        bg_ptr->base = chunk;
-               if (!chunk) {
-                       dev_err(&pdev->dev,
-                               "failed to request the IO (%d:%pR).\n",
-                               i, res);
-                       return ERR_PTR(-EADDRNOTAVAIL);
-               }
+               if (IS_ERR(chunk))
+                       return ERR_CAST(chunk);
+               
                i++;
        } while (res);