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

Alban Bedel alban.bedel at aerq.com
Wed Apr 20 11:26:04 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 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. Mark this function with
__maybe_unused to supress the warning when building without driver
model.

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

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index b592a487e001..2107a2993309 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,7 +705,7 @@ static void dwc3_gadget_run(struct dwc3 *dwc)
 	mdelay(100);
 }
 
-static void dwc3_core_stop(struct dwc3 *dwc)
+static void __maybe_unused dwc3_core_stop(struct dwc3 *dwc)
 {
 	u32 reg;
 
-- 
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/20220420/34a5f1cd/attachment.bin>


More information about the U-Boot mailing list