Commit 9e0c1fb2 authored by Thierry Reding's avatar Thierry Reding Committed by Greg Kroah-Hartman

pinctrl: 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: default avatarThierry Reding <thierry.reding@avionic-design.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1684789f
...@@ -1503,10 +1503,9 @@ static int at91_gpio_probe(struct platform_device *pdev) ...@@ -1503,10 +1503,9 @@ static int at91_gpio_probe(struct platform_device *pdev)
goto err; goto err;
} }
at91_chip->regbase = devm_request_and_ioremap(&pdev->dev, res); at91_chip->regbase = devm_ioremap_resource(&pdev->dev, res);
if (!at91_chip->regbase) { if (IS_ERR(at91_chip->regbase)) {
dev_err(&pdev->dev, "failed to map registers, ignoring.\n"); ret = PTR_ERR(at91_chip->regbase);
ret = -EBUSY;
goto err; goto err;
} }
......
...@@ -959,9 +959,9 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) ...@@ -959,9 +959,9 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
return err; return err;
} }
pc->base = devm_request_and_ioremap(dev, &iomem); pc->base = devm_ioremap_resource(dev, &iomem);
if (!pc->base) if (IS_ERR(pc->base))
return -EADDRNOTAVAIL; return PTR_ERR(pc->base);
pc->gpio_chip = bcm2835_gpio_chip; pc->gpio_chip = bcm2835_gpio_chip;
pc->gpio_chip.dev = dev; pc->gpio_chip.dev = dev;
......
...@@ -715,11 +715,9 @@ static int __init u300_gpio_probe(struct platform_device *pdev) ...@@ -715,11 +715,9 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
gpio->base = devm_request_and_ioremap(&pdev->dev, memres); gpio->base = devm_ioremap_resource(&pdev->dev, memres);
if (!gpio->base) { if (IS_ERR(gpio->base))
dev_err(gpio->dev, "could not get remap memory\n"); return PTR_ERR(gpio->base);
return -ENOMEM;
}
gpio->clk = devm_clk_get(gpio->dev, NULL); gpio->clk = devm_clk_get(gpio->dev, NULL);
if (IS_ERR(gpio->clk)) { if (IS_ERR(gpio->clk)) {
......
...@@ -866,11 +866,9 @@ static int exynos5440_pinctrl_probe(struct platform_device *pdev) ...@@ -866,11 +866,9 @@ static int exynos5440_pinctrl_probe(struct platform_device *pdev)
return -ENOENT; return -ENOENT;
} }
priv->reg_base = devm_request_and_ioremap(&pdev->dev, res); priv->reg_base = devm_ioremap_resource(&pdev->dev, res);
if (!priv->reg_base) { if (IS_ERR(priv->reg_base))
dev_err(dev, "ioremap failed\n"); return PTR_ERR(priv->reg_base);
return -ENODEV;
}
ret = exynos5440_gpiolib_register(pdev, priv); ret = exynos5440_gpiolib_register(pdev, priv);
if (ret) if (ret)
......
...@@ -411,14 +411,11 @@ static int pinctrl_falcon_probe(struct platform_device *pdev) ...@@ -411,14 +411,11 @@ static int pinctrl_falcon_probe(struct platform_device *pdev)
dev_err(&ppdev->dev, "failed to get clock\n"); dev_err(&ppdev->dev, "failed to get clock\n");
return PTR_ERR(falcon_info.clk[*bank]); return PTR_ERR(falcon_info.clk[*bank]);
} }
falcon_info.membase[*bank] = falcon_info.membase[*bank] = devm_ioremap_resource(&pdev->dev,
devm_request_and_ioremap(&pdev->dev, &res); &res);
if (!falcon_info.membase[*bank]) { if (IS_ERR(falcon_info.membase[*bank]))
dev_err(&pdev->dev, return PTR_ERR(falcon_info.membase[*bank]);
"Failed to remap memory for bank %d\n",
*bank);
return -ENOMEM;
}
avail = pad_r32(falcon_info.membase[*bank], avail = pad_r32(falcon_info.membase[*bank],
LTQ_PADC_AVAIL); LTQ_PADC_AVAIL);
pins = fls(avail); pins = fls(avail);
......
...@@ -584,9 +584,9 @@ int imx_pinctrl_probe(struct platform_device *pdev, ...@@ -584,9 +584,9 @@ int imx_pinctrl_probe(struct platform_device *pdev,
if (!res) if (!res)
return -ENOENT; return -ENOENT;
ipctl->base = devm_request_and_ioremap(&pdev->dev, res); ipctl->base = devm_ioremap_resource(&pdev->dev, res);
if (!ipctl->base) if (IS_ERR(ipctl->base))
return -EBUSY; return PTR_ERR(ipctl->base);
imx_pinctrl_desc.name = dev_name(&pdev->dev); imx_pinctrl_desc.name = dev_name(&pdev->dev);
imx_pinctrl_desc.pins = info->pins; imx_pinctrl_desc.pins = info->pins;
......
...@@ -1367,9 +1367,9 @@ static int nmk_gpio_probe(struct platform_device *dev) ...@@ -1367,9 +1367,9 @@ static int nmk_gpio_probe(struct platform_device *dev)
goto out; goto out;
} }
base = devm_request_and_ioremap(&dev->dev, res); base = devm_ioremap_resource(&dev->dev, res);
if (!base) { if (IS_ERR(base)) {
ret = -ENOMEM; ret = PTR_ERR(base);
goto out; goto out;
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* *
*/ */
#include <linux/err.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -187,9 +188,9 @@ int pxa3xx_pinctrl_register(struct platform_device *pdev, ...@@ -187,9 +188,9 @@ int pxa3xx_pinctrl_register(struct platform_device *pdev,
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) if (!res)
return -ENOENT; return -ENOENT;
info->virt_base = devm_request_and_ioremap(&pdev->dev, res); info->virt_base = devm_ioremap_resource(&pdev->dev, res);
if (!info->virt_base) if (IS_ERR(info->virt_base))
return -ENOMEM; return PTR_ERR(info->virt_base);
info->pctrl = pinctrl_register(desc, &pdev->dev, info); info->pctrl = pinctrl_register(desc, &pdev->dev, info);
if (!info->pctrl) { if (!info->pctrl) {
dev_err(&pdev->dev, "failed to register PXA pinmux driver\n"); dev_err(&pdev->dev, "failed to register PXA pinmux driver\n");
......
...@@ -917,11 +917,9 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) ...@@ -917,11 +917,9 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
return -ENOENT; return -ENOENT;
} }
drvdata->virt_base = devm_request_and_ioremap(&pdev->dev, res); drvdata->virt_base = devm_ioremap_resource(&pdev->dev, res);
if (!drvdata->virt_base) { if (IS_ERR(drvdata->virt_base))
dev_err(dev, "ioremap failed\n"); return PTR_ERR(drvdata->virt_base);
return -ENODEV;
}
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res) if (res)
......
...@@ -1078,9 +1078,9 @@ static int u300_pmx_probe(struct platform_device *pdev) ...@@ -1078,9 +1078,9 @@ static int u300_pmx_probe(struct platform_device *pdev)
if (!res) if (!res)
return -ENOENT; return -ENOENT;
upmx->virtbase = devm_request_and_ioremap(&pdev->dev, res); upmx->virtbase = devm_ioremap_resource(&pdev->dev, res);
if (!upmx->virtbase) if (IS_ERR(upmx->virtbase))
return -ENOMEM; return PTR_ERR(upmx->virtbase);
upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx); upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx);
if (!upmx->pctl) { if (!upmx->pctl) {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* Copyright (C) 2012 John Crispin <blogic@openwrt.org> * Copyright (C) 2012 John Crispin <blogic@openwrt.org>
*/ */
#include <linux/err.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
...@@ -687,11 +688,9 @@ static int pinmux_xway_probe(struct platform_device *pdev) ...@@ -687,11 +688,9 @@ static int pinmux_xway_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Failed to get resource\n"); dev_err(&pdev->dev, "Failed to get resource\n");
return -ENOENT; return -ENOENT;
} }
xway_info.membase[0] = devm_request_and_ioremap(&pdev->dev, res); xway_info.membase[0] = devm_ioremap_resource(&pdev->dev, res);
if (!xway_info.membase[0]) { if (IS_ERR(xway_info.membase[0]))
dev_err(&pdev->dev, "Failed to remap resource\n"); return PTR_ERR(xway_info.membase[0]);
return -ENOMEM;
}
match = of_match_device(xway_match, &pdev->dev); match = of_match_device(xway_match, &pdev->dev);
if (match) if (match)
......
...@@ -540,11 +540,9 @@ static int plgpio_probe(struct platform_device *pdev) ...@@ -540,11 +540,9 @@ static int plgpio_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
plgpio->base = devm_request_and_ioremap(&pdev->dev, res); plgpio->base = devm_ioremap_resource(&pdev->dev, res);
if (!plgpio->base) { if (IS_ERR(plgpio->base))
dev_err(&pdev->dev, "request and ioremap fail\n"); return PTR_ERR(plgpio->base);
return -ENOMEM;
}
ret = plgpio_probe_dt(pdev, plgpio); ret = plgpio_probe_dt(pdev, plgpio);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment