[tip: timers/core] posix-timers: Use clock_get_ktime() in common_timer_get()

From: tip-bot2 for Andrei Vagin
Date: Mon Jan 13 2020 - 14:11:43 EST


The following commit has been merged into the timers/core branch of tip:

Commit-ID: fe45ad37b4ae70db3923263d0b67313b7e1d746a
Gitweb: https://git.kernel.org/tip/fe45ad37b4ae70db3923263d0b67313b7e1d746a
Author: Andrei Vagin <avagin@xxxxxxxxx>
AuthorDate: Tue, 12 Nov 2019 01:26:59
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitterDate: Mon, 13 Jan 2020 08:10:50 +01:00

posix-timers: Use clock_get_ktime() in common_timer_get()

Now, when the clock_get_ktime() callback exists, the suboptimal
timespec64-based conversion can be removed from common_timer_get().

Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Co-developed-by: Dmitry Safonov <dima@xxxxxxxxxx>
Signed-off-by: Andrei Vagin <avagin@xxxxxxxxx>
Signed-off-by: Dmitry Safonov <dima@xxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20191112012724.250792-11-dima@xxxxxxxxxx

---
kernel/time/posix-timers.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index a1f6b96..fe1de4f 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -665,7 +665,6 @@ void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting)
{
const struct k_clock *kc = timr->kclock;
ktime_t now, remaining, iv;
- struct timespec64 ts64;
bool sig_none;

sig_none = timr->it_sigev_notify == SIGEV_NONE;
@@ -683,12 +682,7 @@ void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting)
return;
}

- /*
- * The timespec64 based conversion is suboptimal, but it's not
- * worth to implement yet another callback.
- */
- kc->clock_get_timespec(timr->it_clock, &ts64);
- now = timespec64_to_ktime(ts64);
+ now = kc->clock_get_ktime(timr->it_clock);

/*
* When a requeue is pending or this is a SIGEV_NONE timer move the