timeout: Fix up API usage

Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them.  Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:

+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
  values for equality (e.g. with K_FOREVER or K_NO_WAIT).

+ Adding a k_msleep() synonym for k_sleep() which can continue to take
  integral arguments as k_sleep() moves away to timeout arguments.

+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
  generate timeout arguments.

+ Removing the usage of K_NO_WAIT as the final argument to
  K_THREAD_DEFINE().  This is just a count of milliseconds and we need
  to use a zero.

This patch include no logic changes and should not affect generated
code at all.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2020-03-05 14:54:28 -08:00 committed by Anas Nashif
commit 32bb2395c2
125 changed files with 363 additions and 341 deletions

View file

@ -99,11 +99,11 @@ enum sdhc_app_ext_cmd {
#define SDHC_RESPONSE_WRITE_ERR 0x0E
#define SDHC_MIN_TRIES 20
#define SDHC_RETRY_DELAY K_MSEC(20)
#define SDHC_RETRY_DELAY 20
/* Time to wait for the card to initialise */
#define SDHC_INIT_TIMEOUT K_MSEC(5000)
#define SDHC_INIT_TIMEOUT 5000
/* Time to wait for the card to respond or come ready */
#define SDHC_READY_TIMEOUT K_MSEC(500)
#define SDHC_READY_TIMEOUT 500
enum sdhc_rsp_type {
SDHC_RSP_TYPE_NONE = 0U,
@ -568,7 +568,7 @@ static inline bool sdhc_retry_ok(struct sdhc_retry *retry)
if (retry->tries < SDHC_MIN_TRIES) {
retry->tries++;
if (retry->sleep != 0U) {
k_sleep(retry->sleep);
k_msleep(retry->sleep);
}
return true;
@ -576,7 +576,7 @@ static inline bool sdhc_retry_ok(struct sdhc_retry *retry)
if (remain >= 0) {
if (retry->sleep > 0) {
k_sleep(retry->sleep);
k_msleep(retry->sleep);
} else {
k_yield();
}