Skip to content

Commit e6dfdfe

Browse files
committed
drivers: video: emul_rx: hotfix: force use of constant value
In some compilation attempts, the compiler did not accept a static const variable as initializer. This caused build errors in only some contexts. Always use the devicetree macros to access it. Signed-off-by: Josuah Demangeon <[email protected]>
1 parent 89dd0ef commit e6dfdfe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/video/video_emul_rx.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,11 @@ int emul_rx_init(const struct device *dev)
269269
return 0;
270270
}
271271

272+
#define SOURCE_DEV(n) DEVICE_DT_GET(DT_NODE_REMOTE_DEVICE(DT_INST_ENDPOINT_BY_ID(n, 0, 0)))
273+
272274
#define EMUL_RX_DEFINE(n) \
273275
static const struct emul_rx_config emul_rx_cfg_##n = { \
274-
.source_dev = \
275-
DEVICE_DT_GET(DT_NODE_REMOTE_DEVICE(DT_INST_ENDPOINT_BY_ID(n, 0, 0))), \
276+
.source_dev = SOURCE_DEV(n), \
276277
}; \
277278
\
278279
static struct emul_rx_data emul_rx_data_##n = { \
@@ -282,6 +283,6 @@ int emul_rx_init(const struct device *dev)
282283
DEVICE_DT_INST_DEFINE(n, &emul_rx_init, NULL, &emul_rx_data_##n, &emul_rx_cfg_##n, \
283284
POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, &emul_rx_driver_api); \
284285
\
285-
VIDEO_DEVICE_DEFINE(emul_rx_##n, DEVICE_DT_INST_GET(n), emul_rx_cfg_##n.source_dev);
286+
VIDEO_DEVICE_DEFINE(emul_rx_##n, DEVICE_DT_INST_GET(n), SOURCE_DEV(n));
286287

287288
DT_INST_FOREACH_STATUS_OKAY(EMUL_RX_DEFINE)

0 commit comments

Comments
 (0)