usb: gadget: fsl_udc: Unlock the spinlock before calling clk_enable

On suspend, dr_controller_stop disable interrupts and on resume, interrupts
are disabled until dr_controller_run is called, so it is safe to call
fsl_udc_clk_suspend/resume with interrupts and the spinlock unlocked.

Change-Id: I33618295ea096a4bfd796d1a07dfc9722e7786b0
Signed-off-by: Benoit Goby <benoit@android.com>
This commit is contained in:
Benoit Goby 2010-09-29 16:04:25 -07:00 committed by Colin Cross
parent e6483a8c8e
commit 2973ae6586

View File

@ -1162,24 +1162,25 @@ static int fsl_vbus_session(struct usb_gadget *gadget, int is_active)
/* stop the controller and turn off the clocks */
dr_controller_stop(udc);
dr_controller_reset(udc);
spin_unlock_irqrestore(&udc->lock, flags);
fsl_udc_clk_suspend();
udc->vbus_active = 0;
udc->usb_state = USB_STATE_DEFAULT;
} else if (!udc->vbus_active && is_active) {
spin_unlock_irqrestore(&udc->lock, flags);
fsl_udc_clk_resume();
/* setup the controller in the device mode */
dr_controller_setup(udc);
/* setup EP0 for setup packet */
ep0_setup(udc);
/* start the controller */
dr_controller_run(udc);
/* initialize the USB and EP states */
udc->usb_state = USB_STATE_ATTACHED;
udc->ep0_state = WAIT_FOR_SETUP;
udc->ep0_dir = 0;
udc->vbus_active = 1;
/* start the controller */
dr_controller_run(udc);
}
spin_unlock_irqrestore(&udc->lock, flags);
return 0;
}