kernel: Fix k_*_sys_clock_always_on macro

Commit 2b8cf4c98e ("include: kernel: Fix documentation for
TICKLESS_KERNEL API's")' defined a macro to fix documentation when
TKCKLESS_KERNEL is not available but this macro does not return the
same the functions returns, so its use may result in compilation
error.

Another point to consider is that if one is using this function
without it be enabled is better to return a proper error like ENOTSUP
explicitly saying that this is not supported.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2018-08-13 12:32:56 -07:00 committed by Anas Nashif
commit f23a8cdd2d

View file

@ -1669,19 +1669,19 @@ __syscall s64_t k_uptime_get(void);
*
* @retval prev_status Previous status of always on flag
*/
#ifdef CONFIG_TICKLESS_KERNEL
static inline int k_enable_sys_clock_always_on(void)
{
#ifdef CONFIG_TICKLESS_KERNEL
int prev_status = _sys_clock_always_on;
_sys_clock_always_on = 1;
_enable_sys_clock();
return prev_status;
}
#else
#define k_enable_sys_clock_always_on() do { } while ((0))
return -ENOTSUP;
#endif
}
/**
* @brief Disable clock always on in tickless kernel
@ -1691,14 +1691,12 @@ static inline int k_enable_sys_clock_always_on(void)
* scheduling. To save power, this routine should be called
* immediately when clock is not used to track time.
*/
#ifdef CONFIG_TICKLESS_KERNEL
static inline void k_disable_sys_clock_always_on(void)
{
#ifdef CONFIG_TICKLESS_KERNEL
_sys_clock_always_on = 0;
}
#else
#define k_disable_sys_clock_always_on() do { } while ((0))
#endif
}
/**
* @brief Get system uptime (32-bit version).