jiffies: Fix timeval conversion to jiffies
[pandora-kernel.git] / include / linux / jiffies.h
index 265e2c3..f4e8578 100644 (file)
@@ -106,13 +106,13 @@ static inline u64 get_jiffies_64(void)
 #define time_after(a,b)                \
        (typecheck(unsigned long, a) && \
         typecheck(unsigned long, b) && \
-        ((long)(b) - (long)(a) < 0))
+        ((long)((b) - (a)) < 0))
 #define time_before(a,b)       time_after(b,a)
 
 #define time_after_eq(a,b)     \
        (typecheck(unsigned long, a) && \
         typecheck(unsigned long, b) && \
-        ((long)(a) - (long)(b) >= 0))
+        ((long)((a) - (b)) >= 0))
 #define time_before_eq(a,b)    time_after_eq(b,a)
 
 /*
@@ -135,13 +135,13 @@ static inline u64 get_jiffies_64(void)
 #define time_after64(a,b)      \
        (typecheck(__u64, a) && \
         typecheck(__u64, b) && \
-        ((__s64)(b) - (__s64)(a) < 0))
+        ((__s64)((b) - (a)) < 0))
 #define time_before64(a,b)     time_after64(b,a)
 
 #define time_after_eq64(a,b)   \
        (typecheck(__u64, a) && \
         typecheck(__u64, b) && \
-        ((__s64)(a) - (__s64)(b) >= 0))
+        ((__s64)((a) - (b)) >= 0))
 #define time_before_eq64(a,b)  time_after_eq64(b,a)
 
 /*
@@ -259,23 +259,11 @@ extern unsigned long preset_lpj;
 #define SEC_JIFFIE_SC (32 - SHIFT_HZ)
 #endif
 #define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29)
-#define USEC_JIFFIE_SC (SEC_JIFFIE_SC + 19)
 #define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\
                                 TICK_NSEC -1) / (u64)TICK_NSEC))
 
 #define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\
                                         TICK_NSEC -1) / (u64)TICK_NSEC))
-#define USEC_CONVERSION  \
-                    ((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) +\
-                                        TICK_NSEC -1) / (u64)TICK_NSEC))
-/*
- * USEC_ROUND is used in the timeval to jiffie conversion.  See there
- * for more details.  It is the scaled resolution rounding value.  Note
- * that it is a 64-bit value.  Since, when it is applied, we are already
- * in jiffies (albit scaled), it is nothing but the bits we will shift
- * off.
- */
-#define USEC_ROUND (u64)(((u64)1 << USEC_JIFFIE_SC) - 1)
 /*
  * The maximum jiffie value is (MAX_INT >> 1).  Here we translate that
  * into seconds.  The 64-bit case will overflow if we are not careful,