summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMateusz Zalega <m.zalega@samsung.com>2014-04-28 21:13:28 +0200
committerLukasz Majewski <l.majewski@samsung.com>2014-05-05 08:21:47 +0200
commitc4d0e856047f2689278ffea63a562c4f22a35ee3 (patch)
treeae6a7cb91039b0ffa70ae0ebcb4618896d5d725c /include
parentfad8edf0f72b8aba8885d2d137ebb58b3428806a (diff)
downloadu-boot-imx-c4d0e856047f2689278ffea63a562c4f22a35ee3.zip
u-boot-imx-c4d0e856047f2689278ffea63a562c4f22a35ee3.tar.gz
u-boot-imx-c4d0e856047f2689278ffea63a562c4f22a35ee3.tar.bz2
USB: gadget: added a saner gadget downloader registration API
Preprocessor definitions and hardcoded implementation selection in g_dnl core were replaced by a linker list made of (usb_function_name, bind_callback) pairs. Signed-off-by: Mateusz Zalega <m.zalega@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'include')
-rw-r--r--include/dfu.h7
-rw-r--r--include/g_dnl.h23
-rw-r--r--include/thor.h8
-rw-r--r--include/usb_mass_storage.h8
4 files changed, 23 insertions, 23 deletions
diff --git a/include/dfu.h b/include/dfu.h
index dcd3215..2409168 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -168,12 +168,5 @@ static inline int dfu_fill_entity_ram(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_ */
diff --git a/include/g_dnl.h b/include/g_dnl.h
index f4e8d10..1b1b35e 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -10,6 +10,29 @@
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
+#include <linux/usb/composite.h>
+#include <linker_lists.h>
+
+/*
+ * @usb_fname: unescaped USB function name
+ * @callback_ptr: bind callback, one per function name
+ */
+#define DECLARE_GADGET_BIND_CALLBACK(usb_fname, callback_ptr) \
+ ll_entry_declare(struct g_dnl_bind_callback, \
+ __usb_function_name_##usb_fname, \
+ g_dnl_bind_callbacks) = { \
+ .usb_function_name = #usb_fname, \
+ .fptr = callback_ptr \
+ }
+
+typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
+
+/* used in Gadget downloader callback linker list */
+struct g_dnl_bind_callback {
+ const char *usb_function_name;
+ g_dnl_bind_callback_f fptr;
+};
+
int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
int g_dnl_board_usb_cable_connected(void);
int g_dnl_register(const char *s);
diff --git a/include/thor.h b/include/thor.h
index afeade4..5051be7 100644
--- a/include/thor.h
+++ b/include/thor.h
@@ -15,13 +15,5 @@
int thor_handle(void);
int thor_init(void);
-
-#ifdef CONFIG_THOR_FUNCTION
int thor_add(struct usb_configuration *c);
-#else
-int thor_add(struct usb_configuration *c)
-{
- return 0;
-}
-#endif
#endif /* __THOR_H_ */
diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
index 058dcf1..ed46064 100644
--- a/include/usb_mass_storage.h
+++ b/include/usb_mass_storage.h
@@ -40,13 +40,5 @@ int fsg_init(struct ums *);
void fsg_cleanup(void);
struct ums *ums_init(unsigned int);
int fsg_main_thread(void *);
-
-#ifdef CONFIG_USB_GADGET_MASS_STORAGE
int fsg_add(struct usb_configuration *c);
-#else
-int fsg_add(struct usb_configuration *c)
-{
- return 0;
-}
-#endif
#endif /* __USB_MASS_STORAGE_H__ */