diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-05 15:38:13 -0500 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-05 15:38:13 -0500 |
| commit | 87199134b4a85de56a7508c551ab3b3a3ee35035 (patch) | |
| tree | f7b0d0b4bce377c336a3c8cda0be762d29556cc7 /include/linux/timer.h | |
| parent | ea37ccea66e6bdd9f3571418b6461850088c114e (diff) | |
| parent | 70d9d825e0a5a78ec1dacaaaf5c72ff5b0206fab (diff) | |
Merge branch 'master'
Diffstat (limited to 'include/linux/timer.h')
| -rw-r--r-- | include/linux/timer.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/include/linux/timer.h b/include/linux/timer.h index 3340f3bd135d..72f3a7781106 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
| @@ -12,16 +12,12 @@ struct timer_list { | |||
| 12 | struct list_head entry; | 12 | struct list_head entry; |
| 13 | unsigned long expires; | 13 | unsigned long expires; |
| 14 | 14 | ||
| 15 | unsigned long magic; | ||
| 16 | |||
| 17 | void (*function)(unsigned long); | 15 | void (*function)(unsigned long); |
| 18 | unsigned long data; | 16 | unsigned long data; |
| 19 | 17 | ||
| 20 | struct timer_base_s *base; | 18 | struct timer_base_s *base; |
| 21 | }; | 19 | }; |
| 22 | 20 | ||
| 23 | #define TIMER_MAGIC 0x4b87ad6e | ||
| 24 | |||
| 25 | extern struct timer_base_s __init_timer_base; | 21 | extern struct timer_base_s __init_timer_base; |
| 26 | 22 | ||
| 27 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ | 23 | #define TIMER_INITIALIZER(_function, _expires, _data) { \ |
| @@ -29,7 +25,6 @@ extern struct timer_base_s __init_timer_base; | |||
| 29 | .expires = (_expires), \ | 25 | .expires = (_expires), \ |
| 30 | .data = (_data), \ | 26 | .data = (_data), \ |
| 31 | .base = &__init_timer_base, \ | 27 | .base = &__init_timer_base, \ |
| 32 | .magic = TIMER_MAGIC, \ | ||
| 33 | } | 28 | } |
| 34 | 29 | ||
| 35 | #define DEFINE_TIMER(_name, _function, _expires, _data) \ | 30 | #define DEFINE_TIMER(_name, _function, _expires, _data) \ |
| @@ -38,6 +33,15 @@ extern struct timer_base_s __init_timer_base; | |||
| 38 | 33 | ||
| 39 | void fastcall init_timer(struct timer_list * timer); | 34 | void fastcall init_timer(struct timer_list * timer); |
| 40 | 35 | ||
| 36 | static inline void setup_timer(struct timer_list * timer, | ||
| 37 | void (*function)(unsigned long), | ||
| 38 | unsigned long data) | ||
| 39 | { | ||
| 40 | timer->function = function; | ||
| 41 | timer->data = data; | ||
| 42 | init_timer(timer); | ||
| 43 | } | ||
| 44 | |||
| 41 | /*** | 45 | /*** |
| 42 | * timer_pending - is a timer pending? | 46 | * timer_pending - is a timer pending? |
| 43 | * @timer: the timer in question | 47 | * @timer: the timer in question |
| @@ -74,8 +78,9 @@ extern unsigned long next_timer_interrupt(void); | |||
| 74 | * Timers with an ->expired field in the past will be executed in the next | 78 | * Timers with an ->expired field in the past will be executed in the next |
| 75 | * timer tick. | 79 | * timer tick. |
| 76 | */ | 80 | */ |
| 77 | static inline void add_timer(struct timer_list * timer) | 81 | static inline void add_timer(struct timer_list *timer) |
| 78 | { | 82 | { |
| 83 | BUG_ON(timer_pending(timer)); | ||
| 79 | __mod_timer(timer, timer->expires); | 84 | __mod_timer(timer, timer->expires); |
| 80 | } | 85 | } |
| 81 | 86 | ||
