From 8e8f41faebfb4eb6320b73a3c2607de3dc89d59c Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 4 Sep 2020 02:55:05 -0700 Subject: [PATCH] drivers/timer: auto select the related option in Kconfig to avoid the user make the wrong combination in defconfig Signed-off-by: Xiang Xiao --- drivers/timers/Kconfig | 3 +++ drivers/timers/arch_alarm.c | 12 ------------ drivers/timers/arch_timer.c | 12 ++---------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/timers/Kconfig b/drivers/timers/Kconfig index 0267d582f9..b99c2896ff 100644 --- a/drivers/timers/Kconfig +++ b/drivers/timers/Kconfig @@ -67,6 +67,7 @@ config TIMER_ARCH bool "Timer Arch Implementation" select ARCH_HAVE_TICKLESS select ARCH_HAVE_TIMEKEEPING + select SCHED_TICKLESS_LIMIT_MAX_SLEEP if SCHED_TICKLESS ---help--- Implement timer arch API on top of timer driver interface. @@ -86,6 +87,8 @@ config ALARM_ARCH bool "Alarm Arch Implementation" select ARCH_HAVE_TICKLESS select ARCH_HAVE_TIMEKEEPING + select SCHED_TICKLESS_ALARM if SCHED_TICKLESS + select SCHED_TICKLESS_LIMIT_MAX_SLEEP if SCHED_TICKLESS ---help--- Implement alarm arch API on top of oneshot driver interface. diff --git a/drivers/timers/arch_alarm.c b/drivers/timers/arch_alarm.c index 8a2c5f5440..e6c1cbbbe4 100644 --- a/drivers/timers/arch_alarm.c +++ b/drivers/timers/arch_alarm.c @@ -32,18 +32,6 @@ * Pre-processor Definitions ****************************************************************************/ -#ifdef CONFIG_SCHED_TICKLESS - -# ifndef CONFIG_SCHED_TICKLESS_ALARM -# error CONFIG_SCHED_TICKLESS_ALARM must be set to use CONFIG_SCHED_TICKLESS -# endif - -# ifndef CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP -# error CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP must be set to use CONFIG_SCHED_TICKLESS -# endif - -#endif - #define CONFIG_BOARD_LOOPSPER100USEC ((CONFIG_BOARD_LOOPSPERMSEC+5)/10) #define CONFIG_BOARD_LOOPSPER10USEC ((CONFIG_BOARD_LOOPSPERMSEC+50)/100) #define CONFIG_BOARD_LOOPSPERUSEC ((CONFIG_BOARD_LOOPSPERMSEC+500)/1000) diff --git a/drivers/timers/arch_timer.c b/drivers/timers/arch_timer.c index 949ec10300..1f5b70a040 100644 --- a/drivers/timers/arch_timer.c +++ b/drivers/timers/arch_timer.c @@ -32,16 +32,8 @@ * Pre-processor Definitions ****************************************************************************/ -#ifdef CONFIG_SCHED_TICKLESS - -# ifdef CONFIG_SCHED_TICKLESS_ALARM -# error CONFIG_SCHED_TICKLESS_ALARM must be unset to use CONFIG_SCHED_TICKLESS -# endif - -# ifndef CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP -# error CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP must be set to use CONFIG_SCHED_TICKLESS -# endif - +#if defined(CONFIG_SCHED_TICKLESS) && defined(CONFIG_SCHED_TICKLESS_ALARM) +# error CONFIG_SCHED_TICKLESS_ALARM must be unset to use the arch timer #endif #define CONFIG_BOARD_LOOPSPER100USEC ((CONFIG_BOARD_LOOPSPERMSEC+5)/10)