summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-07-30 11:46:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-08-08 15:13:31 +0200
commit6e0bd0767a775291870daea743f82b94f7d909ac (patch)
tree92b059a5f9166a3d27d9d472b991e96496a1b344 /drivers/usb
parent2e9e7a400540c7f8cdc1466e81bff0efb5af8859 (diff)
downloadbarebox-6e0bd0767a775291870daea743f82b94f7d909ac.tar.gz
barebox-6e0bd0767a775291870daea743f82b94f7d909ac.tar.xz
USB: gadget: fastboot: allow exporting only barebox update handler
Exporting only the bbu handler and nothing else over fastboot via usbgadget -A '' -b used to work. Restore this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220730094615.1762042-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/multi.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 102d8714f8..6225e9a313 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -137,6 +137,12 @@ static int multi_bind_fastboot(struct usb_composite_dev *cdev)
return usb_add_function(&config, f_fastboot);
}
+static bool fastboot_has_exports(struct f_multi_opts *opts)
+{
+ return !file_list_empty(opts->fastboot_opts.files) ||
+ opts->fastboot_opts.export_bbu;
+}
+
static int multi_bind_ums(struct usb_composite_dev *cdev)
{
int ret;
@@ -179,7 +185,7 @@ static int multi_unbind(struct usb_composite_dev *cdev)
usb_put_function_instance(fi_dfu);
}
- if (gadget_multi_opts->fastboot_opts.files) {
+ if (fastboot_has_exports(gadget_multi_opts)) {
usb_put_function(f_fastboot);
usb_put_function_instance(fi_fastboot);
}
@@ -219,7 +225,7 @@ static int multi_bind(struct usb_composite_dev *cdev)
if (ret)
return ret;
- if (gadget_multi_opts->fastboot_opts.files) {
+ if (fastboot_has_exports(gadget_multi_opts)) {
printf("%s: creating Fastboot function\n", __func__);
ret = multi_bind_fastboot(cdev);
if (ret)
@@ -259,7 +265,7 @@ unbind_dfu:
if (gadget_multi_opts->dfu_opts.files)
usb_put_function_instance(fi_dfu);
unbind_fastboot:
- if (gadget_multi_opts->fastboot_opts.files)
+ if (fastboot_has_exports(gadget_multi_opts))
usb_put_function_instance(fi_fastboot);
return ret;
@@ -312,8 +318,7 @@ unsigned usb_multi_count_functions(struct f_multi_opts *opts)
{
unsigned count = 0;
- count += !file_list_empty(opts->fastboot_opts.files) ||
- opts->fastboot_opts.export_bbu;
+ count += fastboot_has_exports(opts);
count += !file_list_empty(opts->dfu_opts.files);
count += !file_list_empty(opts->ums_opts.files);
count += opts->create_acm;