@@ -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;
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 <me@felipebalbi.com> --- drivers/usb/host/ehci-omap.c | 22 ++++++++++------------ 1 files changed, 10 insertions(+), 12 deletions(-)