From c86f34751f6717b9c122e7ca25360d7b9c0437ff Mon Sep 17 00:00:00 2001 From: Rohith Kollalsi Date: Tue, 8 Feb 2022 10:33:34 +0530 Subject: [PATCH] dwc3: gadget: Remove pm_runtime calls from dwc3_gadget_ep_disable There is a chance that ep_disable will be called from mass storage function driver after usb is in LPM as ep_disable in mass storage function driver is called in worker thread context. Hence, Commit 589a7f885ae2 ("usb: dwc3: Don't perform pm rt sync operations in atomic context") added pm_runtime calls for mass storage function driver, so that system can be resumed and then do the ep_disable operations. But Commit e8e83c46c5eb ("usb: gadget: f_mass_storage: Disable eps during disconnect") has changed the implementation of ep_disable in mass storage function driver. It is now being called in atomic context. So there is no chance of ep_disable being called after usb is in lpm. Hence remove the support for pm_runtime calls in ep_disable as they are any how no-op. Change-Id: I5bcc2572da1608b24b1fe1cf14b6f1c3918d2d7a Signed-off-by: Rohith Kollalsi --- drivers/usb/dwc3/gadget.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index bcded2a041c5..0f271d6e080f 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -966,7 +966,6 @@ static int dwc3_gadget_ep_disable(struct usb_ep *ep) struct dwc3 *dwc; unsigned long flags; int ret; - bool call_rpm_put = false; if (!ep) { pr_debug("dwc3: invalid parameters\n"); @@ -981,18 +980,10 @@ static int dwc3_gadget_ep_disable(struct usb_ep *ep) dep->name)) return 0; - if (atomic_read(&dwc->in_lpm)) { - pm_runtime_get_sync(dwc->sysdev); - call_rpm_put = true; - } spin_lock_irqsave(&dwc->lock, flags); ret = __dwc3_gadget_ep_disable(dep); dbg_event(dep->number, "DISABLE", ret); spin_unlock_irqrestore(&dwc->lock, flags); - if (call_rpm_put) { - pm_runtime_mark_last_busy(dwc->sysdev); - pm_runtime_put_autosuspend(dwc->sysdev); - } return ret; }