mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 21:57:43 +00:00
alarmtimer: Implement try_to_cancel callback
Preparatory change to utilize the common posix timer mechanisms. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: John Stultz <john.stultz@linaro.org> Link: http://lkml.kernel.org/r/20170530211657.670026824@linutronix.de
This commit is contained in:
parent
d653d8457c
commit
e344c9e76b
1 changed files with 10 additions and 0 deletions
|
@ -572,6 +572,15 @@ static ktime_t alarm_timer_remaining(struct k_itimer *timr, ktime_t now)
|
||||||
return ktime_sub(now, alarm->node.expires);
|
return ktime_sub(now, alarm->node.expires);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* alarm_timer_try_to_cancel - Posix timer callback to cancel a timer
|
||||||
|
* @timr: Pointer to the posixtimer data struct
|
||||||
|
*/
|
||||||
|
static int alarm_timer_try_to_cancel(struct k_itimer *timr)
|
||||||
|
{
|
||||||
|
return alarm_try_to_cancel(&timr->it.alarm.alarmtimer);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* alarm_clock_getres - posix getres interface
|
* alarm_clock_getres - posix getres interface
|
||||||
* @which_clock: clockid
|
* @which_clock: clockid
|
||||||
|
@ -902,6 +911,7 @@ const struct k_clock alarm_clock = {
|
||||||
.timer_rearm = alarm_timer_rearm,
|
.timer_rearm = alarm_timer_rearm,
|
||||||
.timer_forward = alarm_timer_forward,
|
.timer_forward = alarm_timer_forward,
|
||||||
.timer_remaining = alarm_timer_remaining,
|
.timer_remaining = alarm_timer_remaining,
|
||||||
|
.timer_try_to_cancel = alarm_timer_try_to_cancel,
|
||||||
.nsleep = alarm_timer_nsleep,
|
.nsleep = alarm_timer_nsleep,
|
||||||
};
|
};
|
||||||
#endif /* CONFIG_POSIX_TIMERS */
|
#endif /* CONFIG_POSIX_TIMERS */
|
||||||
|
|
Loading…
Reference in a new issue