]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] introduce setup_timer() helper
authorOleg Nesterov <oleg@tv-sign.ru>
Sun, 30 Oct 2005 23:01:38 +0000 (15:01 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 31 Oct 2005 01:37:17 +0000 (17:37 -0800)
Every user of init_timer() also needs to initialize ->function and ->data
fields.  This patch adds a simple setup_timer() helper for that.

The schedule_timeout() is patched as an example of usage.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/kernel/i8259.c
include/linux/timer.h
kernel/timer.c

index b2a238b5a17ed36cc7a071be01f62231d80cc5c0..c6c9791d77c18aa2ed7025f7b9c7a0b07e18f132 100644 (file)
@@ -494,7 +494,7 @@ void invalidate_interrupt7(void);
 void thermal_interrupt(void);
 void i8254_timer_resume(void);
 
-static void setup_timer(void)
+static void setup_timer_hardware(void)
 {
        outb_p(0x34,0x43);              /* binary, mode 2, LSB/MSB, ch 0 */
        udelay(10);
@@ -505,13 +505,13 @@ static void setup_timer(void)
 
 static int timer_resume(struct sys_device *dev)
 {
-       setup_timer();
+       setup_timer_hardware();
        return 0;
 }
 
 void i8254_timer_resume(void)
 {
-       setup_timer();
+       setup_timer_hardware();
 }
 
 static struct sysdev_class timer_sysclass = {
@@ -594,7 +594,7 @@ void __init init_IRQ(void)
         * Set the clock to HZ Hz, we already have a valid
         * vector now:
         */
-       setup_timer();
+       setup_timer_hardware();
 
        if (!acpi_ioapic)
                setup_irq(2, &irq2);
index 3340f3bd135daa9c4c42741d98df1a6b469e6ba6..ddd5bbe1fc8e935524f2f769c286fa282b5b8b81 100644 (file)
@@ -38,6 +38,15 @@ extern struct timer_base_s __init_timer_base;
 
 void fastcall init_timer(struct timer_list * timer);
 
+static inline void setup_timer(struct timer_list * timer,
+                               void (*function)(unsigned long),
+                               unsigned long data)
+{
+       timer->function = function;
+       timer->data = data;
+       init_timer(timer);
+}
+
 /***
  * timer_pending - is a timer pending?
  * @timer: the timer in question
index 6a2e5f8dc725ffea0b73bb60036838b6ca628c5f..6ed1a826e5ced0f3812bdc5126cd46ada4ef92eb 100644 (file)
@@ -1146,12 +1146,8 @@ fastcall signed long __sched schedule_timeout(signed long timeout)
 
        expire = timeout + jiffies;
 
-       init_timer(&timer);
-       timer.expires = expire;
-       timer.data = (unsigned long) current;
-       timer.function = process_timeout;
-
-       add_timer(&timer);
+       setup_timer(&timer, process_timeout, (unsigned long)current);
+       __mod_timer(&timer, expire);
        schedule();
        del_singleshot_timer_sync(&timer);