Commit 7a1fc3a6 authored by Brian Gerst's avatar Brian Gerst Committed by Linus Torvalds

[PATCH] cpu_has_tsc

This patch converts drivers/char/random.c and
drivers/input/joystick/analog.c to use the cpu_has_tsc macro.
parent 9a3f1f54
......@@ -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
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment