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.

Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
---
 drivers/usb/dwc2/gadget.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index cdf417a7ae63..052b1a857291 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3656,11 +3656,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++)
@@ -3689,9 +3691,10 @@ static int s3c_hsotg_resume(struct platform_device *pdev)
                                      hsotg->supplies);
        }
 
-       spin_lock_irqsave(&hsotg->lock, flags);
        s3c_hsotg_phy_enable(hsotg);
-       s3c_hsotg_core_init_disconnect(hsotg);
+
+       spin_lock_irqsave(&hsotg->lock, flags);
+       s3c_hsotg_core_init_disconnected(hsotg);
        s3c_hsotg_core_connect(hsotg);
        spin_unlock_irqrestore(&hsotg->lock, flags);
 
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to