From patchwork Tue Dec 3 14:07:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 3276381 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 524079F380 for ; Tue, 3 Dec 2013 14:10:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2AEE220111 for ; Tue, 3 Dec 2013 14:10:06 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 658A0200C6 for ; Tue, 3 Dec 2013 14:10:01 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vnqer-0000Cz-KA; Tue, 03 Dec 2013 14:09:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vnqee-0004zP-Th; Tue, 03 Dec 2013 14:08:48 +0000 Received: from 19.mo1.mail-out.ovh.net ([178.32.97.206] helo=mo1.mail-out.ovh.net) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vnqec-0004x7-A0 for linux-arm-kernel@lists.infradead.org; Tue, 03 Dec 2013 14:08:46 +0000 Received: from mail431.ha.ovh.net (gw6.ovh.net [213.251.189.206]) by mo1.mail-out.ovh.net (Postfix) with SMTP id 2179CFFB4B6 for ; Tue, 3 Dec 2013 15:11:14 +0100 (CET) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 3 Dec 2013 16:15:06 +0200 Received: from unknown (HELO bbrezillon-laptop.private.s2ih) (b.brezillon@overkiz.com@80.245.18.66) by ns0.ovh.net with SMTP; 3 Dec 2013 16:15:05 +0200 From: Boris BREZILLON To: Douglas Gilbert , Nicolas Ferre , Tomasz Figa , Alan Stern , Greg Kroah-Hartman Subject: [PATCH 2/3] usb: ohci-at91: replace request_mem_region + ioremap by devm_request_and_ioremap Date: Tue, 3 Dec 2013 15:07:48 +0100 Message-Id: <1386079669-3995-3-git-send-email-b.brezillon@overkiz.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386079669-3995-1-git-send-email-b.brezillon@overkiz.com> References: <1386079669-3995-1-git-send-email-b.brezillon@overkiz.com> X-Ovh-Tracer-Id: 16672044347201714433 X-Ovh-Remote: 80.245.18.66 () X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-OVH-SPAMSTATE: OK X-OVH-SPAMSCORE: -100 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeiledrkeegucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-Spam-Check: DONE|U 0.5/N X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeiledrkeegucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131203_090846_427043_3EDCEAD2 X-CRM114-Status: GOOD ( 12.92 ) X-Spam-Score: -1.9 (-) Cc: Grant Likely , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Boris BREZILLON X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace the request_mem_region + ioremap calls by the devm_request_and_ioremap call which does the same things but with device managed resources. Signed-off-by: Boris BREZILLON Tested-by: Robert Nelson Acked-by: Nicolas Ferre --- drivers/usb/host/ohci-at91.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 7aec6ca..c406f1e 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -157,24 +157,18 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, hcd->rsrc_start = mem_r->start; hcd->rsrc_len = resource_size(mem_r); - if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { - pr_debug("request_mem_region failed\n"); - retval = -EBUSY; - goto err1; - } - - hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); + hcd->regs = devm_request_and_ioremap(&pdev->dev, mem_r); if (!hcd->regs) { - pr_debug("ioremap failed\n"); + dev_dbg(dev, "devm_request_and_ioremap failed\n"); retval = -EIO; - goto err2; + goto err; } iclk = clk_get(&pdev->dev, "ohci_clk"); if (IS_ERR(iclk)) { dev_err(&pdev->dev, "failed to get ohci_clk\n"); retval = PTR_ERR(iclk); - goto err3; + goto err; } fclk = clk_get(&pdev->dev, "uhpck"); if (IS_ERR(fclk)) { @@ -218,13 +212,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, err4: clk_put(iclk); - err3: - iounmap(hcd->regs); - - err2: - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); - - err1: + err: usb_put_hcd(hcd); return retval; } @@ -247,8 +235,6 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd, { usb_remove_hcd(hcd); at91_stop_hc(pdev); - iounmap(hcd->regs); - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); if (IS_ENABLED(CONFIG_COMMON_CLK))