usb: dwc2: fix compile error in USB_DWC2_HOST mode

If enabled CONFIG_USB_DWC2_HOST, we will get error:

drivers/usb/dwc2/platform.c: In function ‘dwc2_resume’:
drivers/usb/dwc2/platform.c:825:12: error: ‘struct dwc2_hsotg’ has no member named ‘driver’
  825 |   if (!dwc2->driver)
    |            ^~

This is the code for periperal mode, add a macro to
remove them from CONFIG_USB_DWC2_HOST.

Change-Id: Ib2b9622d5cfe5e4c9329030fa10e0635b1aa7fb8
Signed-off-by: Zain Wang <wzz@rock-chips.com>
This commit is contained in:
Zain Wang
2024-09-10 15:24:15 +08:00
committed by Tao Huang
parent db4eb2bcf1
commit b3b9046ec5

View File

@@ -822,8 +822,11 @@ static int __maybe_unused dwc2_resume(struct device *dev)
dwc2_hcd_disconnect(dwc2, true);
dwc2->op_state = OTG_STATE_B_PERIPHERAL;
dwc2->lx_state = DWC2_L3;
#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
if (!dwc2->driver)
dwc2_hsotg_core_init_disconnected(dwc2, false);
#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
spin_unlock_irqrestore(&dwc2->lock, flags);
ret = dwc2_hsotg_resume(dwc2);