From patchwork Wed Jun 11 19:18:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HIMANGI SARAOGI X-Patchwork-Id: 4338131 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 5DD029F3BC for ; Wed, 11 Jun 2014 19:22:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80D4B202BE for ; Wed, 11 Jun 2014 19:22:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 D976D2013A for ; Wed, 11 Jun 2014 19:22:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wuo3I-00031x-2c; Wed, 11 Jun 2014 19:19:16 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wuo3F-00030W-EC for linux-arm-kernel@lists.infradead.org; Wed, 11 Jun 2014 19:19:14 +0000 Received: by mail-pa0-f53.google.com with SMTP id kx10so127278pab.40 for ; Wed, 11 Jun 2014 12:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=aTSNQAe5hH4PvF2YtDMg1xMX1NN3p+xITvpoaO/YPsc=; b=yI+bDYCMpcjUAifI1MW8rhh9g6+dJexNDcxA28uUbQO4GA+IHbD+/J/eBrwXrkBnIm jlGJSOhQ36yifeLvPdH8I/UGZ/qQC2aEhjSoObkmSIh4TYxC9wtGGY8IecDOVxaJUIc/ ld4S7j4jod2WPJzcdkuZrVE1kLCsrX96X3sMYJTsAVavFP53+nYguh/tTQdX3L/xRS+w As1xlRwNHv/4U/VbZyMkJOZGoUKa+76bEEA1kS0klnwNftWI7GUrwoWVNXRfeorNFDUZ lkWMNV7vnKrwJOFbsAOSteXs3YhyD2G9o0aF0K5C3USG8C9bV4a7ZI2iKlcOS0OMCDSZ wsew== X-Received: by 10.66.139.73 with SMTP id qw9mr15867617pab.123.1402514331554; Wed, 11 Jun 2014 12:18:51 -0700 (PDT) Received: from localhost ([122.178.72.221]) by mx.google.com with ESMTPSA id fu12sm33323209pad.42.2014.06.11.12.18.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 11 Jun 2014 12:18:50 -0700 (PDT) Date: Thu, 12 Jun 2014 00:48:44 +0530 From: Himangi Saraogi To: Tony Prisk , Alan Stern , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] uhci-platform: use devm_ioremap resource Message-ID: <20140611191844.GA13009@himangi-Dell> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140611_121913_498637_F599E08A X-CRM114-Status: GOOD ( 13.55 ) X-Spam-Score: -0.6 (/) Cc: julia.lawall@lip6.fr X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 This patch replaces the memory allocation using request_mem_region and the ioremap by a single call to managed interface devm_ioremap_reource. The corresponding calls to release_mem_region and iounmap in the probe and release functions are now unnecessary and are removed. Also a label is done away with and linux/device.h is added to make sure the devm_*() outine declarations are unambiguously available. Signed-off-by: Himangi Saraogi Acked-by: Julia Lawall --- v2: pass correct arguments to devm_ioremap_resource Not compile tested due to incompatible architecture. drivers/usb/host/uhci-platform.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index 01833ab..b987f1d 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c @@ -8,6 +8,7 @@ */ #include +#include #include static int uhci_platform_init(struct usb_hcd *hcd) @@ -88,33 +89,22 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) hcd->rsrc_start = res->start; hcd->rsrc_len = resource_size(res); - if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { - pr_err("%s: request_mem_region failed\n", __func__); - ret = -EBUSY; + hcd->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(hcd->regs)) { + ret = PTR_ERR(hcd->regs); goto err_rmr; } - - hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); - if (!hcd->regs) { - pr_err("%s: ioremap failed\n", __func__); - ret = -ENOMEM; - goto err_irq; - } uhci = hcd_to_uhci(hcd); uhci->regs = hcd->regs; ret = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_SHARED); if (ret) - goto err_uhci; + goto err_rmr; device_wakeup_enable(hcd->self.controller); return 0; -err_uhci: - iounmap(hcd->regs); -err_irq: - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); err_rmr: usb_put_hcd(hcd); @@ -126,8 +116,6 @@ static int uhci_hcd_platform_remove(struct platform_device *pdev) struct usb_hcd *hcd = platform_get_drvdata(pdev); usb_remove_hcd(hcd); - iounmap(hcd->regs); - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); return 0;