From patchwork Sun Jun 8 08:05:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HIMANGI SARAOGI X-Patchwork-Id: 4316741 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B02D6BEEAA for ; Sun, 8 Jun 2014 08:09:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5A7920270 for ; Sun, 8 Jun 2014 08:09:57 +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 962F0201FB for ; Sun, 8 Jun 2014 08:09:56 +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 1WtY6q-0001bu-RM; Sun, 08 Jun 2014 08:05:44 +0000 Received: from mail-ie0-x236.google.com ([2607:f8b0:4001:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WtY6n-0001bV-6J for linux-arm-kernel@lists.infradead.org; Sun, 08 Jun 2014 08:05:42 +0000 Received: by mail-ie0-f182.google.com with SMTP id x19so4284528ier.41 for ; Sun, 08 Jun 2014 01:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=QcvD591CnJdUabv10IC7bPmsa0N3rMROLA5HmdemdPQ=; b=k3O/PA4N2JX0vRH3bf0s5VqGDRV1HKwJSJPg3eO/Co5rjJaPe1Hc3CoZZnpXW/2Rc7 lA5lRXYjkj0yKPTvo8mzzItaw05sl/c34oJkn+RhJ1rzX80mZUqYYG5iKHJsziJz3ChZ QtFttTmKCCU9exgm4g52qTllzri7mdQElsWqJtuYNDPrtXuGgKAdQy9ze+axaAjcUW3q 6rzuyVPdnPknXDm+B/P23bn7ruKWWbBRyD38EBatRrXS+ZFP1YwP6GPMl5w7n/+g5jm1 tR6UjSsV0xS8qnJrM9iaZX67BzQFERXKfoEpyl2KJvIlqhCQN/Ka4sWxHKsMBkQBR9u7 fOoA== X-Received: by 10.42.188.203 with SMTP id db11mr2423601icb.63.1402214717544; Sun, 08 Jun 2014 01:05:17 -0700 (PDT) Received: from localhost ([182.65.223.70]) by mx.google.com with ESMTPSA id 8sm77137724igr.2.2014.06.08.01.05.13 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 08 Jun 2014 01:05:16 -0700 (PDT) Date: Sun, 8 Jun 2014 13:35:09 +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] uhci-platform: use devm_ioremap resource Message-ID: <20140608080509.GA3748@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-20140608_010541_334845_13FFF0B8 X-CRM114-Status: GOOD ( 13.90 ) X-Spam-Score: 0.1 (/) 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: , 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 --- Not compile tested due to incompatible architecture. drivers/usb/host/uhci-platform.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index 01833ab..34248a6 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,23 @@ 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, hcd->rsrc_start, + hcd->rsrc_len); + 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 +117,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;