mirror of
https://github.com/joel16/android_kernel_sony_msm8994.git
synced 2024-12-19 18:37:16 +00:00
hrtimer: convert kernel/* to the new hrtimer apis
In order to be able to do range hrtimers we need to use accessor functions to the "expire" member of the hrtimer struct. This patch converts kernel/* to these accessors. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
This commit is contained in:
parent
23dd7bb09b
commit
cc584b213f
@ -1299,10 +1299,9 @@ static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared,
|
||||
hrtimer_init_on_stack(&t.timer, CLOCK_MONOTONIC,
|
||||
HRTIMER_MODE_ABS);
|
||||
hrtimer_init_sleeper(&t, current);
|
||||
t.timer.expires = *abs_time;
|
||||
hrtimer_set_expires(&t.timer, *abs_time);
|
||||
|
||||
hrtimer_start(&t.timer, t.timer.expires,
|
||||
HRTIMER_MODE_ABS);
|
||||
hrtimer_start_expires(&t.timer, HRTIMER_MODE_ABS);
|
||||
if (!hrtimer_active(&t.timer))
|
||||
t.task = NULL;
|
||||
|
||||
@ -1404,7 +1403,7 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
|
||||
hrtimer_init_on_stack(&to->timer, CLOCK_REALTIME,
|
||||
HRTIMER_MODE_ABS);
|
||||
hrtimer_init_sleeper(to, current);
|
||||
to->timer.expires = *time;
|
||||
hrtimer_set_expires(&to->timer, *time);
|
||||
}
|
||||
|
||||
q.pi_state = NULL;
|
||||
|
@ -517,7 +517,7 @@ static void hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base)
|
||||
if (!base->first)
|
||||
continue;
|
||||
timer = rb_entry(base->first, struct hrtimer, node);
|
||||
expires = ktime_sub(timer->expires, base->offset);
|
||||
expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
|
||||
if (expires.tv64 < cpu_base->expires_next.tv64)
|
||||
cpu_base->expires_next = expires;
|
||||
}
|
||||
@ -539,10 +539,10 @@ static int hrtimer_reprogram(struct hrtimer *timer,
|
||||
struct hrtimer_clock_base *base)
|
||||
{
|
||||
ktime_t *expires_next = &__get_cpu_var(hrtimer_bases).expires_next;
|
||||
ktime_t expires = ktime_sub(timer->expires, base->offset);
|
||||
ktime_t expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
|
||||
int res;
|
||||
|
||||
WARN_ON_ONCE(timer->expires.tv64 < 0);
|
||||
WARN_ON_ONCE(hrtimer_get_expires_tv64(timer) < 0);
|
||||
|
||||
/*
|
||||
* When the callback is running, we do not reprogram the clock event
|
||||
@ -794,7 +794,7 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
|
||||
u64 orun = 1;
|
||||
ktime_t delta;
|
||||
|
||||
delta = ktime_sub(now, timer->expires);
|
||||
delta = ktime_sub(now, hrtimer_get_expires(timer));
|
||||
|
||||
if (delta.tv64 < 0)
|
||||
return 0;
|
||||
@ -806,8 +806,8 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
|
||||
s64 incr = ktime_to_ns(interval);
|
||||
|
||||
orun = ktime_divns(delta, incr);
|
||||
timer->expires = ktime_add_ns(timer->expires, incr * orun);
|
||||
if (timer->expires.tv64 > now.tv64)
|
||||
hrtimer_add_expires_ns(timer, incr * orun);
|
||||
if (hrtimer_get_expires_tv64(timer) > now.tv64)
|
||||
return orun;
|
||||
/*
|
||||
* This (and the ktime_add() below) is the
|
||||
@ -815,7 +815,7 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
|
||||
*/
|
||||
orun++;
|
||||
}
|
||||
timer->expires = ktime_add_safe(timer->expires, interval);
|
||||
hrtimer_add_expires(timer, interval);
|
||||
|
||||
return orun;
|
||||
}
|
||||
@ -847,7 +847,8 @@ static void enqueue_hrtimer(struct hrtimer *timer,
|
||||
* We dont care about collisions. Nodes with
|
||||
* the same expiry time stay together.
|
||||
*/
|
||||
if (timer->expires.tv64 < entry->expires.tv64) {
|
||||
if (hrtimer_get_expires_tv64(timer) <
|
||||
hrtimer_get_expires_tv64(entry)) {
|
||||
link = &(*link)->rb_left;
|
||||
} else {
|
||||
link = &(*link)->rb_right;
|
||||
@ -982,7 +983,7 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
|
||||
#endif
|
||||
}
|
||||
|
||||
timer->expires = tim;
|
||||
hrtimer_set_expires(timer, tim);
|
||||
|
||||
timer_stats_hrtimer_set_start_info(timer);
|
||||
|
||||
@ -1076,7 +1077,7 @@ ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
|
||||
ktime_t rem;
|
||||
|
||||
base = lock_hrtimer_base(timer, &flags);
|
||||
rem = ktime_sub(timer->expires, base->get_time());
|
||||
rem = hrtimer_expires_remaining(timer);
|
||||
unlock_hrtimer_base(timer, &flags);
|
||||
|
||||
return rem;
|
||||
@ -1108,7 +1109,7 @@ ktime_t hrtimer_get_next_event(void)
|
||||
continue;
|
||||
|
||||
timer = rb_entry(base->first, struct hrtimer, node);
|
||||
delta.tv64 = timer->expires.tv64;
|
||||
delta.tv64 = hrtimer_get_expires_tv64(timer);
|
||||
delta = ktime_sub(delta, base->get_time());
|
||||
if (delta.tv64 < mindelta.tv64)
|
||||
mindelta.tv64 = delta.tv64;
|
||||
@ -1308,10 +1309,10 @@ void hrtimer_interrupt(struct clock_event_device *dev)
|
||||
|
||||
timer = rb_entry(node, struct hrtimer, node);
|
||||
|
||||
if (basenow.tv64 < timer->expires.tv64) {
|
||||
if (basenow.tv64 < hrtimer_get_expires_tv64(timer)) {
|
||||
ktime_t expires;
|
||||
|
||||
expires = ktime_sub(timer->expires,
|
||||
expires = ktime_sub(hrtimer_get_expires(timer),
|
||||
base->offset);
|
||||
if (expires.tv64 < expires_next.tv64)
|
||||
expires_next = expires;
|
||||
@ -1414,7 +1415,8 @@ void hrtimer_run_queues(void)
|
||||
struct hrtimer *timer;
|
||||
|
||||
timer = rb_entry(node, struct hrtimer, node);
|
||||
if (base->softirq_time.tv64 <= timer->expires.tv64)
|
||||
if (base->softirq_time.tv64 <=
|
||||
hrtimer_get_expires_tv64(timer))
|
||||
break;
|
||||
|
||||
if (timer->cb_mode == HRTIMER_CB_SOFTIRQ) {
|
||||
@ -1462,7 +1464,7 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod
|
||||
|
||||
do {
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
hrtimer_start(&t->timer, t->timer.expires, mode);
|
||||
hrtimer_start_expires(&t->timer, mode);
|
||||
if (!hrtimer_active(&t->timer))
|
||||
t->task = NULL;
|
||||
|
||||
@ -1484,7 +1486,7 @@ static int update_rmtp(struct hrtimer *timer, struct timespec __user *rmtp)
|
||||
struct timespec rmt;
|
||||
ktime_t rem;
|
||||
|
||||
rem = ktime_sub(timer->expires, timer->base->get_time());
|
||||
rem = hrtimer_expires_remaining(timer);
|
||||
if (rem.tv64 <= 0)
|
||||
return 0;
|
||||
rmt = ktime_to_timespec(rem);
|
||||
@ -1503,7 +1505,7 @@ long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
|
||||
|
||||
hrtimer_init_on_stack(&t.timer, restart->nanosleep.index,
|
||||
HRTIMER_MODE_ABS);
|
||||
t.timer.expires.tv64 = restart->nanosleep.expires;
|
||||
hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires);
|
||||
|
||||
if (do_nanosleep(&t, HRTIMER_MODE_ABS))
|
||||
goto out;
|
||||
@ -1530,7 +1532,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
|
||||
int ret = 0;
|
||||
|
||||
hrtimer_init_on_stack(&t.timer, clockid, mode);
|
||||
t.timer.expires = timespec_to_ktime(*rqtp);
|
||||
hrtimer_set_expires(&t.timer, timespec_to_ktime(*rqtp));
|
||||
if (do_nanosleep(&t, mode))
|
||||
goto out;
|
||||
|
||||
@ -1550,7 +1552,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
|
||||
restart->fn = hrtimer_nanosleep_restart;
|
||||
restart->nanosleep.index = t.timer.base->index;
|
||||
restart->nanosleep.rmtp = rmtp;
|
||||
restart->nanosleep.expires = t.timer.expires.tv64;
|
||||
restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer);
|
||||
|
||||
ret = -ERESTART_RESTARTBLOCK;
|
||||
out:
|
||||
@ -1724,11 +1726,11 @@ int __sched schedule_hrtimeout(ktime_t *expires,
|
||||
}
|
||||
|
||||
hrtimer_init_on_stack(&t.timer, CLOCK_MONOTONIC, mode);
|
||||
t.timer.expires = *expires;
|
||||
hrtimer_set_expires(&t.timer, *expires);
|
||||
|
||||
hrtimer_init_sleeper(&t, current);
|
||||
|
||||
hrtimer_start(&t.timer, t.timer.expires, mode);
|
||||
hrtimer_start_expires(&t.timer, mode);
|
||||
if (!hrtimer_active(&t.timer))
|
||||
t.task = NULL;
|
||||
|
||||
|
@ -668,7 +668,7 @@ common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
|
||||
(timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE))
|
||||
timr->it_overrun += (unsigned int) hrtimer_forward(timer, now, iv);
|
||||
|
||||
remaining = ktime_sub(timer->expires, now);
|
||||
remaining = ktime_sub(hrtimer_get_expires(timer), now);
|
||||
/* Return 0 only, when the timer is expired and not pending */
|
||||
if (remaining.tv64 <= 0) {
|
||||
/*
|
||||
@ -762,7 +762,7 @@ common_timer_set(struct k_itimer *timr, int flags,
|
||||
hrtimer_init(&timr->it.real.timer, timr->it_clock, mode);
|
||||
timr->it.real.timer.function = posix_timer_fn;
|
||||
|
||||
timer->expires = timespec_to_ktime(new_setting->it_value);
|
||||
hrtimer_set_expires(timer, timespec_to_ktime(new_setting->it_value));
|
||||
|
||||
/* Convert interval */
|
||||
timr->it.real.interval = timespec_to_ktime(new_setting->it_interval);
|
||||
@ -771,14 +771,12 @@ common_timer_set(struct k_itimer *timr, int flags,
|
||||
if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) {
|
||||
/* Setup correct expiry time for relative timers */
|
||||
if (mode == HRTIMER_MODE_REL) {
|
||||
timer->expires =
|
||||
ktime_add_safe(timer->expires,
|
||||
timer->base->get_time());
|
||||
hrtimer_add_expires(timer, timer->base->get_time());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
hrtimer_start(timer, timer->expires, mode);
|
||||
hrtimer_start_expires(timer, mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -631,8 +631,7 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state,
|
||||
|
||||
/* Setup the timer, when timeout != NULL */
|
||||
if (unlikely(timeout)) {
|
||||
hrtimer_start(&timeout->timer, timeout->timer.expires,
|
||||
HRTIMER_MODE_ABS);
|
||||
hrtimer_start_expires(&timeout->timer, HRTIMER_MODE_ABS);
|
||||
if (!hrtimer_active(&timeout->timer))
|
||||
timeout->task = NULL;
|
||||
}
|
||||
|
@ -221,9 +221,8 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
|
||||
|
||||
now = hrtimer_cb_get_time(&rt_b->rt_period_timer);
|
||||
hrtimer_forward(&rt_b->rt_period_timer, now, rt_b->rt_period);
|
||||
hrtimer_start(&rt_b->rt_period_timer,
|
||||
rt_b->rt_period_timer.expires,
|
||||
HRTIMER_MODE_ABS);
|
||||
hrtimer_start_expires(&rt_b->rt_period_timer,
|
||||
HRTIMER_MODE_ABS);
|
||||
}
|
||||
spin_unlock(&rt_b->rt_runtime_lock);
|
||||
}
|
||||
@ -1058,7 +1057,7 @@ static void hrtick_start(struct rq *rq, u64 delay)
|
||||
struct hrtimer *timer = &rq->hrtick_timer;
|
||||
ktime_t time = ktime_add_ns(timer->base->get_time(), delay);
|
||||
|
||||
timer->expires = time;
|
||||
hrtimer_set_expires(timer, time);
|
||||
|
||||
if (rq == this_rq()) {
|
||||
hrtimer_restart(timer);
|
||||
|
@ -142,8 +142,7 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer)
|
||||
time_state = TIME_OOP;
|
||||
printk(KERN_NOTICE "Clock: "
|
||||
"inserting leap second 23:59:60 UTC\n");
|
||||
leap_timer.expires = ktime_add_ns(leap_timer.expires,
|
||||
NSEC_PER_SEC);
|
||||
hrtimer_add_expires_ns(&leap_timer, NSEC_PER_SEC);
|
||||
res = HRTIMER_RESTART;
|
||||
break;
|
||||
case TIME_DEL:
|
||||
|
@ -288,7 +288,7 @@ void tick_nohz_stop_sched_tick(int inidle)
|
||||
goto out;
|
||||
}
|
||||
|
||||
ts->idle_tick = ts->sched_timer.expires;
|
||||
ts->idle_tick = hrtimer_get_expires(&ts->sched_timer);
|
||||
ts->tick_stopped = 1;
|
||||
ts->idle_jiffies = last_jiffies;
|
||||
rcu_enter_nohz();
|
||||
@ -419,21 +419,21 @@ void tick_nohz_restart_sched_tick(void)
|
||||
ts->tick_stopped = 0;
|
||||
ts->idle_exittime = now;
|
||||
hrtimer_cancel(&ts->sched_timer);
|
||||
ts->sched_timer.expires = ts->idle_tick;
|
||||
hrtimer_set_expires(&ts->sched_timer, ts->idle_tick);
|
||||
|
||||
while (1) {
|
||||
/* Forward the time to expire in the future */
|
||||
hrtimer_forward(&ts->sched_timer, now, tick_period);
|
||||
|
||||
if (ts->nohz_mode == NOHZ_MODE_HIGHRES) {
|
||||
hrtimer_start(&ts->sched_timer,
|
||||
ts->sched_timer.expires,
|
||||
hrtimer_start_expires(&ts->sched_timer,
|
||||
HRTIMER_MODE_ABS);
|
||||
/* Check, if the timer was already in the past */
|
||||
if (hrtimer_active(&ts->sched_timer))
|
||||
break;
|
||||
} else {
|
||||
if (!tick_program_event(ts->sched_timer.expires, 0))
|
||||
if (!tick_program_event(
|
||||
hrtimer_get_expires(&ts->sched_timer), 0))
|
||||
break;
|
||||
}
|
||||
/* Update jiffies and reread time */
|
||||
@ -446,7 +446,7 @@ void tick_nohz_restart_sched_tick(void)
|
||||
static int tick_nohz_reprogram(struct tick_sched *ts, ktime_t now)
|
||||
{
|
||||
hrtimer_forward(&ts->sched_timer, now, tick_period);
|
||||
return tick_program_event(ts->sched_timer.expires, 0);
|
||||
return tick_program_event(hrtimer_get_expires(&ts->sched_timer), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -529,7 +529,7 @@ static void tick_nohz_switch_to_nohz(void)
|
||||
next = tick_init_jiffy_update();
|
||||
|
||||
for (;;) {
|
||||
ts->sched_timer.expires = next;
|
||||
hrtimer_set_expires(&ts->sched_timer, next);
|
||||
if (!tick_program_event(next, 0))
|
||||
break;
|
||||
next = ktime_add(next, tick_period);
|
||||
@ -625,16 +625,15 @@ void tick_setup_sched_timer(void)
|
||||
ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
|
||||
|
||||
/* Get the next period (per cpu) */
|
||||
ts->sched_timer.expires = tick_init_jiffy_update();
|
||||
hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update());
|
||||
offset = ktime_to_ns(tick_period) >> 1;
|
||||
do_div(offset, num_possible_cpus());
|
||||
offset *= smp_processor_id();
|
||||
ts->sched_timer.expires = ktime_add_ns(ts->sched_timer.expires, offset);
|
||||
hrtimer_add_expires_ns(&ts->sched_timer, offset);
|
||||
|
||||
for (;;) {
|
||||
hrtimer_forward(&ts->sched_timer, now, tick_period);
|
||||
hrtimer_start(&ts->sched_timer, ts->sched_timer.expires,
|
||||
HRTIMER_MODE_ABS);
|
||||
hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS);
|
||||
/* Check, if the timer was already in the past */
|
||||
if (hrtimer_active(&ts->sched_timer))
|
||||
break;
|
||||
|
@ -66,8 +66,8 @@ print_timer(struct seq_file *m, struct hrtimer *timer, int idx, u64 now)
|
||||
#endif
|
||||
SEQ_printf(m, "\n");
|
||||
SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
|
||||
(unsigned long long)ktime_to_ns(timer->expires),
|
||||
(long long)(ktime_to_ns(timer->expires) - now));
|
||||
(unsigned long long)ktime_to_ns(hrtimer_get_expires(timer)),
|
||||
(long long)(ktime_to_ns(hrtimer_get_expires(timer)) - now));
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user