aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/hrtimer.c
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2006-03-26 04:38:12 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:57:03 -0500
commit05cfb614ddbf3181540ce09d44d96486f8ba8d6a (patch)
treeaafed98638557a4643141d906fbb2406f0764a94 /kernel/hrtimer.c
parentdf869b630d9d9131c10cf073fb61646048874b2f (diff)
[PATCH] hrtimers: remove data field
The nanosleep cleanup allows to remove the data field of hrtimer. The callback function can use container_of() to get it's own data. Since the hrtimer structure is anyway embedded in other structures, this adds no overhead. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r--kernel/hrtimer.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 44108de4f028..0237a556eb1f 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -613,21 +613,19 @@ static inline void run_hrtimer_queue(struct hrtimer_base *base)
613 613
614 while ((node = base->first)) { 614 while ((node = base->first)) {
615 struct hrtimer *timer; 615 struct hrtimer *timer;
616 int (*fn)(void *); 616 int (*fn)(struct hrtimer *);
617 int restart; 617 int restart;
618 void *data;
619 618
620 timer = rb_entry(node, struct hrtimer, node); 619 timer = rb_entry(node, struct hrtimer, node);
621 if (base->softirq_time.tv64 <= timer->expires.tv64) 620 if (base->softirq_time.tv64 <= timer->expires.tv64)
622 break; 621 break;
623 622
624 fn = timer->function; 623 fn = timer->function;
625 data = timer->data;
626 set_curr_timer(base, timer); 624 set_curr_timer(base, timer);
627 __remove_hrtimer(timer, base); 625 __remove_hrtimer(timer, base);
628 spin_unlock_irq(&base->lock); 626 spin_unlock_irq(&base->lock);
629 627
630 restart = fn(data); 628 restart = fn(timer);
631 629
632 spin_lock_irq(&base->lock); 630 spin_lock_irq(&base->lock);
633 631
@@ -664,9 +662,10 @@ struct sleep_hrtimer {
664 int expired; 662 int expired;
665}; 663};
666 664
667static int nanosleep_wakeup(void *data) 665static int nanosleep_wakeup(struct hrtimer *timer)
668{ 666{
669 struct sleep_hrtimer *t = data; 667 struct sleep_hrtimer *t =
668 container_of(timer, struct sleep_hrtimer, timer);
670 669
671 t->expired = 1; 670 t->expired = 1;
672 wake_up_process(t->task); 671 wake_up_process(t->task);
@@ -677,7 +676,6 @@ static int nanosleep_wakeup(void *data)
677static int __sched do_nanosleep(struct sleep_hrtimer *t, enum hrtimer_mode mode) 676static int __sched do_nanosleep(struct sleep_hrtimer *t, enum hrtimer_mode mode)
678{ 677{
679 t->timer.function = nanosleep_wakeup; 678 t->timer.function = nanosleep_wakeup;
680 t->timer.data = t;
681 t->task = current; 679 t->task = current;
682 t->expired = 0; 680 t->expired = 0;
683 681