Commit 3f308d17 authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: gadget: hold gadget IRQ in dwc->irq_gadget

by holding gadget's IRQ number in dwc->irq_gadget,
it'll be simpler to free_irq() and disable the IRQ
in case an IRQ fires while we are runtime suspended.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 51f5d49a
...@@ -730,6 +730,7 @@ struct dwc3_scratchpad_array { ...@@ -730,6 +730,7 @@ struct dwc3_scratchpad_array {
* @regs: base address for our registers * @regs: base address for our registers
* @regs_size: address space size * @regs_size: address space size
* @fladj: frame length adjustment * @fladj: frame length adjustment
* @irq_gadget: peripheral controller's IRQ number
* @nr_scratch: number of scratch buffers * @nr_scratch: number of scratch buffers
* @u1u2: only used on revisions <1.83a for workaround * @u1u2: only used on revisions <1.83a for workaround
* @maximum_speed: maximum speed requested (mainly for testing purposes) * @maximum_speed: maximum speed requested (mainly for testing purposes)
...@@ -837,6 +838,7 @@ struct dwc3 { ...@@ -837,6 +838,7 @@ struct dwc3 {
enum usb_dr_mode dr_mode; enum usb_dr_mode dr_mode;
u32 fladj; u32 fladj;
u32 irq_gadget;
u32 nr_scratch; u32 nr_scratch;
u32 u1u2; u32 u1u2;
u32 maximum_speed; u32 maximum_speed;
......
...@@ -1751,6 +1751,7 @@ static int dwc3_gadget_start(struct usb_gadget *g, ...@@ -1751,6 +1751,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
irq, ret); irq, ret);
goto err0; goto err0;
} }
dwc->irq_gadget = irq;
spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags);
if (dwc->gadget_driver) { if (dwc->gadget_driver) {
...@@ -1787,15 +1788,13 @@ static int dwc3_gadget_stop(struct usb_gadget *g) ...@@ -1787,15 +1788,13 @@ static int dwc3_gadget_stop(struct usb_gadget *g)
{ {
struct dwc3 *dwc = gadget_to_dwc(g); struct dwc3 *dwc = gadget_to_dwc(g);
unsigned long flags; unsigned long flags;
int irq;
spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags);
__dwc3_gadget_stop(dwc); __dwc3_gadget_stop(dwc);
dwc->gadget_driver = NULL; dwc->gadget_driver = NULL;
spin_unlock_irqrestore(&dwc->lock, flags); spin_unlock_irqrestore(&dwc->lock, flags);
irq = platform_get_irq(to_platform_device(dwc->dev), 0); free_irq(dwc->irq_gadget, dwc->ev_buf);
free_irq(irq, dwc->ev_buf);
return 0; return 0;
} }
......
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