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

usb: dwc3: gadget: extract dwc3_gadget_get_irq()

Cleanup only, no functional changes.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 4dd5a69e
...@@ -2871,38 +2871,54 @@ static irqreturn_t dwc3_interrupt(int irq, void *_evt) ...@@ -2871,38 +2871,54 @@ static irqreturn_t dwc3_interrupt(int irq, void *_evt)
return dwc3_check_event_buf(evt); return dwc3_check_event_buf(evt);
} }
/** static int dwc3_gadget_get_irq(struct dwc3 *dwc)
* dwc3_gadget_init - Initializes gadget related registers
* @dwc: pointer to our controller context structure
*
* Returns 0 on success otherwise negative errno.
*/
int dwc3_gadget_init(struct dwc3 *dwc)
{ {
int ret, irq;
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, "peripheral"); irq = platform_get_irq_byname(dwc3_pdev, "peripheral");
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 peripheral IRQ\n"); if (irq != -EPROBE_DEFER)
} dev_err(dwc->dev, "missing peripheral IRQ\n");
if (!irq) if (!irq)
irq = -EINVAL; irq = -EINVAL;
out:
return irq; return irq;
} }
}
/**
* dwc3_gadget_init - Initializes gadget related registers
* @dwc: pointer to our controller context structure
*
* Returns 0 on success otherwise negative errno.
*/
int dwc3_gadget_init(struct dwc3 *dwc)
{
int ret;
int irq;
irq = dwc3_gadget_get_irq(dwc);
if (irq < 0) {
ret = irq;
goto err0;
} }
dwc->irq_gadget = irq; dwc->irq_gadget = 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