The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH RFC] add time_after_now and other macros which compare with jiffies
@ 2008-03-07  3:09 Dave Young
  2008-03-07  9:02 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Young @ 2008-03-07  3:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

Most of time_after like macros users just compare jiffies and
another number, so here add some other _now macros to do it.

Another aproach is changing original time_ macros to use jiffies to compare,
add a generic compare macro like time_compare(a, b)

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>

---
jiffies.h |    8 ++++++++
1 file changed, 8 insertions(+)

diff -upr linux/include/linux/jiffies.h linux.new/include/linux/jiffies.h
--- linux/include/linux/jiffies.h	2008-03-07 10:40:04.000000000 +0800
+++ linux.new/include/linux/jiffies.h	2008-03-07 10:50:12.000000000 +0800
@@ -134,6 +134,14 @@ static inline u64 get_jiffies_64(void)
 	 ((__s64)(a) - (__s64)(b) >= 0))
 #define time_before_eq64(a,b)	time_after_eq64(b,a)
 
+#define time_after_now(a) time_after(jiffies, a)
+
+#define time_before_now(a) time_before(jiffies, a)
+
+#define time_after_eq_now(a) time_after_eq(jiffies, a)
+
+#define time_before_eq_now(a) time_before_eq(jiffies, a)
+
 /*
  * Have the 32 bit jiffies value wrap 5 minutes after boot
  * so jiffies wrap bugs show up earlier.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-07  9:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-07  3:09 [PATCH RFC] add time_after_now and other macros which compare with jiffies Dave Young
2008-03-07  9:02 ` Andrew Morton
2008-03-07  9:12   ` Dave Young
2008-03-07  9:22     ` Andrew Morton
2008-03-07  9:36       ` Dave Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox