* [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
* Re: [PATCH] alarmtimer: return correct remaining time
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
1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Ojha @ 2019-04-08 6:17 UTC (permalink / raw)
To: Andrei Vagin, Thomas Gleixner; +Cc: linux-kernel, Stephen Boyd, John Stultz
On 4/8/2019 9:45 AM, Andrei Vagin wrote:
> 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);
Looks good to me.
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Cheers,
-Mukesh
> }
>
> /**
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:timers/urgent] alarmtimer: Return correct remaining time
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-bot for Andrei Vagin
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Andrei Vagin @ 2019-04-10 13:28 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, linux-kernel, mojha, hpa, mingo, john.stultz, avagin, sboyd
Commit-ID: 07d7e12091f4ab869cc6a4bb276399057e73b0b3
Gitweb: https://git.kernel.org/tip/07d7e12091f4ab869cc6a4bb276399057e73b0b3
Author: Andrei Vagin <avagin@gmail.com>
AuthorDate: Sun, 7 Apr 2019 21:15:42 -0700
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 10 Apr 2019 15:23:26 +0200
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
---
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);
}
/**
^ 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).