From patchwork Wed Jan 4 03:25:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9496073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE751606DD for ; Wed, 4 Jan 2017 03:28:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B111F27829 for ; Wed, 4 Jan 2017 03:28:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A609727C2D; Wed, 4 Jan 2017 03:28:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, SUSPICIOUS_RECIPS, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6EFA027D4A for ; Wed, 4 Jan 2017 03:28:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOcEB-0002DK-1L; Wed, 04 Jan 2017 03:27:03 +0000 Received: from bh-25.webhostbox.net ([208.91.199.152]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOcDx-00028L-Bb for linux-arm-kernel@lists.infradead.org; Wed, 04 Jan 2017 03:26:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=References:In-Reply-To:Message-Id:Date:Subject: Cc:To:From; bh=rJEZzxIpCHfCT47TY5I9oRXbexBjRocXwB9fWvTND6Q=; b=wwFWkXbsGZ+lD/ BXEoE9dXOnHJMee3x0Sp3cHQj2caB2HK0BYeHFGhbRcsjUxMMiKbgZcY9yPVY6/zmXU9ePy0ddcst oNnLZbQwn3DSxTb2U0wR/4/4Sjvv6Dmj744W3gK7vwGeCXBQz4wHISIgIMnLA+uI6wURDbffGdGzD jvFmGWC3GFc0UhO59bYfoeBwQflSRym7+CfI3l7FKFMYrVcrZsJ14ZyUZaEjzSTMkAiKf7Q+c462i 0weoSJ69JhO8h/OokRiCQYpj3R0vtp2AQflnat4LqRudphTsGEZSGxXo61d8RP4b378ccQ1Kbl9B5 djCFPmNhSl3p/lJmm/Sw==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:55230 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1cOcCz-002qm5-NL; Wed, 04 Jan 2017 03:25:50 +0000 From: Guenter Roeck To: Linus Walleij Subject: [PATCH 3/4] watchdog: coh901327_wdt: Use devm_ioremap_resource to map resources Date: Tue, 3 Jan 2017 19:25:42 -0800 Message-Id: <1483500343-27113-3-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483500343-27113-1-git-send-email-linux@roeck-us.net> References: <1483500343-27113-1-git-send-email-linux@roeck-us.net> X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=1.5 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170103_192649_552031_F644ABA8 X-CRM114-Status: UNSURE ( 8.99 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wim Van Sebroeck , Guenter Roeck , linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Map resources using devm_ioremap_resource() to simplify error handling. Signed-off-by: Guenter Roeck Reviewed-by: Linus Walleij --- drivers/watchdog/coh901327_wdt.c | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c index 1385a920df4f..986222efe174 100644 --- a/drivers/watchdog/coh901327_wdt.c +++ b/drivers/watchdog/coh901327_wdt.c @@ -68,8 +68,6 @@ /* Default timeout in seconds = 1 minute */ static unsigned int margin = 60; -static resource_size_t phybase; -static resource_size_t physize; static int irq; static void __iomem *virtbase; static struct device *parent; @@ -248,8 +246,6 @@ static int __exit coh901327_remove(struct platform_device *pdev) free_irq(irq, pdev); clk_disable_unprepare(clk); clk_put(clk); - iounmap(virtbase); - release_mem_region(phybase, physize); return 0; } @@ -259,30 +255,18 @@ static int __init coh901327_probe(struct platform_device *pdev) u16 val; struct resource *res; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENOENT; - parent = &pdev->dev; - physize = resource_size(res); - phybase = res->start; - - if (request_mem_region(phybase, physize, DRV_NAME) == NULL) { - ret = -EBUSY; - goto out; - } - virtbase = ioremap(phybase, physize); - if (!virtbase) { - ret = -ENOMEM; - goto out_no_remap; - } + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + virtbase = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(virtbase)) + return PTR_ERR(virtbase); clk = clk_get(&pdev->dev, NULL); if (IS_ERR(clk)) { ret = PTR_ERR(clk); dev_err(&pdev->dev, "could not get clock\n"); - goto out_no_clk; + return ret; } ret = clk_prepare_enable(clk); if (ret) { @@ -353,11 +337,6 @@ static int __init coh901327_probe(struct platform_device *pdev) clk_disable_unprepare(clk); out_no_clk_enable: clk_put(clk); -out_no_clk: - iounmap(virtbase); -out_no_remap: - release_mem_region(phybase, SZ_4K); -out: return ret; }