[U-Boot] [PATCH 3/3] usb:g_dnl:dfu: Download gadget and DFU function code clean up

Lukasz Majewski l.majewski at samsung.com
Tue Sep 17 15:58:23 CEST 2013


The download gadget code and DFU function lacks of proper declarations
for the case when a target board wants to use only one of available usb
functions.

Moreover the relevant declarations have been moved to consistent
localization (like <dfu.h>).

Signed-off-by: Lukasz Majewski <l.majewski at samsung.com>
Cc: Marek Vasut <marex at denx.de>
---
 drivers/usb/gadget/f_dfu.h |    3 ---
 drivers/usb/gadget/g_dnl.c |    2 +-
 include/dfu.h              |    9 +++++++++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/f_dfu.h b/drivers/usb/gadget/f_dfu.h
index 34a4dde..cc2c455 100644
--- a/drivers/usb/gadget/f_dfu.h
+++ b/drivers/usb/gadget/f_dfu.h
@@ -82,7 +82,4 @@ struct dfu_function_descriptor {
 	__le16				wTransferSize;
 	__le16				bcdDFUVersion;
 } __packed;
-
-/* configuration-specific linkup */
-int dfu_add(struct usb_configuration *c);
 #endif /* __F_DFU_H_ */
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 29d08a3..40868c0 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -15,7 +15,7 @@
 
 #include <g_dnl.h>
 #include <usb_mass_storage.h>
-#include "f_dfu.h"
+#include <dfu.h>
 
 #include "gadget_chips.h"
 #include "composite.c"
diff --git a/include/dfu.h b/include/dfu.h
index 6f25341..f3f7f0b 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -14,6 +14,7 @@
 #include <common.h>
 #include <linux/list.h>
 #include <mmc.h>
+#include <linux/usb/composite.h>
 
 enum dfu_device_type {
 	DFU_DEV_MMC = 1,
@@ -139,4 +140,12 @@ static inline int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
 }
 #endif
 
+#ifdef CONFIG_DFU_FUNCTION
+int dfu_add(struct usb_configuration *c);
+#else
+int dfu_add(struct usb_configuration *c)
+{
+	return 0;
+}
+#endif
 #endif /* __DFU_ENTITY_H_ */
-- 
1.7.10.4



More information about the U-Boot mailing list