Commit 6d729a55 authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: host: extract dwc3_host_get_irq()

Cleanup only, no functional changes.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 6db3812e
...@@ -19,47 +19,59 @@ ...@@ -19,47 +19,59 @@
#include "core.h" #include "core.h"
int dwc3_host_init(struct dwc3 *dwc) static int dwc3_host_get_irq(struct dwc3 *dwc)
{ {
struct property_entry props[2];
struct platform_device *xhci;
int ret, irq;
struct resource *res;
struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); struct platform_device *dwc3_pdev = to_platform_device(dwc->dev);
int irq;
irq = platform_get_irq_byname(dwc3_pdev, "host"); irq = platform_get_irq_byname(dwc3_pdev, "host");
if (irq > 0)
goto out;
if (irq == -EPROBE_DEFER) if (irq == -EPROBE_DEFER)
return irq; goto out;
if (irq <= 0) {
irq = platform_get_irq_byname(dwc3_pdev, "dwc_usb3"); irq = platform_get_irq_byname(dwc3_pdev, "dwc_usb3");
if (irq > 0)
goto out;
if (irq == -EPROBE_DEFER) if (irq == -EPROBE_DEFER)
return irq; goto out;
if (irq <= 0) {
irq = platform_get_irq(dwc3_pdev, 0); irq = platform_get_irq(dwc3_pdev, 0);
if (irq <= 0) { if (irq > 0)
if (irq != -EPROBE_DEFER) { goto out;
dev_err(dwc->dev,
"missing host IRQ\n"); if (irq != -EPROBE_DEFER)
} dev_err(dwc->dev, "missing host IRQ\n");
if (!irq) if (!irq)
irq = -EINVAL; irq = -EINVAL;
out:
return irq; return irq;
} else { }
res = platform_get_resource(dwc3_pdev,
IORESOURCE_IRQ, 0);
}
} else {
res = platform_get_resource_byname(dwc3_pdev,
IORESOURCE_IRQ,
"dwc_usb3");
}
} else { int dwc3_host_init(struct dwc3 *dwc)
{
struct property_entry props[2];
struct platform_device *xhci;
int ret, irq;
struct resource *res;
struct platform_device *dwc3_pdev = to_platform_device(dwc->dev);
irq = dwc3_host_get_irq(dwc);
if (irq < 0)
return irq;
res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, "host");
if (!res)
res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ,
"host"); "dwc_usb3");
} if (!res)
res = platform_get_resource(dwc3_pdev, IORESOURCE_IRQ, 0);
if (!res)
return -ENOMEM;
dwc->xhci_resources[1].start = irq; dwc->xhci_resources[1].start = irq;
dwc->xhci_resources[1].end = irq; dwc->xhci_resources[1].end = irq;
......
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