From 393ec71ec3efe0ed222cdcbf7817c5bc1d848d1e Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Wed, 19 Sep 2018 11:08:19 -0700 Subject: [PATCH] clock: Remove CONFIG_TICKLESS_KERNEL_TIME_UNIT_IN_MICRO_SECS This was only used in a few places just to indirect the already perfectly valid SYS_CLOCK_TICKS_PER_SEC value. There's no reason for these to ever have been kconfig units, and in fact the distinction appears to have introduced a hidden/untested bug in the power subsystem (the two variables were used interchangably, but they were defined in reciprocal units!). Just use "ticks" as our time unit pervasively, and clarify the docs to explain that. Signed-off-by: Andy Ross --- include/sys_clock.h | 4 ---- kernel/Kconfig | 5 +++++ kernel/Kconfig.power_mgmt | 12 ------------ subsys/power/policy/policy_residency.c | 4 ---- 4 files changed, 5 insertions(+), 20 deletions(-) diff --git a/include/sys_clock.h b/include/sys_clock.h index 3c72fdfc2cf..8010822f4f7 100644 --- a/include/sys_clock.h +++ b/include/sys_clock.h @@ -28,11 +28,7 @@ extern "C" { static inline int sys_clock_ticks_per_sec(void) { -#ifdef CONFIG_TICKLESS_KERNEL - return 1000000 / (CONFIG_TICKLESS_KERNEL_TIME_UNIT_IN_MICRO_SECS); -#else return CONFIG_SYS_CLOCK_TICKS_PER_SEC; -#endif } #ifdef CONFIG_TICKLESS_KERNEL diff --git a/kernel/Kconfig b/kernel/Kconfig index 302806a6b38..bec29162736 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -516,6 +516,11 @@ config SYS_CLOCK_TICKS_PER_SEC can require a non-trivial extra amount of stack space (e.g. around 80 bytes on x86). + Note that when available and enabled, in "tickless" mode + this config variable specifies the minimum available timing + granularity, not necessarily the number or frequency of + interrupts delivered to the kernel. + config SYS_CLOCK_HW_CYCLES_PER_SEC int "System clock's h/w timer frequency" help diff --git a/kernel/Kconfig.power_mgmt b/kernel/Kconfig.power_mgmt index 3f0cf0a7512..dcc53d86ea2 100644 --- a/kernel/Kconfig.power_mgmt +++ b/kernel/Kconfig.power_mgmt @@ -97,18 +97,6 @@ config TICKLESS_KERNEL clock interrupt generation would be stopped at all times. This option requires Tickless Idle option to be enabled. -config TICKLESS_KERNEL_TIME_UNIT_IN_MICRO_SECS - int "Tickless kernel time unit in micro seconds" - default 1000 - depends on TICKLESS_KERNEL - help - This option makes the system clock and scheduling granularity. - The default will be one millisecond. This option also determines - the time unit passed in functions like _sys_soc_suspend. The - value should be determined based what the timer hardware and driver - can support. Specifying too small a time unit than what the overall - system speed can support would cause scheduling errors. - config BUSY_WAIT_USES_ALTERNATE_CLOCK bool "Busy wait uses alternate clock in tickless kernel mode" help diff --git a/subsys/power/policy/policy_residency.c b/subsys/power/policy/policy_residency.c index 5bcdfc45e66..47a78043c7b 100644 --- a/subsys/power/policy/policy_residency.c +++ b/subsys/power/policy/policy_residency.c @@ -13,11 +13,7 @@ #include LOG_MODULE_DECLARE(power); -#ifdef CONFIG_TICKLESS_KERNEL -#define SECS_TO_TICKS CONFIG_TICKLESS_KERNEL_TIME_UNIT_IN_MICRO_SECS -#else #define SECS_TO_TICKS CONFIG_SYS_CLOCK_TICKS_PER_SEC -#endif #if !(defined(CONFIG_SYS_POWER_STATE_CPU_LPS_SUPPORTED) || \ defined(CONFIG_SYS_POWER_STATE_CPU_LPS_1_SUPPORTED) || \