Skip to content

Commit a283845

Browse files
Fabrice Gasnierfourmone
authored andcommitted
usb: dwc2: gadget: resume the core even if no gadget driver is bound.
When no gadget driver has been bound, at least re-initialize the core as disconnected. It addresses the case when a device gets plugged-in later (e.g. dwc2 switches to host). This way, the necessary low level init has been done to switch to host mode. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Change-Id: Ic4c8b8a0bb57c0f6afab5ac613d47d8d2ae8c3df Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/461204 ACI: CITOOLS <MDG-smet-aci-reviews@list.st.com>
1 parent d57b026 commit a283845

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/usb/dwc2/gadget.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5320,19 +5320,19 @@ int dwc2_hsotg_resume(struct dwc2_hsotg *hsotg)
53205320
if (!hsotg->gadget_off_for_suspend)
53215321
return 0;
53225322

5323+
spin_lock_irqsave(&hsotg->lock, flags);
5324+
dwc2_hsotg_core_init_disconnected(hsotg, false);
53235325
if (hsotg->driver) {
53245326
dev_info(hsotg->dev, "resuming usb gadget %s\n",
53255327
hsotg->driver->driver.name);
53265328

5327-
spin_lock_irqsave(&hsotg->lock, flags);
5328-
dwc2_hsotg_core_init_disconnected(hsotg, false);
53295329
if (hsotg->enabled) {
53305330
/* Enable ACG feature in device mode,if supported */
53315331
dwc2_enable_acg(hsotg);
53325332
dwc2_hsotg_core_connect(hsotg);
53335333
}
5334-
spin_unlock_irqrestore(&hsotg->lock, flags);
53355334
}
5335+
spin_unlock_irqrestore(&hsotg->lock, flags);
53365336

53375337
return 0;
53385338
}

0 commit comments

Comments
 (0)