staging: Convert to devm_ioremap_resource()

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>
This commit is contained in:
Thierry Reding 2013-01-21 11:09:19 +01:00 committed by Greg Kroah-Hartman
parent 8cbce1e5f0
commit 97f4be6017
3 changed files with 11 additions and 15 deletions

View File

@ -15,6 +15,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <linux/err.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/kernel.h> #include <linux/kernel.h>
@ -487,9 +488,9 @@ static int mxs_lradc_probe(struct platform_device *pdev)
/* Grab the memory area */ /* Grab the memory area */
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
lradc->dev = &pdev->dev; lradc->dev = &pdev->dev;
lradc->base = devm_request_and_ioremap(dev, iores); lradc->base = devm_ioremap_resource(dev, iores);
if (!lradc->base) { if (IS_ERR(lradc->base)) {
ret = -EADDRNOTAVAIL; ret = PTR_ERR(lradc->base);
goto err_addr; goto err_addr;
} }

View File

@ -759,11 +759,9 @@ static int tegra_nvec_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
base = devm_request_and_ioremap(&pdev->dev, res); base = devm_ioremap_resource(&pdev->dev, res);
if (!base) { if (IS_ERR(base))
dev_err(&pdev->dev, "Can't ioremap I2C region\n"); return PTR_ERR(base);
return -ENOMEM;
}
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) { if (!res) {

View File

@ -820,15 +820,12 @@ static struct omap_bandgap *omap_bandgap_build(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, i); res = platform_get_resource(pdev, IORESOURCE_MEM, i);
if (!res) if (!res)
break; break;
chunk = devm_request_and_ioremap(&pdev->dev, res); chunk = devm_ioremap_resource(&pdev->dev, res);
if (i == 0) if (i == 0)
bg_ptr->base = chunk; bg_ptr->base = chunk;
if (!chunk) { if (IS_ERR(chunk))
dev_err(&pdev->dev, return ERR_CAST(chunk);
"failed to request the IO (%d:%pR).\n",
i, res);
return ERR_PTR(-EADDRNOTAVAIL);
}
i++; i++;
} while (res); } while (res);