aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2008-09-01 18:02:30 -0400
committerArjan van de Ven <arjan@linux.intel.com>2008-09-06 00:35:13 -0400
commitcc584b213f252bf698849cf4be2377cd3ec7501a (patch)
tree621ba11da6a2ab8598f9ed453836cd2c44192260 /kernel/time
parent23dd7bb09bd8d7efd8a602aed97b93d52f85e675 (diff)
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>
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/ntp.c3
-rw-r--r--kernel/time/tick-sched.c21
-rw-r--r--kernel/time/timer_list.c4
3 files changed, 13 insertions, 15 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 5125ddd8196b..4c8d85421d24 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -142,8 +142,7 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer)
142 time_state = TIME_OOP; 142 time_state = TIME_OOP;
143 printk(KERN_NOTICE "Clock: " 143 printk(KERN_NOTICE "Clock: "
144 "inserting leap second 23:59:60 UTC\n"); 144 "inserting leap second 23:59:60 UTC\n");
145 leap_timer.expires = ktime_add_ns(leap_timer.expires, 145 hrtimer_add_expires_ns(&leap_timer, NSEC_PER_SEC);
146 NSEC_PER_SEC);
147 res = HRTIMER_RESTART; 146 res = HRTIMER_RESTART;
148 break; 147 break;
149 case TIME_DEL: 148 case TIME_DEL:
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index a87b0468568b..b33be61c0f6b 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -288,7 +288,7 @@ void tick_nohz_stop_sched_tick(int inidle)
288 goto out; 288 goto out;
289 } 289 }
290 290
291 ts->idle_tick = ts->sched_timer.expires; 291 ts->idle_tick = hrtimer_get_expires(&ts->sched_timer);
292 ts->tick_stopped = 1; 292 ts->tick_stopped = 1;
293 ts->idle_jiffies = last_jiffies; 293 ts->idle_jiffies = last_jiffies;
294 rcu_enter_nohz(); 294 rcu_enter_nohz();
@@ -419,21 +419,21 @@ void tick_nohz_restart_sched_tick(void)
419 ts->tick_stopped = 0; 419 ts->tick_stopped = 0;
420 ts->idle_exittime = now; 420 ts->idle_exittime = now;
421 hrtimer_cancel(&ts->sched_timer); 421 hrtimer_cancel(&ts->sched_timer);
422 ts->sched_timer.expires = ts->idle_tick; 422 hrtimer_set_expires(&ts->sched_timer, ts->idle_tick);
423 423
424 while (1) { 424 while (1) {
425 /* Forward the time to expire in the future */ 425 /* Forward the time to expire in the future */
426 hrtimer_forward(&ts->sched_timer, now, tick_period); 426 hrtimer_forward(&ts->sched_timer, now, tick_period);
427 427
428 if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { 428 if (ts->nohz_mode == NOHZ_MODE_HIGHRES) {
429 hrtimer_start(&ts->sched_timer, 429 hrtimer_start_expires(&ts->sched_timer,
430 ts->sched_timer.expires,
431 HRTIMER_MODE_ABS); 430 HRTIMER_MODE_ABS);
432 /* Check, if the timer was already in the past */ 431 /* Check, if the timer was already in the past */
433 if (hrtimer_active(&ts->sched_timer)) 432 if (hrtimer_active(&ts->sched_timer))
434 break; 433 break;
435 } else { 434 } else {
436 if (!tick_program_event(ts->sched_timer.expires, 0)) 435 if (!tick_program_event(
436 hrtimer_get_expires(&ts->sched_timer), 0))
437 break; 437 break;
438 } 438 }
439 /* Update jiffies and reread time */ 439 /* Update jiffies and reread time */
@@ -446,7 +446,7 @@ void tick_nohz_restart_sched_tick(void)
446static int tick_nohz_reprogram(struct tick_sched *ts, ktime_t now) 446static int tick_nohz_reprogram(struct tick_sched *ts, ktime_t now)
447{ 447{
448 hrtimer_forward(&ts->sched_timer, now, tick_period); 448 hrtimer_forward(&ts->sched_timer, now, tick_period);
449 return tick_program_event(ts->sched_timer.expires, 0); 449 return tick_program_event(hrtimer_get_expires(&ts->sched_timer), 0);
450} 450}
451 451
452/* 452/*
@@ -529,7 +529,7 @@ static void tick_nohz_switch_to_nohz(void)
529 next = tick_init_jiffy_update(); 529 next = tick_init_jiffy_update();
530 530
531 for (;;) { 531 for (;;) {
532 ts->sched_timer.expires = next; 532 hrtimer_set_expires(&ts->sched_timer, next);
533 if (!tick_program_event(next, 0)) 533 if (!tick_program_event(next, 0))
534 break; 534 break;
535 next = ktime_add(next, tick_period); 535 next = ktime_add(next, tick_period);
@@ -625,16 +625,15 @@ void tick_setup_sched_timer(void)
625 ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 625 ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
626 626
627 /* Get the next period (per cpu) */ 627 /* Get the next period (per cpu) */
628 ts->sched_timer.expires = tick_init_jiffy_update(); 628 hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update());
629 offset = ktime_to_ns(tick_period) >> 1; 629 offset = ktime_to_ns(tick_period) >> 1;
630 do_div(offset, num_possible_cpus()); 630 do_div(offset, num_possible_cpus());
631 offset *= smp_processor_id(); 631 offset *= smp_processor_id();
632 ts->sched_timer.expires = ktime_add_ns(ts->sched_timer.expires, offset); 632 hrtimer_add_expires_ns(&ts->sched_timer, offset);
633 633
634 for (;;) { 634 for (;;) {
635 hrtimer_forward(&ts->sched_timer, now, tick_period); 635 hrtimer_forward(&ts->sched_timer, now, tick_period);
636 hrtimer_start(&ts->sched_timer, ts->sched_timer.expires, 636 hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS);
637 HRTIMER_MODE_ABS);
638 /* Check, if the timer was already in the past */ 637 /* Check, if the timer was already in the past */
639 if (hrtimer_active(&ts->sched_timer)) 638 if (hrtimer_active(&ts->sched_timer))
640 break; 639 break;
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index a40e20fd0001..5224a3215fb7 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -66,8 +66,8 @@ print_timer(struct seq_file *m, struct hrtimer *timer, int idx, u64 now)
66#endif 66#endif
67 SEQ_printf(m, "\n"); 67 SEQ_printf(m, "\n");
68 SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n", 68 SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
69 (unsigned long long)ktime_to_ns(timer->expires), 69 (unsigned long long)ktime_to_ns(hrtimer_get_expires(timer)),
70 (long long)(ktime_to_ns(timer->expires) - now)); 70 (long long)(ktime_to_ns(hrtimer_get_expires(timer)) - now));
71} 71}
72 72
73static void 73static void