From patchwork Sat Dec 15 22:50:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1883531 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3670EDF2EF for ; Sat, 15 Dec 2012 22:50:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752400Ab2LOWuz (ORCPT ); Sat, 15 Dec 2012 17:50:55 -0500 Received: from perceval.ideasonboard.com ([95.142.166.194]:40097 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752265Ab2LOWuz (ORCPT ); Sat, 15 Dec 2012 17:50:55 -0500 Received: from avalon.quadriga.com (unknown [194.136.87.226]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 86AEA35A90; Sat, 15 Dec 2012 23:50:54 +0100 (CET) From: Laurent Pinchart To: linux-sh@vger.kernel.org Cc: Paul Mundt , Magnus Damm , Simon Horman , Linus Walleij , Kuninori Morimoto , Phil Edworthy , Nobuhiro Iwamatsu Subject: [PATCH v3 15/81] sh-pfc: Use devm_ioremap_nocache() Date: Sat, 15 Dec 2012 23:50:49 +0100 Message-Id: <1355611915-25060-16-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1355611915-25060-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> References: <1355611915-25060-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Replace probe-time ioremap_nocache() call with devm_ioremap_nocache() and get rid of the corresponding iounmap() call. Signed-off-by: Laurent Pinchart --- drivers/sh/pfc/core.c | 25 ++++--------------------- 1 files changed, 4 insertions(+), 21 deletions(-) diff --git a/drivers/sh/pfc/core.c b/drivers/sh/pfc/core.c index 5491902..8ec57bd 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;