summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-03-19 12:02:41 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2022-03-28 10:52:55 +0200
commita19926ae60d8cc43d400c0cb3a73875bd98bcdd8 (patch)
tree644089e42bbe35ad0b308ad9526a5c7eb620b9dc /include
parent26dc1bf751724540716a4a17a80f7605ebf61b3a (diff)
downloadbarebox-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 'include')
-rw-r--r--include/system-partitions.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/system-partitions.h b/include/system-partitions.h
index 86de3612cc..e6d1a0f88b 100644
--- a/include/system-partitions.h
+++ b/include/system-partitions.h
@@ -2,6 +2,7 @@
#ifndef SYSTEM_PARTITIONS_H_
#define SYSTEM_PARTITIONS_H_
+#include <linux/types.h>
#include <file-list.h>
#ifdef CONFIG_SYSTEM_PARTITIONS
@@ -37,4 +38,11 @@ static inline bool system_partitions_empty(void)
#endif
+static inline struct file_list *system_partitions_get_null(void)
+{
+ if (system_partitions_empty())
+ return NULL;
+ return system_partitions_get();
+}
+
#endif