diff options
author | Eric Miao <eric.miao@marvell.com> | 2008-10-03 10:37:21 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-10-07 14:12:58 -0400 |
commit | 84bab7393b0da5086e133b7f333b800d26f7166b (patch) | |
tree | 6cc2d4bdc9137c8ebbc5edda3b54695c24a92b28 /drivers/usb/host/ohci-pxa27x.c | |
parent | 596050bc75a56ea4bd9942abafff6dca657da81c (diff) |
[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: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/usb/host/ohci-pxa27x.c')
-rw-r--r-- | drivers/usb/host/ohci-pxa27x.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 551581734c21..8530c6e9b770 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -255,18 +255,20 @@ static void pxa27x_stop_hc(struct device *dev) | |||
255 | */ | 255 | */ |
256 | int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev) | 256 | int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev) |
257 | { | 257 | { |
258 | int retval; | 258 | int retval, irq; |
259 | struct usb_hcd *hcd; | 259 | struct usb_hcd *hcd; |
260 | struct pxaohci_platform_data *inf; | 260 | struct pxaohci_platform_data *inf; |
261 | struct resource *r; | ||
261 | 262 | ||
262 | inf = pdev->dev.platform_data; | 263 | inf = pdev->dev.platform_data; |
263 | 264 | ||
264 | if (!inf) | 265 | if (!inf) |
265 | return -ENODEV; | 266 | return -ENODEV; |
266 | 267 | ||
267 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { | 268 | irq = platform_get_irq(pdev, 0); |
268 | pr_debug ("resource[1] is not IORESOURCE_IRQ"); | 269 | if (irq < 0) { |
269 | return -ENOMEM; | 270 | pr_err("no resource of IORESOURCE_IRQ"); |
271 | return -ENXIO; | ||
270 | } | 272 | } |
271 | 273 | ||
272 | usb_clk = clk_get(&pdev->dev, "USBCLK"); | 274 | 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 | hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); | 278 | hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); |
277 | if (!hcd) | 279 | if (!hcd) |
278 | return -ENOMEM; | 280 | return -ENOMEM; |
279 | hcd->rsrc_start = pdev->resource[0].start; | 281 | |
280 | hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; | 282 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
283 | if (!r) { | ||
284 | pr_err("no resource of IORESOURCE_MEM"); | ||
285 | retval = -ENXIO; | ||
286 | goto err1; | ||
287 | } | ||
288 | |||
289 | hcd->rsrc_start = r->start; | ||
290 | hcd->rsrc_len = resource_size(r); | ||
281 | 291 | ||
282 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 292 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
283 | pr_debug("request_mem_region failed"); | 293 | pr_debug("request_mem_region failed"); |
@@ -305,7 +315,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
305 | 315 | ||
306 | ohci_hcd_init(hcd_to_ohci(hcd)); | 316 | ohci_hcd_init(hcd_to_ohci(hcd)); |
307 | 317 | ||
308 | retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED); | 318 | retval = usb_add_hcd(hcd, irq, IRQF_DISABLED); |
309 | if (retval == 0) | 319 | if (retval == 0) |
310 | return retval; | 320 | return retval; |
311 | 321 | ||