diff options
author | Axel Lin <axel.lin@ingics.com> | 2012-11-12 14:45:50 +0800 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-11-15 11:21:45 +0100 |
commit | 9387760db221420f56a9f43a7d079c9fb209e32e (patch) | |
tree | 5ac8d12af9d4d4185c19d0b86be9f26ae4dbb81c /drivers/pinctrl/pinctrl-pxa3xx.c | |
parent | 507ccdbfd80020c402cbbf65ceeb3235edb79021 (diff) | |
download | blackbird-op-linux-9387760db221420f56a9f43a7d079c9fb209e32e.tar.gz blackbird-op-linux-9387760db221420f56a9f43a7d079c9fb209e32e.zip |
pinctrl: pxa3xx: Use devm_request_and_ioremap
Use managed resources API to simplify the code.
Also ensure we do request mem_region before ioremap.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-pxa3xx.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-pxa3xx.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c index f14cd6ba4c0b..43e3dd058ddb 100644 --- a/drivers/pinctrl/pinctrl-pxa3xx.c +++ b/drivers/pinctrl/pinctrl-pxa3xx.c @@ -173,7 +173,6 @@ int pxa3xx_pinctrl_register(struct platform_device *pdev, { struct pinctrl_desc *desc; struct resource *res; - int ret = 0; if (!info || !info->cputype) return -EINVAL; @@ -190,21 +189,17 @@ int pxa3xx_pinctrl_register(struct platform_device *pdev, return -ENOENT; info->phy_base = res->start; info->phy_size = resource_size(res); - info->virt_base = ioremap(info->phy_base, info->phy_size); + info->virt_base = devm_request_and_ioremap(&pdev->dev, res); if (!info->virt_base) return -ENOMEM; info->pctrl = pinctrl_register(desc, &pdev->dev, info); if (!info->pctrl) { dev_err(&pdev->dev, "failed to register PXA pinmux driver\n"); - ret = -EINVAL; - goto err; + return -EINVAL; } pinctrl_add_gpio_range(info->pctrl, &pxa3xx_pinctrl_gpio_range); platform_set_drvdata(pdev, info); return 0; -err: - iounmap(info->virt_base); - return ret; } int pxa3xx_pinctrl_unregister(struct platform_device *pdev) @@ -212,7 +207,6 @@ int pxa3xx_pinctrl_unregister(struct platform_device *pdev) struct pxa3xx_pinmux_info *info = platform_get_drvdata(pdev); pinctrl_unregister(info->pctrl); - iounmap(info->virt_base); platform_set_drvdata(pdev, NULL); return 0; } |