summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2012-12-16 02:50:49 +0400
committerSimon Horman <horms+renesas@verge.net.au>2013-01-25 04:24:21 +0400
commitc9fa88e23a8c6d1a72ba37c7d4df3d05051e8e8e (patch)
treec03472889a78caa9b150114bbfeaf8df087e0bab
parent1724acfd598bdf688218bdd26a5f02dd55b6ec62 (diff)
downloadlinux-c9fa88e23a8c6d1a72ba37c7d4df3d05051e8e8e.tar.xz
sh-pfc: Use devm_ioremap_nocache()
Replace probe-time ioremap_nocache() call with devm_ioremap_nocache() and get rid of the corresponding iounmap() call. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r--drivers/sh/pfc/core.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/drivers/sh/pfc/core.c b/drivers/sh/pfc/core.c
index 54919026ac12..8ec57bd5b1f9 100644
--- a/drivers/sh/pfc/core.c
+++ b/drivers/sh/pfc/core.c
@@ -26,15 +26,6 @@
#include "core.h"
-static void pfc_iounmap(struct sh_pfc *pfc)
-{
- int k;
-
- for (k = 0; k < pfc->pdata->num_resources; k++)
- if (pfc->window[k].virt)
- iounmap(pfc->window[k].virt);
-}
-
static int pfc_ioremap(struct sh_pfc *pfc)
{
struct resource *res;
@@ -53,12 +44,10 @@ static int pfc_ioremap(struct sh_pfc *pfc)
WARN_ON(resource_type(res) != IORESOURCE_MEM);
pfc->window[k].phys = res->start;
pfc->window[k].size = resource_size(res);
- pfc->window[k].virt = ioremap_nocache(res->start,
- resource_size(res));
- if (!pfc->window[k].virt) {
- pfc_iounmap(pfc);
+ pfc->window[k].virt = devm_ioremap_nocache(pfc->dev, res->start,
+ resource_size(res));
+ if (!pfc->window[k].virt)
return -ENOMEM;
- }
}
return 0;
@@ -524,7 +513,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
*/
ret = sh_pfc_register_pinctrl(pfc);
if (unlikely(ret != 0))
- goto err;
+ return ret;
#ifdef CONFIG_GPIO_SH_PFC
/*
@@ -546,10 +535,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
pr_info("%s support registered\n", pdata->name);
return 0;
-
-err:
- pfc_iounmap(pfc);
- return ret;
}
static int sh_pfc_remove(struct platform_device *pdev)
@@ -561,8 +546,6 @@ static int sh_pfc_remove(struct platform_device *pdev)
#endif
sh_pfc_unregister_pinctrl(pfc);
- pfc_iounmap(pfc);
-
platform_set_drvdata(pdev, NULL);
return 0;