Commit 544cd293 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/timer: Check if nklock is held in timer services

Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 077be2e9
......@@ -118,6 +118,8 @@ int xntimer_start(struct xntimer *timer,
unsigned long gravity;
int ret = 0;
atomic_only();
trace_cobalt_timer_start(timer, value, interval, mode);
if ((timer->status & XNTIMER_DEQUEUED) == 0)
......@@ -204,6 +206,8 @@ void __xntimer_stop(struct xntimer *timer)
struct xnsched *sched;
int heading = 1;
atomic_only();
trace_cobalt_timer_stop(timer);
if ((timer->status & XNTIMER_DEQUEUED) == 0) {
......@@ -239,6 +243,8 @@ EXPORT_SYMBOL_GPL(__xntimer_stop);
*/
xnticks_t xntimer_get_date(struct xntimer *timer)
{
atomic_only();
if (!xntimer_running_p(timer))
return XN_INFINITE;
......@@ -269,6 +275,8 @@ xnticks_t __xntimer_get_timeout(struct xntimer *timer)
struct xnclock *clock;
xnticks_t expiry, now;
atomic_only();
clock = xntimer_clock(timer);
now = xnclock_read_raw(clock);
expiry = xntimer_expiry(timer);
......@@ -431,6 +439,8 @@ void __xntimer_switch_tracking(struct xntimer *timer,
void xntimer_set_clock(struct xntimer *timer,
struct xnclock *newclock)
{
atomic_only();
if (timer->clock != newclock) {
xntimer_stop(timer);
timer->clock = newclock;
......@@ -605,6 +615,8 @@ unsigned long long xntimer_get_overruns(struct xntimer *timer,
xnsticks_t delta;
xntimerq_t *q;
atomic_only();
delta = now - xntimer_pexpect(timer);
if (unlikely(delta >= (xnsticks_t) period)) {
period = timer->interval_ns;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment