posix-timers: Retrieve interval in common timer_settime() code
No point in doing this all over the place. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Reviewed-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
This commit is contained in:
parent
c20b99e324
commit
bfa408f03f
@ -622,8 +622,8 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
|
||||
{
|
||||
bool sigev_none = timer->it_sigev_notify == SIGEV_NONE;
|
||||
clockid_t clkid = CPUCLOCK_WHICH(timer->it_clock);
|
||||
u64 old_expires, new_expires, old_incr, now;
|
||||
struct cpu_timer *ctmr = &timer->it.cpu;
|
||||
u64 old_expires, new_expires, now;
|
||||
struct sighand_struct *sighand;
|
||||
struct task_struct *p;
|
||||
unsigned long flags;
|
||||
@ -660,10 +660,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disarm any old timer after extracting its expiry time.
|
||||
*/
|
||||
old_incr = timer->it_interval;
|
||||
/* Retrieve the current expiry time before disarming the timer */
|
||||
old_expires = cpu_timer_getexpires(ctmr);
|
||||
|
||||
if (unlikely(timer->it.cpu.firing)) {
|
||||
@ -742,9 +739,6 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
|
||||
cpu_timer_fire(timer);
|
||||
out:
|
||||
rcu_read_unlock();
|
||||
if (old)
|
||||
old->it_interval = ns_to_timespec64(old_incr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -904,7 +904,7 @@ static int do_timer_settime(timer_t timer_id, int tmr_flags,
|
||||
const struct k_clock *kc;
|
||||
struct k_itimer *timr;
|
||||
unsigned long flags;
|
||||
int error = 0;
|
||||
int error;
|
||||
|
||||
if (!timespec64_valid(&new_spec64->it_interval) ||
|
||||
!timespec64_valid(&new_spec64->it_value))
|
||||
@ -918,6 +918,9 @@ retry:
|
||||
if (!timr)
|
||||
return -EINVAL;
|
||||
|
||||
if (old_spec64)
|
||||
old_spec64->it_interval = ktime_to_timespec64(timr->it_interval);
|
||||
|
||||
kc = timr->kclock;
|
||||
if (WARN_ON_ONCE(!kc || !kc->timer_set))
|
||||
error = -EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user