diff options
Diffstat (limited to 'drivers/usb/host/ohci-at91.c')
-rw-r--r-- | drivers/usb/host/ohci-at91.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 418444ebb1b8..8c356af79409 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -136,23 +136,27 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
136 | struct ohci_hcd *ohci; | 136 | struct ohci_hcd *ohci; |
137 | int retval; | 137 | int retval; |
138 | struct usb_hcd *hcd = NULL; | 138 | struct usb_hcd *hcd = NULL; |
139 | 139 | struct device *dev = &pdev->dev; | |
140 | if (pdev->num_resources != 2) { | 140 | struct resource *res; |
141 | pr_debug("hcd probe: invalid num_resources"); | 141 | int irq; |
142 | return -ENODEV; | 142 | |
143 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
144 | if (!res) { | ||
145 | dev_dbg(dev, "hcd probe: missing memory resource\n"); | ||
146 | return -ENXIO; | ||
143 | } | 147 | } |
144 | 148 | ||
145 | if ((pdev->resource[0].flags != IORESOURCE_MEM) | 149 | irq = platform_get_irq(pdev, 0); |
146 | || (pdev->resource[1].flags != IORESOURCE_IRQ)) { | 150 | if (irq < 0) { |
147 | pr_debug("hcd probe: invalid resource type\n"); | 151 | dev_dbg(dev, "hcd probe: missing irq resource\n"); |
148 | return -ENODEV; | 152 | return irq; |
149 | } | 153 | } |
150 | 154 | ||
151 | hcd = usb_create_hcd(driver, &pdev->dev, "at91"); | 155 | hcd = usb_create_hcd(driver, &pdev->dev, "at91"); |
152 | if (!hcd) | 156 | if (!hcd) |
153 | return -ENOMEM; | 157 | return -ENOMEM; |
154 | hcd->rsrc_start = pdev->resource[0].start; | 158 | hcd->rsrc_start = res->start; |
155 | hcd->rsrc_len = resource_size(&pdev->resource[0]); | 159 | hcd->rsrc_len = resource_size(res); |
156 | 160 | ||
157 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 161 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
158 | pr_debug("request_mem_region failed\n"); | 162 | pr_debug("request_mem_region failed\n"); |
@@ -199,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
199 | ohci->num_ports = board->ports; | 203 | ohci->num_ports = board->ports; |
200 | at91_start_hc(pdev); | 204 | at91_start_hc(pdev); |
201 | 205 | ||
202 | retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_SHARED); | 206 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); |
203 | if (retval == 0) | 207 | if (retval == 0) |
204 | return retval; | 208 | return retval; |
205 | 209 | ||