Skip to content

Commit 8c1bef5

Browse files
pabigotcarlescufi
authored andcommitted
device: support generating defines from devicetree nodes with no label
The existing code only worked for nodes that had a label property, which is every device except ESP32 pinmux. However, a label property should not be necessary for defining a device from devicetree. Signed-off-by: Peter Bigot <[email protected]>
1 parent c2c6bee commit 8c1bef5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/device.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ extern "C" {
168168
*/
169169
#define DEVICE_DT_DEFINE(node_id, init_fn, pm_control_fn, \
170170
data_ptr, cfg_ptr, level, prio, api_ptr) \
171-
Z_DEVICE_DEFINE(node_id, node_id, DT_LABEL(node_id), init_fn, \
171+
Z_DEVICE_DEFINE(node_id, node_id, \
172+
DT_PROP_OR(node_id, label, NULL), init_fn, \
172173
pm_control_fn, \
173174
data_ptr, cfg_ptr, level, prio, api_ptr)
174175

0 commit comments

Comments
 (0)