[PATCH 1/2] usb: dwc3: core: Fix warnings when building without driver model

Alban Bedel alban.bedel at aerq.com
Tue Apr 19 09:52:24 CEST 2022


Commit f150b8d28b4e ("usb: dwc3: Enable undefined length INCR burst
type") introduced code that assign the content of dwc->dev to a
variable. But in u-boot the type of this field changes if building
with driver model enabled or not. As this variable is then only used
once just remove it and use the struct field directly.

Another issued was also introduced in commit fb146fbc1ae5 ("usb: dwc3:
core: stop the core when it's removed") which define a static function
which is only used when the driver model is enabled. Add ifdef around
this function to suppress the warning when building without driver
model.

Signed-off-by: Alban Bedel <alban.bedel at aerq.com>
---
 drivers/usb/dwc3/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index b592a487e001..fdd8c5db2460 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -465,7 +465,6 @@ static void dwc3_phy_setup(struct dwc3 *dwc)
 /* set global incr burst type configuration registers */
 static void dwc3_set_incr_burst_type(struct dwc3 *dwc)
 {
-	struct udevice *dev = dwc->dev;
 	u32 cfg;
 
 	if (!dwc->incrx_size)
@@ -502,7 +501,7 @@ static void dwc3_set_incr_burst_type(struct dwc3 *dwc)
 	case 1:
 		break;
 	default:
-		dev_err(dev, "Invalid property\n");
+		dev_err(dwc->dev, "Invalid property\n");
 		break;
 	}
 
@@ -706,6 +705,7 @@ static void dwc3_gadget_run(struct dwc3 *dwc)
 	mdelay(100);
 }
 
+#if CONFIG_IS_ENABLED(DM_USB)
 static void dwc3_core_stop(struct dwc3 *dwc)
 {
 	u32 reg;
@@ -713,6 +713,7 @@ static void dwc3_core_stop(struct dwc3 *dwc)
 	reg = dwc3_readl(dwc->regs, DWC3_DCTL);
 	dwc3_writel(dwc->regs, DWC3_DCTL, reg & ~(DWC3_DCTL_RUN_STOP));
 }
+#endif
 
 static void dwc3_core_exit_mode(struct dwc3 *dwc)
 {
-- 
2.32.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3627 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220419/4303bd4d/attachment.bin>


More information about the U-Boot mailing list