From 572ad8e3dc0ee569e55225d356891ee05f0d5536 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Fri, 7 Jun 2024 12:09:59 +0200 Subject: [PATCH] usb: dwc2: hcd: add missing ifdeffery for hsotg->test_mode In the struct dwc2_hsotg, the test_mode member is only present in gadget or dual role mode. Add a ifdeffery to fix a compile issue if the driver is built in host mode only. Fixes: da4d73819312 ("usb: dwc2: hcd: initialize hsotg->test_mode upon USB_PORT_FEAT_TEST") Signed-off-by: Thomas Richard --- drivers/usb/dwc2/hcd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index b3fa17cb5e6267..6f3d7302f7cfe6 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3718,7 +3718,10 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, hprt0 &= ~HPRT0_TSTCTL_MASK; hprt0 |= (windex >> 8) << HPRT0_TSTCTL_SHIFT; dwc2_writel(hsotg, hprt0, HPRT0); +#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \ + IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) hsotg->test_mode = windex >> 8; +#endif break; default: