aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/alarmtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/time/alarmtimer.c')
-rw-r--r--kernel/time/alarmtimer.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index b7d75a9e8ccf..271ce6c12907 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -432,7 +432,7 @@ int alarm_cancel(struct alarm *alarm)
432 int ret = alarm_try_to_cancel(alarm); 432 int ret = alarm_try_to_cancel(alarm);
433 if (ret >= 0) 433 if (ret >= 0)
434 return ret; 434 return ret;
435 cpu_relax(); 435 hrtimer_cancel_wait_running(&alarm->timer);
436 } 436 }
437} 437}
438EXPORT_SYMBOL_GPL(alarm_cancel); 438EXPORT_SYMBOL_GPL(alarm_cancel);
@@ -606,6 +606,19 @@ static int alarm_timer_try_to_cancel(struct k_itimer *timr)
606} 606}
607 607
608/** 608/**
609 * alarm_timer_wait_running - Posix timer callback to wait for a timer
610 * @timr: Pointer to the posixtimer data struct
611 *
612 * Called from the core code when timer cancel detected that the callback
613 * is running. @timr is unlocked and rcu read lock is held to prevent it
614 * from being freed.
615 */
616static void alarm_timer_wait_running(struct k_itimer *timr)
617{
618 hrtimer_cancel_wait_running(&timr->it.alarm.alarmtimer.timer);
619}
620
621/**
609 * alarm_timer_arm - Posix timer callback to arm a timer 622 * alarm_timer_arm - Posix timer callback to arm a timer
610 * @timr: Pointer to the posixtimer data struct 623 * @timr: Pointer to the posixtimer data struct
611 * @expires: The new expiry time 624 * @expires: The new expiry time
@@ -834,6 +847,7 @@ const struct k_clock alarm_clock = {
834 .timer_forward = alarm_timer_forward, 847 .timer_forward = alarm_timer_forward,
835 .timer_remaining = alarm_timer_remaining, 848 .timer_remaining = alarm_timer_remaining,
836 .timer_try_to_cancel = alarm_timer_try_to_cancel, 849 .timer_try_to_cancel = alarm_timer_try_to_cancel,
850 .timer_wait_running = alarm_timer_wait_running,
837 .nsleep = alarm_timer_nsleep, 851 .nsleep = alarm_timer_nsleep,
838}; 852};
839#endif /* CONFIG_POSIX_TIMERS */ 853#endif /* CONFIG_POSIX_TIMERS */