linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] alarmtimer: return correct remaining time
@ 2019-04-08  4:15 Andrei Vagin
  2019-04-08  6:17 ` Mukesh Ojha
  2019-04-10 13:28 ` [tip:timers/urgent] alarmtimer: Return " tip-bot for Andrei Vagin
  0 siblings, 2 replies; 3+ messages in thread
From: Andrei Vagin @ 2019-04-08  4:15 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, Stephen Boyd, John Stultz, Andrei Vagin

To calculate a remaining time, we need to subtract the current time from
the expiration time. Currently, arguments of ktime_sub are swapped.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
---
 kernel/time/alarmtimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 2c97e8c2d29f..0519a8805aab 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -594,7 +594,7 @@ static ktime_t alarm_timer_remaining(struct k_itimer *timr, ktime_t now)
 {
 	struct alarm *alarm = &timr->it.alarm.alarmtimer;
 
-	return ktime_sub(now, alarm->node.expires);
+	return ktime_sub(alarm->node.expires, now);
 }
 
 /**
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-10 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08  4:15 [PATCH] alarmtimer: return correct remaining time Andrei Vagin
2019-04-08  6:17 ` Mukesh Ojha
2019-04-10 13:28 ` [tip:timers/urgent] alarmtimer: Return " tip-bot for Andrei Vagin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).