Skip to content

Commit 129a093

Browse files
gmarullcarlescufi
authored andcommitted
device: only use dev_id in Z_DEVICE_HANDLES_NAME
The dev_id is already unique for DT devices (dts_ord_XX), there's no need to rely on the full node identifier. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 80e0b1e commit 129a093

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

include/zephyr/device.h

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -824,14 +824,10 @@ static inline bool z_impl_device_is_ready(const struct device *dev)
824824
* @brief Synthesize the name of the object that holds device ordinal and
825825
* dependency data.
826826
*
827-
* @param node_id Devicetree node id of the device.
828827
* @param dev_id Device identifier.
829828
*/
830-
#define Z_DEVICE_HANDLES_NAME(node_id, dev_id) \
831-
_CONCAT(__devicehdl_, \
832-
COND_CODE_1(DT_NODE_EXISTS(node_id), \
833-
(node_id), \
834-
(dev_id)))
829+
#define Z_DEVICE_HANDLES_NAME(dev_id) \
830+
_CONCAT(__devicehdl_, dev_id)
835831

836832
/**
837833
* @brief Expand extra handles with a comma in between.
@@ -884,10 +880,9 @@ static inline bool z_impl_device_is_ready(const struct device *dev)
884880
*/
885881
#define Z_DEVICE_HANDLES_DEFINE(node_id, dev_id, ...) \
886882
extern Z_DEVICE_HANDLES_CONST device_handle_t \
887-
Z_DEVICE_HANDLES_NAME(node_id, dev_id)[]; \
883+
Z_DEVICE_HANDLES_NAME(dev_id)[]; \
888884
Z_DEVICE_HANDLES_CONST Z_DECL_ALIGN(device_handle_t) \
889-
Z_DEVICE_HANDLES_SECTION __weak \
890-
Z_DEVICE_HANDLES_NAME(node_id, dev_id)[] = { \
885+
Z_DEVICE_HANDLES_SECTION __weak Z_DEVICE_HANDLES_NAME(dev_id)[] = { \
891886
COND_CODE_1(DT_NODE_EXISTS(node_id), \
892887
(DT_DEP_ORD(node_id), \
893888
DT_REQUIRES_DEP_ORDS(node_id)), \
@@ -1014,8 +1009,7 @@ static inline bool z_impl_device_is_ready(const struct device *dev)
10141009
Z_DEVICE_HANDLES_DEFINE(node_id, dev_id, __VA_ARGS__); \
10151010
\
10161011
Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, \
1017-
prio, api, state, \
1018-
Z_DEVICE_HANDLES_NAME(node_id, dev_id)); \
1012+
prio, api, state, Z_DEVICE_HANDLES_NAME(dev_id)); \
10191013
\
10201014
Z_DEVICE_INIT_ENTRY_DEFINE(dev_id, init_fn, level, prio)
10211015

0 commit comments

Comments
 (0)