Skip to content

Commit

Permalink
kernel/timeout: Misc. API updates
Browse files Browse the repository at this point in the history
These crossed in a rebase, where new code (or in the header's case old
code included in new context) needs to honor the new timeout API
conventions.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
  • Loading branch information
Andy Ross committed Oct 1, 2019
1 parent 573bfba commit f267e8f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/adc/adc_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static inline void adc_context_enable_timer(struct adc_context *ctx)
u32_t interval_us = ctx->options.interval_us;
u32_t interval_ms = ceiling_fraction(interval_us, 1000UL);

k_timer_start(&ctx->timer, 0, interval_ms);
k_timer_start(&ctx->timer, K_NO_WAIT, K_TIMEOUT_MS(interval_ms));
}

static inline void adc_context_disable_timer(struct adc_context *ctx)
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/lis2mdl/lis2mdl_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ int lis2mdl_init_interrupt(struct device *dev)
CONFIG_LIS2MDL_THREAD_STACK_SIZE,
(k_thread_entry_t)lis2mdl_thread, dev,
0, NULL, K_PRIO_COOP(CONFIG_LIS2MDL_THREAD_PRIORITY),
0, 0);
0, K_NO_WAIT);
#elif defined(CONFIG_LIS2MDL_TRIGGER_GLOBAL_THREAD)
lis2mdl->work.handler = lis2mdl_work_cb;
lis2mdl->dev = dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/timer/apic_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void z_clock_set_timeout(s32_t n, bool idle)

if (n < 1) {
full_ticks = 0;
} else if ((n == K_FOREVER) || (n > MAX_TICKS)) {
} else if ((n == K_FOREVER_TICKS) || (n > MAX_TICKS)) {
full_ticks = MAX_TICKS - 1;
} else {
full_ticks = n - 1;
Expand Down
2 changes: 1 addition & 1 deletion drivers/timer/cc13x2_cc26x2_rtc_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void z_clock_set_timeout(s32_t ticks, bool idle)

#ifdef CONFIG_TICKLESS_KERNEL

ticks = (ticks == K_FOREVER) ? MAX_TICKS : ticks;
ticks = (ticks == K_FOREVER_TICKS) ? MAX_TICKS : ticks;
ticks = MAX(MIN(ticks - 1, (s32_t) MAX_TICKS), 0);

k_spinlock_key_t key = k_spin_lock(&lock);
Expand Down
4 changes: 2 additions & 2 deletions drivers/timer/mchp_xec_rtos_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void z_clock_set_timeout(s32_t n, bool idle)
u32_t full_cycles; /* full_ticks represented as cycles */
u32_t partial_cycles; /* number of cycles to first tick boundary */

if (idle && (n == K_FOREVER)) {
if (idle && (n == K_FOREVER_TICKS)) {
/*
* We are not in a locked section. Are writes to two
* global objects safe from pre-emption?
Expand All @@ -142,7 +142,7 @@ void z_clock_set_timeout(s32_t n, bool idle)

if (n < 1) {
full_ticks = 0;
} else if ((n == K_FOREVER) || (n > MAX_TICKS)) {
} else if ((n == K_FOREVER_TICKS) || (n > MAX_TICKS)) {
full_ticks = MAX_TICKS - 1;
} else {
full_ticks = n - 1;
Expand Down

0 comments on commit f267e8f

Please sign in to comment.