diff mbox series

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

Message ID 20220419075225.73161-3-alban.bedel@aerq.com
State Superseded
Delegated to: Bin Meng
Headers show
Series [1/2] usb: dwc3: core: Fix warnings when building without driver model | expand

Commit Message

Bedel, Alban April 19, 2022, 7:52 a.m. UTC
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@aerq.com>
---
 drivers/usb/dwc3/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Bedel, Alban April 20, 2022, 6:17 a.m. UTC | #1
On Tue, 2022-04-19 at 10:01 +0200, Michael Walle wrote:
> Hi,
> 
> > +#if CONFIG_IS_ENABLED(DM_USB)
> >  static void dwc3_core_stop(struct dwc3 *dwc)
> 
> will __maybe_unused work?

Yes, I'll replace the #ifdef in the next version.

Alban
diff mbox series

Patch

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)
 {