idle: Remove needless "expired" logic in sys_power_save_idle()

This code (just refactored as part of the timer API work) turns out to
be needless.  It's trying to detect the case where we're being asked
to idle for zero time, but that's not possible with a properly
functioning timer driver: the call to z_clock_announce() must happen
out of an interrupt, and this is the idle thread, which must sit below
any possible interrupt priority.  The call to z_clock_uptime() must
not ever return "too late" until after the timer interrupt has fired,
at which point we'll be inspecting the next timeout (which itself is
guaranteed to be in the future for the same reason).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2018-09-22 09:13:13 -07:00 committed by Anas Nashif
parent 722a888ef7
commit d7b35c9bd6

View File

@ -13,8 +13,6 @@
#include <power.h>
#include <stdbool.h>
extern u64_t z_last_tick_announced;
#if defined(CONFIG_TICKLESS_IDLE)
/*
* Idle time must be this value or higher for timer to go into tickless idle
@ -72,22 +70,6 @@ static void set_kernel_idle_time_in_ticks(s32_t ticks)
#ifndef CONFIG_SMP
static void sys_power_save_idle(s32_t ticks)
{
#ifdef CONFIG_TICKLESS_KERNEL
if (ticks != K_FOREVER) {
ticks -= (int)(z_clock_uptime() - z_last_tick_announced);
if (!ticks) {
/*
* Timer has expired or about to expire
* No time for power saving operations
*
* Note that it will never be zero unless some time
* had elapsed since timer was last programmed.
*/
k_cpu_idle();
return;
}
}
#endif
if (_must_enter_tickless_idle(ticks)) {
/*
* Stop generating system timer interrupts until it's time for