diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-03-19 12:02:41 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-03-28 10:52:55 +0200 |
commit | a19926ae60d8cc43d400c0cb3a73875bd98bcdd8 (patch) | |
tree | 644089e42bbe35ad0b308ad9526a5c7eb620b9dc /common | |
parent | 26dc1bf751724540716a4a17a80f7605ebf61b3a (diff) | |
download | barebox-a19926ae60d8cc43d400c0cb3a73875bd98bcdd8.tar.gz barebox-a19926ae60d8cc43d400c0cb3a73875bd98bcdd8.tar.xz |
usb: gadget: implement and use system_partitions_get_null
system_partitions_get() clones the system partitions file list and
returns the copy. usb multi gadget code expects disabled gadgets to
have a NULL file list, not an empty one, so fastboot and DFU handle
this case. Add a new system_partitions_get_null helper that can be
used instead. This will be used for USB mass storage gadget as well
in a follow-up commit.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220319110246.2850396-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/fastboot.c | 4 | ||||
-rw-r--r-- | common/usbgadget.c | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/common/fastboot.c b/common/fastboot.c index 04a8573b4a..f8ed40c86e 100644 --- a/common/fastboot.c +++ b/common/fastboot.c @@ -920,9 +920,7 @@ struct file_list *get_fastboot_partitions(void) { if (fastboot_partitions && *fastboot_partitions) return file_list_parse_null(fastboot_partitions); - if (!system_partitions_empty()) - return system_partitions_get(); - return NULL; + return system_partitions_get_null(); } static int fastboot_globalvars_init(void) diff --git a/common/usbgadget.c b/common/usbgadget.c index e8c9f7d236..92e4861995 100644 --- a/common/usbgadget.c +++ b/common/usbgadget.c @@ -27,9 +27,7 @@ static inline struct file_list *get_dfu_function(void) { if (dfu_function && *dfu_function) return file_list_parse_null(dfu_function); - if (!system_partitions_empty()) - return system_partitions_get(); - return NULL; + return system_partitions_get_null(); } int usbgadget_register(const struct usbgadget_funcs *funcs) |