summaryrefslogtreecommitdiffstats
path: root/include/linux/timer.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
commit78c388aed2b7184182c08428db1de6c872d815f5 (patch)
tree4b2003b1b4ceb241a17faa995da8dd1004bb8e45 /include/linux/timer.h
parenteb7a5bf93aaa4be1d7c6181100ab7639e74d67f7 (diff)
Merge with Linux 2.1.131 and more MIPS goodies.
(Did I mention that CVS is buggy ...)
Diffstat (limited to 'include/linux/timer.h')
-rw-r--r--include/linux/timer.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 64c461b2e..56f39893e 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -71,22 +71,26 @@ extern inline void init_timer(struct timer_list * timer)
timer->prev = NULL;
}
+extern inline int timer_pending(struct timer_list * timer)
+{
+ return timer->prev != NULL;
+}
+
/*
* These inlines deal with timer wrapping correctly. You are
* strongly encouraged to use them
* 1. Because people otherwise forget
* 2. Because if the timer wrap changes in future you wont have to
* alter your driver code.
+ *
+ * Do this with "<0" and ">=0" to only test the sign of the result. A
+ * good compiler would generate better code (and a really good compiler
+ * wouldn't care). Gcc is currently neither.
*/
+#define time_after(a,b) ((long)(b) - (long)(a) < 0)
+#define time_before(a,b) time_after(b,a)
-extern inline int time_before(unsigned long a, unsigned long b)
-{
- return((long)((a) - (b)) < 0L);
-}
-
-extern inline int time_after(unsigned long a, unsigned long b)
-{
- return((long)((a) - (b)) > 0L);
-}
+#define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
+#define time_before_eq(a,b) time_after_eq(b,a)
#endif