From b3b9046ec564f5d19015065eb3e69b9ff43dd9de Mon Sep 17 00:00:00 2001 From: Zain Wang Date: Tue, 10 Sep 2024 15:24:15 +0800 Subject: [PATCH] usb: dwc2: fix compile error in USB_DWC2_HOST mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- drivers/usb/dwc2/platform.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 5b74eec719cb..dfb08b5c8741 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -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);