]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] cpu_has_tsc
authorBrian Gerst <bgerst@didntduck.org>
Tue, 21 May 2002 08:15:41 +0000 (01:15 -0700)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Tue, 21 May 2002 08:15:41 +0000 (01:15 -0700)
This patch converts drivers/char/random.c and
drivers/input/joystick/analog.c to use the cpu_has_tsc macro.

drivers/char/random.c
drivers/input/joystick/analog.c

index d91445f62fd20a53ce6f7f91731e5c66ad997bb9..7f75146c206294207b2a3d530af397df6a67db0d 100644 (file)
@@ -735,18 +735,14 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
        __s32           delta, delta2, delta3;
        int             entropy = 0;
 
-#if defined (__i386__)
-       if ( test_bit(X86_FEATURE_TSC, boot_cpu_data.x86_capability) ) {
+#if defined (__i386__) || defined (__x86_64__)
+       if (cpu_has_tsc)
                __u32 high;
                rdtsc(time, high);
                num ^= high;
        } else {
                time = jiffies;
        }
-#elif defined (__x86_64__)
-       __u32 high;
-       rdtsc(time, high);
-       num ^= high;
 #else
        time = jiffies;
 #endif
index 4a3dde9f90b26113fc14da7486fbe94b301ea324..ffe496e6cad8a2ce6d613f01239428777c3cb05e 100644 (file)
@@ -137,10 +137,9 @@ struct analog_port {
  */
 
 #ifdef __i386__
-#define TSC_PRESENT    (test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability))
-#define GET_TIME(x)    do { if (TSC_PRESENT) rdtscl(x); else x = get_time_pit(); } while (0)
-#define DELTA(x,y)     (TSC_PRESENT?((y)-(x)):((x)-(y)+((x)<(y)?1193180L/HZ:0)))
-#define TIME_NAME      (TSC_PRESENT?"TSC":"PIT")
+#define GET_TIME(x)    do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)
+#define DELTA(x,y)     (cpu_has_tsc?((y)-(x)):((x)-(y)+((x)<(y)?1193180L/HZ:0)))
+#define TIME_NAME      (cpu_has_tsc?"TSC":"PIT")
 static unsigned int get_time_pit(void)
 {
         extern spinlock_t i8253_lock;