From patchwork Mon Feb 23 18:55:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 8457 X-Patchwork-Delegate: me@felipebalbi.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1NIuBJW028025 for ; Mon, 23 Feb 2009 18:56:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754744AbZBWSz4 (ORCPT ); Mon, 23 Feb 2009 13:55:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754793AbZBWSz4 (ORCPT ); Mon, 23 Feb 2009 13:55:56 -0500 Received: from ns1.siteground211.com ([209.62.36.12]:42436 "EHLO serv01.siteground211.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754744AbZBWSzz (ORCPT ); Mon, 23 Feb 2009 13:55:55 -0500 Received: from [91.154.126.168] (port=23095 helo=localhost.localdomain) by serv01.siteground211.com with esmtpa (Exim 4.69) (envelope-from ) id 1Lbfy3-0001at-GA; Mon, 23 Feb 2009 12:55:51 -0600 From: Felipe Balbi To: linux-omap@vger.kernel.org Cc: Steve Sakoman , Anand Gadiyar , Felipe Balbi Subject: [rft/rfc/patch-v2.6.29-rc5+ 05/23] usb: host: ehci: use resource helpers Date: Mon, 23 Feb 2009 20:55:17 +0200 Message-Id: <1235415335-17408-6-git-send-email-me@felipebalbi.com> X-Mailer: git-send-email 1.6.1.3 In-Reply-To: <1235415335-17408-5-git-send-email-me@felipebalbi.com> References: <1235415335-17408-1-git-send-email-me@felipebalbi.com> <1235415335-17408-2-git-send-email-me@felipebalbi.com> <1235415335-17408-3-git-send-email-me@felipebalbi.com> <1235415335-17408-4-git-send-email-me@felipebalbi.com> <1235415335-17408-5-git-send-email-me@felipebalbi.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - serv01.siteground211.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - felipebalbi.com Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Don't access pdev->resource[n].start directly, we can use the resource helpers for that, makes the code more readable. Signed-off-by: Felipe Balbi --- drivers/usb/host/ehci-omap.c | 22 ++++++++++------------ 1 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index e050795..d994392 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -410,24 +410,21 @@ static const struct hc_driver ehci_omap_hc_driver; * Allocates basic resources for this USB host controller, and * then invokes the start() method for the HCD associated with it * through the hotplug entry's driver_data. - * */ static int ehci_hcd_omap_drv_probe(struct platform_device *pdev) { - int retval = 0; - struct usb_hcd *hcd; struct ehci_hcd *ehci; + struct resource *res; + struct usb_hcd *hcd; + + int irq = platform_get_irq(pdev, 0); + int retval = 0; dev_dbg(&pdev->dev, "ehci_hcd_omap_drv_probe()\n"); if (usb_disabled()) return -ENODEV; - if (pdev->resource[1].flags != IORESOURCE_IRQ) { - dev_dbg(&pdev->dev, "resource[1] is not IORESOURCE_IRQ\n"); - retval = -ENOMEM; - } - hcd = usb_create_hcd(&ehci_omap_hc_driver, &pdev->dev, dev_name(&pdev->dev)); if (!hcd) @@ -437,10 +434,12 @@ static int ehci_hcd_omap_drv_probe(struct platform_device *pdev) if (retval) return retval; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + hcd->rsrc_start = 0; hcd->rsrc_len = 0; - hcd->rsrc_start = pdev->resource[0].start; - hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); if (!hcd->regs) { @@ -460,8 +459,7 @@ static int ehci_hcd_omap_drv_probe(struct platform_device *pdev) /* SET 1 micro-frame Interrupt interval */ writel(readl(&ehci->regs->command) | (1 << 16), &ehci->regs->command); - retval = usb_add_hcd(hcd, pdev->resource[1].start, - IRQF_DISABLED | IRQF_SHARED); + retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED); if (retval == 0) return retval;