[U-Boot] [PATCH 09/18] dm: usb: Avoid using USB ethernet with CONFIG_DM_USB and no DM_ETH

Simon Glass sjg at chromium.org
Tue Jul 7 00:47:48 CEST 2015


If driver model is used for Ethernet then USB Ethernet does not build. This
can be made to work with driver model is used for USB also. Add #ifdef logic
to make this clear when building.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 common/cmd_usb.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index eab55cd..e1dba7a 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -23,7 +23,7 @@
 static int usb_stor_curr_dev = -1; /* current device */
 #endif
 #ifdef CONFIG_USB_HOST_ETHER
-static int usb_ether_curr_dev = -1; /* current ethernet device */
+static int __maybe_unused usb_ether_curr_dev = -1; /* current ethernet device */
 #endif
 
 /* some display routines (info command) */
@@ -526,14 +526,16 @@ static void do_usb_start(void)
 
 	/* Driver model will probe the devices as they are found */
 #ifndef CONFIG_DM_USB
-#ifdef CONFIG_USB_STORAGE
+# ifdef CONFIG_USB_STORAGE
 	/* try to recognize storage devices immediately */
 	usb_stor_curr_dev = usb_stor_scan(1);
-#endif
-#endif
-#ifdef CONFIG_USB_HOST_ETHER
+# endif
+# ifdef CONFIG_DM_ETH
+#   warning "You must use CONFIG_DM_USB if you want to use CONFIG_USB_HOST_ETHER with CONFIG_DM_ETH"
+# elif defined(CONFIG_USB_HOST_ETHER)
 	/* try to recognize ethernet devices immediately */
 	usb_ether_curr_dev = usb_host_eth_scan(1);
+# endif
 #endif
 #ifdef CONFIG_USB_KEYBOARD
 	drv_usb_kbd_init();
-- 
2.4.3.573.g4eafbef



More information about the U-Boot mailing list