From patchwork Sat May 10 12:00:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 4148081 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 F120CBFF02 for ; Sat, 10 May 2014 12:03:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11F25201E7 for ; Sat, 10 May 2014 12:03:23 +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 3C54920145 for ; Sat, 10 May 2014 12:03:22 +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 1Wj5xl-0002yp-Hp; Sat, 10 May 2014 12:01:09 +0000 Received: from mail-pd0-x233.google.com ([2607:f8b0:400e:c02::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wj5xX-0002r7-Nn for linux-arm-kernel@lists.infradead.org; Sat, 10 May 2014 12:00:56 +0000 Received: by mail-pd0-f179.google.com with SMTP id g10so4726877pdj.38 for ; Sat, 10 May 2014 05:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=o8l5257nNLYFk4MuV3Rs2Nia5g27CBSVDlyhGPiGZSU=; b=TZM9zt0j2NJL1PUUMkoUHxyt48NjHQxvj1QiszyJyHJPB7r6rexMRZ0LgY9fWBZmb1 8O9tzT9Mgd3DQVAnJYIcZelRk2w3Gm23cblgdHCHUOJ+RtVMbRkT0BKZi1X+x8Q/aqaF j1zC0Z398iQaXsQcEDPh/rH45P3ficZmUz6KGzZt4tzRPehP50VuQ49CdEgPgwFTkP6k k54hmX+yf0eicvO86y6Ybn/Ek6RCDRhMPvlny2NRNAijIEk27q3jhrv2VmCqgJHlNe8u WqtU+UdxWVmtI04Pz/dq4+3ypF1VQd0pKGJtfS69UdMS1X/ujj/KeYHAnIDZM/VtDPSP cMkA== X-Received: by 10.66.189.106 with SMTP id gh10mr32256523pac.31.1399723234636; Sat, 10 May 2014 05:00:34 -0700 (PDT) Received: from vivek-linuxpc.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id tb4sm21186685pac.45.2014.05.10.05.00.30 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 10 May 2014 05:00:34 -0700 (PDT) From: Vivek Gautam To: linux-usb@vger.kernel.org Subject: [PATCH v2 4/6] usb: host: ehci-spear: Use devm_ioremap_resource instead of devm_ioremap Date: Sat, 10 May 2014 17:30:08 +0530 Message-Id: <1399723210-21569-5-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1399723210-21569-1-git-send-email-gautam.vivek@samsung.com> References: <1399723210-21569-1-git-send-email-gautam.vivek@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140510_050055_811152_23812032 X-CRM114-Status: GOOD ( 11.79 ) X-Spam-Score: 0.2 (/) Cc: linux-samsung-soc@vger.kernel.org, shc_work@mail.ru, swarren@wwwdotorg.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, kgene.kim@samsung.com, stern@rowland.harvard.edu, Vivek Gautam , linux-tegra@vger.kernel.org, thierry.reding@gmail.com, linux-arm-kernel@lists.infradead.org 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=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 Using devm_ioremap_resource() API should actually be preferred over devm_ioremap(), since the former request the mem region first and then gives back the ioremap'ed memory pointer. devm_ioremap_resource() calls request_mem_region(), therby preventing other drivers to make any overlapping call to the same region. Signed-off-by: Vivek Gautam --- drivers/usb/host/ehci-spear.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index 8bd915b..1d59958 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c @@ -106,16 +106,9 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) hcd->rsrc_start = res->start; hcd->rsrc_len = resource_size(res); - if (!devm_request_mem_region(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len, - driver->description)) { - retval = -EBUSY; - goto err_put_hcd; - } - - hcd->regs = devm_ioremap(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len); - if (hcd->regs == NULL) { - dev_dbg(&pdev->dev, "error mapping memory\n"); - retval = -ENOMEM; + hcd->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(hcd->regs)) { + retval = PTR_ERR(hcd->regs); goto err_put_hcd; }