Skip to content

Commit d5cc72a

Browse files
pillo79facchinm
authored andcommitted
llext: export all Z_DEVICE_DEFINE devices
Some device types (SPI, network, etc) use customized versions of DEVICE_DT_DEFINE; however, all of these ultimately use Z_DEVICE_DEFINE, which is where the object that has to be exported is defined. Move the Z_DEVICE_EXPORT macro to Z_DEVICE_DEFINE so that it properly covers all devices defined in the build. Signed-off-by: Luca Burelli <[email protected]>
1 parent 08d8392 commit d5cc72a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

include/zephyr/device.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ typedef int16_t device_handle_t;
207207
DEVICE_DT_NAME(node_id), init_fn, pm, data, config, \
208208
level, prio, api, \
209209
&Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \
210-
__VA_ARGS__) \
211-
IF_ENABLED(CONFIG_LLEXT_EXPORT_DEVICES, (Z_DEVICE_EXPORT(node_id);))
210+
__VA_ARGS__)
212211

213212
/**
214213
* @brief Like DEVICE_DT_DEFINE(), but uses an instance of a `DT_DRV_COMPAT`
@@ -1172,12 +1171,15 @@ device_get_dt_nodelabels(const struct device *dev)
11721171
(Z_DEVICE_DT_METADATA_DEFINE(node_id, dev_id);))))\
11731172
\
11741173
Z_DEVICE_BASE_DEFINE(node_id, dev_id, name, pm, data, config, level, \
1175-
prio, api, state, Z_DEVICE_DEPS_NAME(dev_id)); \
1174+
prio, api, state, Z_DEVICE_DEPS_NAME(dev_id)); \
11761175
COND_CODE_1(DEVICE_DT_DEFER(node_id), \
11771176
(Z_DEFER_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, \
11781177
init_fn)), \
11791178
(Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn, \
1180-
level, prio)));
1179+
level, prio))); \
1180+
IF_ENABLED(CONFIG_LLEXT_EXPORT_DEVICES, \
1181+
(IF_ENABLED(DT_NODE_EXISTS(node_id), \
1182+
(Z_DEVICE_EXPORT(node_id);)))) \
11811183

11821184
/**
11831185
* @brief Declare a device for each status "okay" devicetree node.

0 commit comments

Comments
 (0)