pm: idle: Remove not necessary branch
Remove a constant branch calling directly pm_save_idle. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
f20250cc5a
commit
72262475f4
1 changed files with 22 additions and 34 deletions
|
@ -17,37 +17,6 @@
|
||||||
|
|
||||||
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
|
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Indicate that kernel is idling in tickless mode
|
|
||||||
*
|
|
||||||
* Sets the kernel data structure idle field to either a positive value or
|
|
||||||
* K_FOREVER.
|
|
||||||
*/
|
|
||||||
static void pm_save_idle(void)
|
|
||||||
{
|
|
||||||
#ifdef CONFIG_PM
|
|
||||||
int32_t ticks = z_get_next_timeout_expiry();
|
|
||||||
_kernel.idle = ticks;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Call the suspend hook function of the soc interface to allow
|
|
||||||
* entry into a low power state. The function returns
|
|
||||||
* false if low power state was not entered, in which
|
|
||||||
* case, kernel does normal idle processing.
|
|
||||||
*
|
|
||||||
* This function is entered with interrupts disabled. If a low power
|
|
||||||
* state was entered, then the hook function should enable inerrupts
|
|
||||||
* before exiting. This is because the kernel does not do its own idle
|
|
||||||
* processing in those cases i.e. skips k_cpu_idle(). The kernel's
|
|
||||||
* idle processing re-enables interrupts which is essential for
|
|
||||||
* the kernel's scheduling logic.
|
|
||||||
*/
|
|
||||||
if (pm_system_suspend(ticks) == false) {
|
|
||||||
k_cpu_idle();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void z_pm_save_idle_exit(void)
|
void z_pm_save_idle_exit(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
|
@ -92,11 +61,30 @@ void idle(void *unused1, void *unused2, void *unused3)
|
||||||
*/
|
*/
|
||||||
(void) arch_irq_lock();
|
(void) arch_irq_lock();
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_PM)) {
|
#ifdef CONFIG_PM
|
||||||
pm_save_idle();
|
_kernel.idle = z_get_next_timeout_expiry();
|
||||||
} else {
|
|
||||||
|
/*
|
||||||
|
* Call the suspend hook function of the soc interface
|
||||||
|
* to allow entry into a low power state. The function
|
||||||
|
* returns false if low power state was not entered, in
|
||||||
|
* which case, kernel does normal idle processing.
|
||||||
|
*
|
||||||
|
* This function is entered with interrupts disabled.
|
||||||
|
* If a low power state was entered, then the hook
|
||||||
|
* function should enable inerrupts before exiting.
|
||||||
|
* This is because the kernel does not do its own idle
|
||||||
|
* processing in those cases i.e. skips k_cpu_idle().
|
||||||
|
* The kernel's idle processing re-enables interrupts
|
||||||
|
* which is essential for the kernel's scheduling
|
||||||
|
* logic.
|
||||||
|
*/
|
||||||
|
if (pm_system_suspend(_kernel.idle) == false) {
|
||||||
k_cpu_idle();
|
k_cpu_idle();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
k_cpu_idle();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(CONFIG_PREEMPT_ENABLED)
|
#if !defined(CONFIG_PREEMPT_ENABLED)
|
||||||
# if !defined(CONFIG_USE_SWITCH) || defined(CONFIG_SPARC)
|
# if !defined(CONFIG_USE_SWITCH) || defined(CONFIG_SPARC)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue