From 2973ae6586d2abe28d45e35a47c8fe05ed7c43d6 Mon Sep 17 00:00:00 2001 From: Benoit Goby Date: Wed, 29 Sep 2010 16:04:25 -0700 Subject: [PATCH] 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 --- drivers/usb/gadget/fsl_udc_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index fa37f529ae53..1242c1a57e43 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -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; } -- 2.34.1