summaryrefslogtreecommitdiffstats
path: root/include/usb
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-06-22 10:26:16 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-25 09:31:03 +0200
commita62e5d2f3350bffb7be52397066f9900e1908348 (patch)
treea31ee922bd2926f4ab42ad3a05f167d89fea4f65 /include/usb
parentaa649b826c535810b59a107a67cc90079a0681e5 (diff)
downloadbarebox-a62e5d2f3350bffb7be52397066f9900e1908348.tar.gz
barebox-a62e5d2f3350bffb7be52397066f9900e1908348.tar.xz
usbgadget: refactor usbgadget_register to accept array
usbgadget_register currently takes 6 arguments. Instead of increasing them to 8 to support the new usb mass storage gadget, rewrite it to accept a pointer to a struct with all the options instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210622082617.18011-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/usb')
-rw-r--r--include/usb/gadget-multi.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/usb/gadget-multi.h b/include/usb/gadget-multi.h
index f30dae5686..482aee11d0 100644
--- a/include/usb/gadget-multi.h
+++ b/include/usb/gadget-multi.h
@@ -8,7 +8,7 @@
struct f_multi_opts {
struct fastboot_opts fastboot_opts;
struct f_dfu_opts dfu_opts;
- int create_acm;
+ bool create_acm;
void (*release)(struct f_multi_opts *opts);
};
@@ -17,8 +17,17 @@ void usb_multi_unregister(void);
void usb_multi_opts_release(struct f_multi_opts *opts);
unsigned usb_multi_count_functions(struct f_multi_opts *opts);
-int usbgadget_register(bool dfu, const char *dfu_opts,
- bool fastboot, const char *fastboot_opts,
- bool acm, bool export_bbu);
+#define USBGADGET_EXPORT_BBU (1 << 0)
+#define USBGADGET_ACM (1 << 1)
+#define USBGADGET_DFU (1 << 2)
+#define USBGADGET_FASTBOOT (1 << 3)
+
+struct usbgadget_funcs {
+ int flags;
+ const char *fastboot_opts;
+ const char *dfu_opts;
+};
+
+int usbgadget_register(const struct usbgadget_funcs *funcs);
#endif /* __USB_GADGET_MULTI_H */