mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
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>
This commit is contained in:
parent
1684789f86
commit
9e0c1fb29a
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user