Skip to content

Commit 84d1982

Browse files
gmarullcarlescufi
authored andcommitted
device: introduce Z_DEVICE_HANDLES_SECTION
Allows de-cluttering Z_DEVICE_HANDLES_DEFINE. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 184a546 commit 84d1982

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/zephyr/device.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,10 @@ static inline bool z_impl_device_is_ready(const struct device *dev)
841841
#define Z_DEVICE_EXTRA_HANDLES(...) \
842842
FOR_EACH_NONEMPTY_TERM(IDENTITY, (,), __VA_ARGS__)
843843

844+
/** @brief Linker section were device handles are placed. */
845+
#define Z_DEVICE_HANDLES_SECTION \
846+
__attribute__((__section__(".__device_handles_pass1")))
847+
844848
/**
845849
* @brief Define device handles.
846850
*
@@ -882,7 +886,7 @@ static inline bool z_impl_device_is_ready(const struct device *dev)
882886
extern Z_DEVICE_HANDLES_CONST device_handle_t \
883887
Z_DEVICE_HANDLE_NAME(node_id, dev_id)[]; \
884888
Z_DEVICE_HANDLES_CONST Z_DECL_ALIGN(device_handle_t) \
885-
__attribute__((__section__(".__device_handles_pass1"))) __weak \
889+
Z_DEVICE_HANDLES_SECTION __weak \
886890
Z_DEVICE_HANDLE_NAME(node_id, dev_id)[] = { \
887891
COND_CODE_1(DT_NODE_EXISTS(node_id), ( \
888892
DT_DEP_ORD(node_id), \

0 commit comments

Comments
 (0)