aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sh
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2012-12-15 17:50:49 -0500
committerSimon Horman <horms+renesas@verge.net.au>2013-01-24 19:24:21 -0500
commitc9fa88e23a8c6d1a72ba37c7d4df3d05051e8e8e (patch)
treec03472889a78caa9b150114bbfeaf8df087e0bab /drivers/sh
parent1724acfd598bdf688218bdd26a5f02dd55b6ec62 (diff)
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>
Diffstat (limited to 'drivers/sh')
-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 @@
26 26
27#include "core.h" 27#include "core.h"
28 28
29static void pfc_iounmap(struct sh_pfc *pfc)
30{
31 int k;
32
33 for (k = 0; k < pfc->pdata->num_resources; k++)
34 if (pfc->window[k].virt)
35 iounmap(pfc->window[k].virt);
36}
37
38static int pfc_ioremap(struct sh_pfc *pfc) 29static int pfc_ioremap(struct sh_pfc *pfc)
39{ 30{
40 struct resource *res; 31 struct resource *res;
@@ -53,12 +44,10 @@ static int pfc_ioremap(struct sh_pfc *pfc)
53 WARN_ON(resource_type(res) != IORESOURCE_MEM); 44 WARN_ON(resource_type(res) != IORESOURCE_MEM);
54 pfc->window[k].phys = res->start; 45 pfc->window[k].phys = res->start;
55 pfc->window[k].size = resource_size(res); 46 pfc->window[k].size = resource_size(res);
56 pfc->window[k].virt = ioremap_nocache(res->start, 47 pfc->window[k].virt = devm_ioremap_nocache(pfc->dev, res->start,
57 resource_size(res)); 48 resource_size(res));
58 if (!pfc->window[k].virt) { 49 if (!pfc->window[k].virt)
59 pfc_iounmap(pfc);
60 return -ENOMEM; 50 return -ENOMEM;
61 }
62 } 51 }
63 52
64 return 0; 53 return 0;
@@ -524,7 +513,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
524 */ 513 */
525 ret = sh_pfc_register_pinctrl(pfc); 514 ret = sh_pfc_register_pinctrl(pfc);
526 if (unlikely(ret != 0)) 515 if (unlikely(ret != 0))
527 goto err; 516 return ret;
528 517
529#ifdef CONFIG_GPIO_SH_PFC 518#ifdef CONFIG_GPIO_SH_PFC
530 /* 519 /*
@@ -546,10 +535,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
546 pr_info("%s support registered\n", pdata->name); 535 pr_info("%s support registered\n", pdata->name);
547 536
548 return 0; 537 return 0;
549
550err:
551 pfc_iounmap(pfc);
552 return ret;
553} 538}
554 539
555static int sh_pfc_remove(struct platform_device *pdev) 540static int sh_pfc_remove(struct platform_device *pdev)
@@ -561,8 +546,6 @@ static int sh_pfc_remove(struct platform_device *pdev)
561#endif 546#endif
562 sh_pfc_unregister_pinctrl(pfc); 547 sh_pfc_unregister_pinctrl(pfc);
563 548
564 pfc_iounmap(pfc);
565
566 platform_set_drvdata(pdev, NULL); 549 platform_set_drvdata(pdev, NULL);
567 550
568 return 0; 551 return 0;