diff --git a/bootloaders/riotboot_dfu/Makefile b/bootloaders/riotboot_dfu/Makefile index 4a943449c9..615e7dd09c 100644 --- a/bootloaders/riotboot_dfu/Makefile +++ b/bootloaders/riotboot_dfu/Makefile @@ -6,7 +6,7 @@ USEMODULE += riotboot_usb_dfu # Use xtimer for scheduled reboot USEMODULE += ztimer -USEMODULE += ztimer_auto_init +USEMODULE += ztimer_init # USB device vendor and product ID # pid.codes test VID/PID, not globally unique diff --git a/sys/ztimer/Kconfig b/sys/ztimer/Kconfig index daad9f11b1..2537cb7367 100644 --- a/sys/ztimer/Kconfig +++ b/sys/ztimer/Kconfig @@ -171,13 +171,10 @@ config MODULE_ZTIMER if MODULE_ZTIMER -# TODO: only use MODULE_ZTIMER_AUTO_INIT, for now we try to get the same modules -# as the Makefile dependency resolution. See sys/ztimer/Makefile.dep for more -# info on why two modules are used. config MODULE_AUTO_INIT_ZTIMER bool "Auto initialize ztimer" depends on MODULE_AUTO_INIT - select MODULE_ZTIMER_AUTO_INIT + select MODULE_ZTIMER_INIT default y config MODULE_ZTIMER_NOW64 @@ -194,7 +191,7 @@ config MODULE_ZTIMER_MOCK manually fired to simulate different scenarios and test the ztimer implementation using this as a backing timer. -config MODULE_ZTIMER_AUTO_INIT +config MODULE_ZTIMER_INIT bool config MODULE_ZTIMER_CORE diff --git a/sys/ztimer/Makefile.dep b/sys/ztimer/Makefile.dep index 131efa2160..f92d76d74d 100644 --- a/sys/ztimer/Makefile.dep +++ b/sys/ztimer/Makefile.dep @@ -7,20 +7,11 @@ ifneq (,$(filter ztimer,$(USEMODULE))) USEMODULE += ztimer_core USEMODULE += ztimer_convert_frac USEMODULE += ztimer_convert_shift - - # ztimer's auto_init code resides in it's submodule "ztimer_auto_init", - # but RIOT's auto_init scheme expects "auto_init_ztimer" in DEFAULT_MODULES so - # it can be disabled (by adding to DISABLE_MODULES). - # - # "auto_init_%" modules cannot have further dependencies, so we cannot do - # "if auto_init_ztimer: use ztimer_auto_init". - # - # So, if neither "auto_init" nor "auto_init_ztimer" are disabled, pull in - # "ztimer_auto_init". - DEFAULT_MODULE += auto_init_ztimer - ifeq (,$(filter auto_init auto_init_ztimer,$(DISABLE_MODULE))) - USEMODULE += ztimer_auto_init + ifneq (,$(filter auto_init_ztimer,$(USEMODULE))) + USEMODULE += ztimer_init endif + DEFAULT_MODULE += auto_init_ztimer + DEFAULT_MODULE += ztimer_init endif # unless ztimer_xtimer_compat is used, make xtimer use ztimer_usec as backend. diff --git a/sys/ztimer/auto_init.c b/sys/ztimer/init.c similarity index 98% rename from sys/ztimer/auto_init.c rename to sys/ztimer/init.c index b24fdeb1fe..6436103f91 100644 --- a/sys/ztimer/auto_init.c +++ b/sys/ztimer/init.c @@ -37,7 +37,6 @@ */ #include "kernel_defines.h" -#if IS_USED(MODULE_AUTO_INIT_ZTIMER) || RIOTBOOT #include "board.h" #include "ztimer.h" @@ -302,4 +301,3 @@ void ztimer_init(void) # endif #endif } -#endif /* IS_USED(MODULE_AUTO_INIT_ZTIMER) || RIOTBOOT*/