Module: xenomai-3
Branch: next
Commit: 3645c68ea889c255d9873ce1c4c97b35450fd059
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3645c68ea889c255d9873ce1c4c97b35450fd059

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Thu May 12 21:02:40 2016 +0200

cobalt/kernel: Fix xntimer_get_timeout_stopped

xntimer_get_timeout_stopped just called into xntimer_get_timeout, but
the latter returned XN_INFINITE for stopped timers. Restore the desired
behavior from Xenomai 2.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 include/cobalt/kernel/timer.h |   12 ++++++++++--
 kernel/cobalt/timer.c         |    7 ++-----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
index 9f85985..f45a753 100644
--- a/include/cobalt/kernel/timer.h
+++ b/include/cobalt/kernel/timer.h
@@ -474,7 +474,7 @@ void __xntimer_stop(struct xntimer *timer);
 
 xnticks_t xntimer_get_date(struct xntimer *timer);
 
-xnticks_t xntimer_get_timeout(struct xntimer *timer);
+xnticks_t __xntimer_get_timeout(struct xntimer *timer);
 
 xnticks_t xntimer_get_interval(struct xntimer *timer);
 
@@ -486,9 +486,17 @@ static inline void xntimer_stop(struct xntimer *timer)
                __xntimer_stop(timer);
 }
 
+static inline xnticks_t xntimer_get_timeout(struct xntimer *timer)
+{
+       if (!xntimer_running_p(timer))
+               return XN_INFINITE;
+
+       return __xntimer_get_timeout(timer);
+}
+
 static inline xnticks_t xntimer_get_timeout_stopped(struct xntimer *timer)
 {
-       return xntimer_get_timeout(timer);
+       return __xntimer_get_timeout(timer);
 }
 
 static inline void xntimer_enqueue(struct xntimer *timer,
diff --git a/kernel/cobalt/timer.c b/kernel/cobalt/timer.c
index bc5893d..c1a2081 100644
--- a/kernel/cobalt/timer.c
+++ b/kernel/cobalt/timer.c
@@ -266,14 +266,11 @@ EXPORT_SYMBOL_GPL(xntimer_get_date);
  *
  * @coretags{unrestricted, atomic-entry}
  */
-xnticks_t xntimer_get_timeout(struct xntimer *timer)
+xnticks_t __xntimer_get_timeout(struct xntimer *timer)
 {
        struct xnclock *clock;
        xnticks_t expiry, now;
 
-       if (!xntimer_running_p(timer))
-               return XN_INFINITE;
-
        clock = xntimer_clock(timer);
        now = xnclock_read_raw(clock);
        expiry = xntimer_expiry(timer);
@@ -282,7 +279,7 @@ xnticks_t xntimer_get_timeout(struct xntimer *timer)
 
        return xnclock_ticks_to_ns(clock, expiry - now);
 }
-EXPORT_SYMBOL_GPL(xntimer_get_timeout);
+EXPORT_SYMBOL_GPL(__xntimer_get_timeout);
 
 /**
  * @fn void xntimer_init(struct xntimer *timer,struct xnclock *clock,void 
(*handler)(struct xntimer *timer), struct xnsched *sched, int flags)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to