Merge ../linux-2.6
[powerpc.git] / include / linux / timer.h
index 2e78fed..72f3a77 100644 (file)
@@ -12,16 +12,12 @@ struct timer_list {
        struct list_head entry;
        unsigned long expires;
 
-       unsigned long magic;
-
        void (*function)(unsigned long);
        unsigned long data;
 
        struct timer_base_s *base;
 };
 
-#define TIMER_MAGIC    0x4b87ad6e
-
 extern struct timer_base_s __init_timer_base;
 
 #define TIMER_INITIALIZER(_function, _expires, _data) {                \
@@ -29,11 +25,23 @@ extern struct timer_base_s __init_timer_base;
                .expires = (_expires),                          \
                .data = (_data),                                \
                .base = &__init_timer_base,                     \
-               .magic = TIMER_MAGIC,                           \
        }
 
+#define DEFINE_TIMER(_name, _function, _expires, _data)                \
+       struct timer_list _name =                               \
+               TIMER_INITIALIZER(_function, _expires, _data)
+
 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
@@ -70,15 +78,18 @@ extern unsigned long next_timer_interrupt(void);
  * Timers with an ->expired field in the past will be executed in the next
  * timer tick.
  */
-static inline void add_timer(struct timer_list * timer)
+static inline void add_timer(struct timer_list *timer)
 {
+       BUG_ON(timer_pending(timer));
        __mod_timer(timer, timer->expires);
 }
 
 #ifdef CONFIG_SMP
+  extern int try_to_del_timer_sync(struct timer_list *timer);
   extern int del_timer_sync(struct timer_list *timer);
 #else
-# define del_timer_sync(t) del_timer(t)
+# define try_to_del_timer_sync(t)      del_timer(t)
+# define del_timer_sync(t)             del_timer(t)
 #endif
 
 #define del_singleshot_timer_sync(t) del_timer_sync(t)