Commit 84bab739 authored by Eric Miao's avatar Eric Miao Committed by Russell King

[ARM] ohci-pxa27x: use platform_get_{irq,resource} for the resource

Depending on the order of how resource is defined in the platform
device is not good, use platform_get_{irq,resource} for the IRQ
and memory resources.
Signed-off-by: default avatarEric Miao <eric.miao@marvell.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 596050bc
...@@ -255,18 +255,20 @@ static void pxa27x_stop_hc(struct device *dev) ...@@ -255,18 +255,20 @@ static void pxa27x_stop_hc(struct device *dev)
*/ */
int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev) int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev)
{ {
int retval; int retval, irq;
struct usb_hcd *hcd; struct usb_hcd *hcd;
struct pxaohci_platform_data *inf; struct pxaohci_platform_data *inf;
struct resource *r;
inf = pdev->dev.platform_data; inf = pdev->dev.platform_data;
if (!inf) if (!inf)
return -ENODEV; return -ENODEV;
if (pdev->resource[1].flags != IORESOURCE_IRQ) { irq = platform_get_irq(pdev, 0);
pr_debug ("resource[1] is not IORESOURCE_IRQ"); if (irq < 0) {
return -ENOMEM; pr_err("no resource of IORESOURCE_IRQ");
return -ENXIO;
} }
usb_clk = clk_get(&pdev->dev, "USBCLK"); usb_clk = clk_get(&pdev->dev, "USBCLK");
...@@ -276,8 +278,16 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device ...@@ -276,8 +278,16 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x");
if (!hcd) if (!hcd)
return -ENOMEM; return -ENOMEM;
hcd->rsrc_start = pdev->resource[0].start;
hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) {
pr_err("no resource of IORESOURCE_MEM");
retval = -ENXIO;
goto err1;
}
hcd->rsrc_start = r->start;
hcd->rsrc_len = resource_size(r);
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
pr_debug("request_mem_region failed"); pr_debug("request_mem_region failed");
...@@ -305,7 +315,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device ...@@ -305,7 +315,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
ohci_hcd_init(hcd_to_ohci(hcd)); ohci_hcd_init(hcd_to_ohci(hcd));
retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED); retval = usb_add_hcd(hcd, irq, IRQF_DISABLED);
if (retval == 0) if (retval == 0)
return retval; return retval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment