summaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2019-04-08 06:15:42 +0200
committerThomas Gleixner <tglx@linutronix.de>2019-04-10 15:23:26 +0200
commit07d7e12091f4ab869cc6a4bb276399057e73b0b3 (patch)
treedd505b68149ade6a64d4cce596329209b8cbbc24 /kernel/time
parentclocksource/drivers/clps711x: Remove board support (diff)
downloadlinux-07d7e12091f4ab869cc6a4bb276399057e73b0b3.tar.xz
linux-07d7e12091f4ab869cc6a4bb276399057e73b0b3.zip
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: d653d8457c76 ("alarmtimer: Implement remaining callback") Signed-off-by: Andrei Vagin <avagin@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Mukesh 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
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/alarmtimer.c2
1 files changed, 1 insertions, 1 deletions
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);
}
/**