Skip to content

Commit

Permalink
jiffies: add time_is_after_jiffies and others which compare with jiffies
Browse files Browse the repository at this point in the history
Most of time_after like macros usages just compare jiffies and another number,
so here add some time_is_* macros for convenience.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Dave Young authored and Thomas Gleixner committed Apr 21, 2008
1 parent 3925e6f commit 3f34d02
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/linux/jiffies.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,22 @@ static inline u64 get_jiffies_64(void)
((__s64)(a) - (__s64)(b) >= 0))
#define time_before_eq64(a,b) time_after_eq64(b,a)

/*
* These four macros compare jiffies and 'a' for convenience.
*/

/* time_is_before_jiffies(a) return true if a is before jiffies */
#define time_is_before_jiffies(a) time_after(jiffies, a)

/* time_is_after_jiffies(a) return true if a is after jiffies */
#define time_is_after_jiffies(a) time_before(jiffies, a)

/* time_is_before_eq_jiffies(a) return true if a is before or equal to jiffies*/
#define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a)

/* time_is_after_eq_jiffies(a) return true if a is after or equal to jiffies*/
#define time_is_after_eq_jiffies(a) time_before_eq(jiffies, a)

/*
* Have the 32 bit jiffies value wrap 5 minutes after boot
* so jiffies wrap bugs show up earlier.
Expand Down

0 comments on commit 3f34d02

Please sign in to comment.