diff options
author | Thierry Reding <thierry.reding@avionic-design.de> | 2013-01-21 11:09:14 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-22 11:41:57 -0800 |
commit | 9e0c1fb29a7c257a31c321c2437617b6b4d66168 (patch) | |
tree | ee0b93ff33eb3156339a1e72411c8bbad0c8c415 /drivers/pinctrl | |
parent | 1684789f86cbd6a1aff82970992c711898b19995 (diff) | |
download | linux-9e0c1fb29a7c257a31c321c2437617b6b4d66168.tar.bz2 |
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: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/pinctrl-at91.c | 7 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-bcm2835.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-coh901.c | 8 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-exynos5440.c | 8 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-falcon.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-imx.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-pxa3xx.c | 7 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-samsung.c | 8 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-u300.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-xway.c | 9 | ||||
-rw-r--r-- | drivers/pinctrl/spear/pinctrl-plgpio.c | 8 |
12 files changed, 40 insertions, 52 deletions
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 471c71f7f8b6..75933a6aa828 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -1503,10 +1503,9 @@ static int at91_gpio_probe(struct platform_device *pdev) goto err; } - at91_chip->regbase = devm_request_and_ioremap(&pdev->dev, res); - if (!at91_chip->regbase) { - dev_err(&pdev->dev, "failed to map registers, ignoring.\n"); - ret = -EBUSY; + at91_chip->regbase = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(at91_chip->regbase)) { + ret = PTR_ERR(at91_chip->regbase); goto err; } diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c index d347b9f2eae3..4eb6d2c4e4df 100644 --- a/drivers/pinctrl/pinctrl-bcm2835.c +++ b/drivers/pinctrl/pinctrl-bcm2835.c @@ -959,9 +959,9 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) return err; } - pc->base = devm_request_and_ioremap(dev, &iomem); - if (!pc->base) - return -EADDRNOTAVAIL; + pc->base = devm_ioremap_resource(dev, &iomem); + if (IS_ERR(pc->base)) + return PTR_ERR(pc->base); pc->gpio_chip = bcm2835_gpio_chip; pc->gpio_chip.dev = dev; diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c index fbb37154471c..8b7e7bc2226b 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c @@ -715,11 +715,9 @@ static int __init u300_gpio_probe(struct platform_device *pdev) return -ENODEV; } - gpio->base = devm_request_and_ioremap(&pdev->dev, memres); - if (!gpio->base) { - dev_err(gpio->dev, "could not get remap memory\n"); - return -ENOMEM; - } + gpio->base = devm_ioremap_resource(&pdev->dev, memres); + if (IS_ERR(gpio->base)) + return PTR_ERR(gpio->base); gpio->clk = devm_clk_get(gpio->dev, NULL); if (IS_ERR(gpio->clk)) { diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c index de05b64f0da6..5e77242cb0db 100644 --- a/drivers/pinctrl/pinctrl-exynos5440.c +++ b/drivers/pinctrl/pinctrl-exynos5440.c @@ -866,11 +866,9 @@ static int exynos5440_pinctrl_probe(struct platform_device *pdev) return -ENOENT; } - priv->reg_base = devm_request_and_ioremap(&pdev->dev, res); - if (!priv->reg_base) { - dev_err(dev, "ioremap failed\n"); - return -ENODEV; - } + priv->reg_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(priv->reg_base)) + return PTR_ERR(priv->reg_base); ret = exynos5440_gpiolib_register(pdev, priv); if (ret) diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c index 8ed20e84cb02..a5d9d562d966 100644 --- a/drivers/pinctrl/pinctrl-falcon.c +++ b/drivers/pinctrl/pinctrl-falcon.c @@ -411,14 +411,11 @@ static int pinctrl_falcon_probe(struct platform_device *pdev) dev_err(&ppdev->dev, "failed to get clock\n"); return PTR_ERR(falcon_info.clk[*bank]); } - falcon_info.membase[*bank] = - devm_request_and_ioremap(&pdev->dev, &res); - if (!falcon_info.membase[*bank]) { - dev_err(&pdev->dev, - "Failed to remap memory for bank %d\n", - *bank); - return -ENOMEM; - } + falcon_info.membase[*bank] = devm_ioremap_resource(&pdev->dev, + &res); + if (IS_ERR(falcon_info.membase[*bank])) + return PTR_ERR(falcon_info.membase[*bank]); + avail = pad_r32(falcon_info.membase[*bank], LTQ_PADC_AVAIL); pins = fls(avail); diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c index 43a6f1ffc786..4cebb9c6c5c5 100644 --- a/drivers/pinctrl/pinctrl-imx.c +++ b/drivers/pinctrl/pinctrl-imx.c @@ -584,9 +584,9 @@ int imx_pinctrl_probe(struct platform_device *pdev, if (!res) return -ENOENT; - ipctl->base = devm_request_and_ioremap(&pdev->dev, res); - if (!ipctl->base) - return -EBUSY; + ipctl->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(ipctl->base)) + return PTR_ERR(ipctl->base); imx_pinctrl_desc.name = dev_name(&pdev->dev); imx_pinctrl_desc.pins = info->pins; diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 1bb16ffb4e41..96e7cfbbce6d 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c @@ -1367,9 +1367,9 @@ static int nmk_gpio_probe(struct platform_device *dev) goto out; } - base = devm_request_and_ioremap(&dev->dev, res); - if (!base) { - ret = -ENOMEM; + base = devm_ioremap_resource(&dev->dev, res); + if (IS_ERR(base)) { + ret = PTR_ERR(base); goto out; } diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c index 51f8a388b917..1f49bb02a6af 100644 --- a/drivers/pinctrl/pinctrl-pxa3xx.c +++ b/drivers/pinctrl/pinctrl-pxa3xx.c @@ -11,6 +11,7 @@ * */ +#include <linux/err.h> #include <linux/module.h> #include <linux/device.h> #include <linux/io.h> @@ -187,9 +188,9 @@ int pxa3xx_pinctrl_register(struct platform_device *pdev, res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENOENT; - info->virt_base = devm_request_and_ioremap(&pdev->dev, res); - if (!info->virt_base) - return -ENOMEM; + info->virt_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(info->virt_base)) + return PTR_ERR(info->virt_base); info->pctrl = pinctrl_register(desc, &pdev->dev, info); if (!info->pctrl) { dev_err(&pdev->dev, "failed to register PXA pinmux driver\n"); diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index fd7b24cd8908..7e6669cfa58f 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c @@ -917,11 +917,9 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) return -ENOENT; } - drvdata->virt_base = devm_request_and_ioremap(&pdev->dev, res); - if (!drvdata->virt_base) { - dev_err(dev, "ioremap failed\n"); - return -ENODEV; - } + drvdata->virt_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(drvdata->virt_base)) + return PTR_ERR(drvdata->virt_base); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (res) diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c index 718ec5762683..2b5772550836 100644 --- a/drivers/pinctrl/pinctrl-u300.c +++ b/drivers/pinctrl/pinctrl-u300.c @@ -1078,9 +1078,9 @@ static int u300_pmx_probe(struct platform_device *pdev) if (!res) return -ENOENT; - upmx->virtbase = devm_request_and_ioremap(&pdev->dev, res); - if (!upmx->virtbase) - return -ENOMEM; + upmx->virtbase = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(upmx->virtbase)) + return PTR_ERR(upmx->virtbase); upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx); if (!upmx->pctl) { diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c index 5f0eb04c2336..ae8f3a02ed97 100644 --- a/drivers/pinctrl/pinctrl-xway.c +++ b/drivers/pinctrl/pinctrl-xway.c @@ -9,6 +9,7 @@ * Copyright (C) 2012 John Crispin <blogic@openwrt.org> */ +#include <linux/err.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/of_platform.h> @@ -687,11 +688,9 @@ static int pinmux_xway_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to get resource\n"); return -ENOENT; } - xway_info.membase[0] = devm_request_and_ioremap(&pdev->dev, res); - if (!xway_info.membase[0]) { - dev_err(&pdev->dev, "Failed to remap resource\n"); - return -ENOMEM; - } + xway_info.membase[0] = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(xway_info.membase[0])) + return PTR_ERR(xway_info.membase[0]); match = of_match_device(xway_match, &pdev->dev); if (match) diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c index 3cf4ecd9302c..295b349a05cf 100644 --- a/drivers/pinctrl/spear/pinctrl-plgpio.c +++ b/drivers/pinctrl/spear/pinctrl-plgpio.c @@ -540,11 +540,9 @@ static int plgpio_probe(struct platform_device *pdev) return -ENOMEM; } - plgpio->base = devm_request_and_ioremap(&pdev->dev, res); - if (!plgpio->base) { - dev_err(&pdev->dev, "request and ioremap fail\n"); - return -ENOMEM; - } + plgpio->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(plgpio->base)) + return PTR_ERR(plgpio->base); ret = plgpio_probe_dt(pdev, plgpio); if (ret) { |