Skip to content

Commit 3cbf653

Browse files
galakcarlescufi
authored andcommitted
counter: native_posix: Convert driver to use DT_INST
Rather than using a devicetree node label, utilize the driver compat and thus DT_INST which is standard means for most drivers. Signed-off-by: Kumar Gala <[email protected]>
1 parent 2ab42db commit 3cbf653

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/counter/counter_native_posix.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#define DT_DRV_COMPAT zephyr_native_posix_counter
8+
79
#include <zephyr/device.h>
810
#include <zephyr/drivers/counter.h>
911
#include <soc.h>
1012
#include <hw_counter.h>
1113

12-
#define DT_COUNTER_LABEL counter0
1314
#define DRIVER_CONFIG_INFO_FLAGS (COUNTER_CONFIG_INFO_COUNT_UP)
1415
#define DRIVER_CONFIG_INFO_CHANNELS 1
1516
#define COUNTER_NATIVE_POSIX_IRQ_FLAGS (0)
@@ -148,6 +149,6 @@ static const struct counter_config_info ctr_config = {
148149
.flags = DRIVER_CONFIG_INFO_FLAGS
149150
};
150151

151-
DEVICE_DT_DEFINE(DT_NODELABEL(DT_COUNTER_LABEL), ctr_init,
152+
DEVICE_DT_INST_DEFINE(0, ctr_init,
152153
NULL, NULL, &ctr_config, PRE_KERNEL_1,
153154
CONFIG_COUNTER_INIT_PRIORITY, &ctr_api);

0 commit comments

Comments
 (0)