Message ID | 1413801940-31086-10-git-send-email-m.szyprowski@samsung.com |
---|---|
State | Accepted |
Commit | 7b093f773b85dd816c5717193ec94a7cfec73a09 |
Headers | show |
> From: Marek Szyprowski [mailto:m.szyprowski@samsung.com] > Sent: Monday, October 20, 2014 3:46 AM > > This patch moves calls to phy enable/disable out of spinlock protected > blocks in device suspend/resume to fix incorrect caller context. Phy > related functions must not be called from atomic context. To protect > device internal state from a race during suspend, a call to > s3c_hsotg_core_disconnect() is added under a spinlock, what prevents any > further activity on the usb bus. > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- > drivers/usb/dwc2/gadget.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c > index e8ffc080e6c7..0d34cfc71bfb 100644 > --- a/drivers/usb/dwc2/gadget.c > +++ b/drivers/usb/dwc2/gadget.c > @@ -3653,11 +3653,13 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) > hsotg->driver->driver.name); > > spin_lock_irqsave(&hsotg->lock, flags); > + s3c_hsotg_core_disconnect(hsotg); > s3c_hsotg_disconnect(hsotg); > - s3c_hsotg_phy_disable(hsotg); > hsotg->gadget.speed = USB_SPEED_UNKNOWN; > spin_unlock_irqrestore(&hsotg->lock, flags); > > + s3c_hsotg_phy_disable(hsotg); > + > if (hsotg->driver) { > int ep; > for (ep = 0; ep < hsotg->num_of_eps; ep++) > @@ -3686,8 +3688,9 @@ static int s3c_hsotg_resume(struct platform_device *pdev) > hsotg->supplies); > } > > - spin_lock_irqsave(&hsotg->lock, flags); > s3c_hsotg_phy_enable(hsotg); > + > + spin_lock_irqsave(&hsotg->lock, flags); > s3c_hsotg_core_init_disconnected(hsotg); > s3c_hsotg_core_connect(hsotg); > spin_unlock_irqrestore(&hsotg->lock, flags); Acked-by: Paul Zimmerman <paulz@synopsys.com> -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index e8ffc080e6c7..0d34cfc71bfb 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3653,11 +3653,13 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) hsotg->driver->driver.name); spin_lock_irqsave(&hsotg->lock, flags); + s3c_hsotg_core_disconnect(hsotg); s3c_hsotg_disconnect(hsotg); - s3c_hsotg_phy_disable(hsotg); hsotg->gadget.speed = USB_SPEED_UNKNOWN; spin_unlock_irqrestore(&hsotg->lock, flags); + s3c_hsotg_phy_disable(hsotg); + if (hsotg->driver) { int ep; for (ep = 0; ep < hsotg->num_of_eps; ep++) @@ -3686,8 +3688,9 @@ static int s3c_hsotg_resume(struct platform_device *pdev) hsotg->supplies); } - spin_lock_irqsave(&hsotg->lock, flags); s3c_hsotg_phy_enable(hsotg); + + spin_lock_irqsave(&hsotg->lock, flags); s3c_hsotg_core_init_disconnected(hsotg); s3c_hsotg_core_connect(hsotg); spin_unlock_irqrestore(&hsotg->lock, flags);
This patch moves calls to phy enable/disable out of spinlock protected blocks in device suspend/resume to fix incorrect caller context. Phy related functions must not be called from atomic context. To protect device internal state from a race during suspend, a call to s3c_hsotg_core_disconnect() is added under a spinlock, what prevents any further activity on the usb bus. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/usb/dwc2/gadget.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)