summaryrefslogtreecommitdiff
path: root/include/linker_lists.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-15 07:25:13 +0300
committerSimon Glass <sjg@chromium.org>2021-03-22 09:23:28 +0300
commit851144350b6ff1d4982b9af2f9b0fe48aed24b3c (patch)
treec429438f2b196a2ba1cde8607e8dc1f293c8ce6a /include/linker_lists.h
parentb5e514a6abc5cc31d350f9ca25cb6a6d4895c338 (diff)
downloadu-boot-851144350b6ff1d4982b9af2f9b0fe48aed24b3c.tar.xz
linker_lists: Allow use in data structures
At present linker lists are designed for use in code. They make use of statements within expressions ({...}), for example. It is possible to generate a reference to a linker_list entry that can be used in data structures, where such features are not permitted. It requires that the reference first be declared as extern. In other words the existing macro needs to be split into two parts. Add new macros to support this. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/linker_lists.h')
-rw-r--r--include/linker_lists.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linker_lists.h b/include/linker_lists.h
index fd98ecd297..0ca30da417 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -212,6 +212,18 @@
})
/**
+ * ll_entry_ref() - Get a reference to a linker-generated array entry
+ *
+ * Once ll_entry_decl() has been used to declare the reference, this macro
+ * allows the entry to be accessed.
+ *
+ * This is like ll_entry_get(), but without the extra code, so it is suitable
+ * for putting into data structures.
+ */
+#define ll_entry_ref(_type, _name, _list) \
+ ((_type *)&_u_boot_list_2_##_list##_2_##_name)
+
+/**
* ll_start() - Point to first entry of first linker-generated array
* @_type: Data type of the entry
*