Skip to content

Commit e0ac59f

Browse files
henrikbrixandersencarlescufi
authored andcommitted
tests: canbus: isotp: implementation: switch to DEVICE_DT_GET()
Switch from using device_get_binding() to DEVICE_DT_GET(). Signed-off-by: Henrik Brix Andersen <[email protected]>
1 parent b8d8b69 commit e0ac59f

File tree

1 file changed

+3
-5
lines changed
  • tests/subsys/canbus/isotp/implementation/src

1 file changed

+3
-5
lines changed

tests/subsys/canbus/isotp/implementation/src/main.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#define NUMBER_OF_REPETITIONS 5
1313
#define DATA_SIZE_SF 7
1414

15-
#define CAN_DEVICE_NAME DT_LABEL(DT_CHOSEN(zephyr_canbus))
16-
1715
/*
1816
* @addtogroup t_can
1917
* @{
@@ -27,7 +25,7 @@
2725
* @}
2826
*/
2927

30-
const struct device *can_dev;
28+
const struct device *can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
3129

3230
const struct isotp_fc_opts fc_opts = {
3331
.bs = 8,
@@ -417,8 +415,8 @@ void test_main(void)
417415
zassert_true(sizeof(random_data) >= sizeof(data_buf) * 2 + 10,
418416
"Test data size to small");
419417

420-
can_dev = device_get_binding(CAN_DEVICE_NAME);
421-
zassert_not_null(can_dev, "CAN device not not found");
418+
zassert_true(device_is_ready(can_dev), "CAN device not ready");
419+
422420
ret = can_set_mode(can_dev, CAN_LOOPBACK_MODE);
423421
zassert_equal(ret, 0, "Configuring loopback mode failed (%d)", ret);
424422

0 commit comments

Comments
 (0)