From patchwork Fri Mar 29 02:42:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 2362101 Return-Path: X-Original-To: patchwork-ltsi-dev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) by patchwork1.kernel.org (Postfix) with ESMTP id B64D33FD40 for ; Fri, 29 Mar 2013 02:52:13 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [IPv6:::1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 845FDD15; Fri, 29 Mar 2013 02:46:27 +0000 (UTC) X-Original-To: ltsi-dev@lists.linuxfoundation.org Delivered-To: ltsi-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTP id 87C84B81 for ; Fri, 29 Mar 2013 02:46:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from kirsty.vergenet.net (kirsty.vergenet.net [202.4.237.240]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 54EB61F9A4 for ; Fri, 29 Mar 2013 02:46:14 +0000 (UTC) Received: from ayumi.akashicho.tokyo.vergenet.net (p8120-ipbfp1001kobeminato.hyogo.ocn.ne.jp [118.10.137.120]) by kirsty.vergenet.net (Postfix) with ESMTP id E94842C69DC; Fri, 29 Mar 2013 13:45:47 +1100 (EST) Received: by ayumi.akashicho.tokyo.vergenet.net (Postfix, from userid 7100) id 8D077EDEA2E; Fri, 29 Mar 2013 11:45:46 +0900 (JST) From: Simon Horman To: ltsi-dev@lists.linuxfoundation.org Date: Fri, 29 Mar 2013 11:42:12 +0900 Message-Id: <1364525119-31791-204-git-send-email-horms+renesas@verge.net.au> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1364525119-31791-1-git-send-email-horms+renesas@verge.net.au> References: <1364525119-31791-1-git-send-email-horms+renesas@verge.net.au> X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Magnus Damm Subject: [LTSI-dev] [PATCH/RFC 203/390] sh-pfc: Use devm_ioremap_nocache() X-BeenThere: ltsi-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "A list to discuss patches, development, and other things related to the LTSI project" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ltsi-dev-bounces@lists.linuxfoundation.org Errors-To: ltsi-dev-bounces@lists.linuxfoundation.org From: Laurent Pinchart Replace probe-time ioremap_nocache() call with devm_ioremap_nocache() and get rid of the corresponding iounmap() call. Signed-off-by: Laurent Pinchart Acked-by: Linus Walleij Signed-off-by: Simon Horman (cherry picked from commit c9fa88e23a8c6d1a72ba37c7d4df3d05051e8e8e) Signed-off-by: Simon Horman --- drivers/sh/pfc/core.c | 25 ++++--------------------- 1 file 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;