Commit 07d7e120 authored by Andrei Vagin's avatar Andrei Vagin Committed by Thomas Gleixner

alarmtimer: Return correct remaining time

To calculate a remaining time, it's required to subtract the current time
from the expiration time. In alarm_timer_remaining() the arguments of
ktime_sub are swapped.

Fixes: d653d845 ("alarmtimer: Implement remaining callback")
Signed-off-by: default avatarAndrei Vagin <avagin@gmail.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarMukesh Ojha <mojha@codeaurora.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20190408041542.26338-1-avagin@gmail.com
parent 2a6a8e2d
...@@ -594,7 +594,7 @@ static ktime_t alarm_timer_remaining(struct k_itimer *timr, ktime_t now) ...@@ -594,7 +594,7 @@ static ktime_t alarm_timer_remaining(struct k_itimer *timr, ktime_t now)
{ {
struct alarm *alarm = &timr->it.alarm.alarmtimer; struct alarm *alarm = &timr->it.alarm.alarmtimer;
return ktime_sub(now, alarm->node.expires); return ktime_sub(alarm->node.expires, now);
} }
/** /**
......
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