ktime: Cleanup ktime_set() usage
ktime_set(S,N) was required for the timespec storage type and is still useful for situations where a Seconds and Nanoseconds part of a time value needs to be converted. For anything where the Seconds argument is 0, this is pointless and can be replaced with a simple assignment. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org>
This commit is contained in:
@@ -1456,7 +1456,7 @@ unsigned long wait_task_inactive(struct task_struct *p, long match_state)
|
||||
* yield - it could be a while.
|
||||
*/
|
||||
if (unlikely(queued)) {
|
||||
ktime_t to = ktime_set(0, NSEC_PER_SEC/HZ);
|
||||
ktime_t to = NSEC_PER_SEC / HZ;
|
||||
|
||||
set_current_state(TASK_UNINTERRUPTIBLE);
|
||||
schedule_hrtimeout(&to, HRTIMER_MODE_REL);
|
||||
|
@@ -234,7 +234,7 @@ static int alarmtimer_suspend(struct device *dev)
|
||||
min = freezer_delta;
|
||||
expires = freezer_expires;
|
||||
type = freezer_alarmtype;
|
||||
freezer_delta = ktime_set(0, 0);
|
||||
freezer_delta = 0;
|
||||
spin_unlock_irqrestore(&freezer_delta_lock, flags);
|
||||
|
||||
rtc = alarmtimer_get_rtcdev();
|
||||
@@ -277,7 +277,7 @@ static int alarmtimer_suspend(struct device *dev)
|
||||
now = ktime_add(now, min);
|
||||
|
||||
/* Set alarm, if in the past reject suspend briefly to handle */
|
||||
ret = rtc_timer_start(rtc, &rtctimer, now, ktime_set(0, 0));
|
||||
ret = rtc_timer_start(rtc, &rtctimer, now, 0);
|
||||
if (ret < 0)
|
||||
__pm_wakeup_event(ws, MSEC_PER_SEC);
|
||||
return ret;
|
||||
|
@@ -955,7 +955,7 @@ static inline ktime_t hrtimer_update_lowres(struct hrtimer *timer, ktime_t tim,
|
||||
*/
|
||||
timer->is_rel = mode & HRTIMER_MODE_REL;
|
||||
if (timer->is_rel)
|
||||
tim = ktime_add_safe(tim, ktime_set(0, hrtimer_resolution));
|
||||
tim = ktime_add_safe(tim, hrtimer_resolution);
|
||||
#endif
|
||||
return tim;
|
||||
}
|
||||
|
@@ -485,7 +485,7 @@ static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)
|
||||
*/
|
||||
#ifdef CONFIG_HIGH_RES_TIMERS
|
||||
{
|
||||
ktime_t kj = ktime_set(0, NSEC_PER_SEC / HZ);
|
||||
ktime_t kj = NSEC_PER_SEC / HZ;
|
||||
|
||||
if (timr->it.real.interval < kj)
|
||||
now = ktime_add(now, kj);
|
||||
|
@@ -178,8 +178,8 @@ static void tick_setup_device(struct tick_device *td,
|
||||
struct clock_event_device *newdev, int cpu,
|
||||
const struct cpumask *cpumask)
|
||||
{
|
||||
ktime_t next_event;
|
||||
void (*handler)(struct clock_event_device *) = NULL;
|
||||
ktime_t next_event = 0;
|
||||
|
||||
/*
|
||||
* First device setup ?
|
||||
@@ -195,7 +195,7 @@ static void tick_setup_device(struct tick_device *td,
|
||||
else
|
||||
tick_do_timer_cpu = TICK_DO_TIMER_NONE;
|
||||
tick_next_period = ktime_get();
|
||||
tick_period = ktime_set(0, NSEC_PER_SEC / HZ);
|
||||
tick_period = NSEC_PER_SEC / HZ;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user