* [TRIVIAL][PATCH] cpu_has_tsc cleanup
@ 2002-08-08 0:03 john stultz
2002-08-08 19:56 ` george anzinger
0 siblings, 1 reply; 2+ messages in thread
From: john stultz @ 2002-08-08 0:03 UTC (permalink / raw)
To: marcelo; +Cc: lkml
[-- Attachment #1: Type: text/plain, Size: 213 bytes --]
Marcelo,
Here is a trivial cleanup patch that replaces:
test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability)
w/ the cpu_has_tsc macro.
I believe this was originally by Brian Gerst for 2.5
thanks
-john
[-- Attachment #2: linux-2.4.20-pre1_tsc-cleanup_A0.patch --]
[-- Type: text/x-patch, Size: 1303 bytes --]
diff -Nru a/drivers/char/joystick/analog.c b/drivers/char/joystick/analog.c
--- a/drivers/char/joystick/analog.c Wed Aug 7 16:35:44 2002
+++ b/drivers/char/joystick/analog.c Wed Aug 7 16:35:44 2002
@@ -137,10 +137,9 @@
*/
#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 { outb(0, 0x43); x = inb(0x40); x |= inb(0x40) << 8; } } 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 { outb(0, 0x43); x = inb(0x40); x |= inb(0x40) << 8; } } 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")
#elif __x86_64__
#define GET_TIME(x) rdtscl(x)
#define DELTA(x,y) ((y)-(x))
diff -Nru a/drivers/char/random.c b/drivers/char/random.c
--- a/drivers/char/random.c Wed Aug 7 16:35:44 2002
+++ b/drivers/char/random.c Wed Aug 7 16:35:44 2002
@@ -735,7 +735,7 @@
int entropy = 0;
#if defined (__i386__)
- if ( test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability) ) {
+ if (cpu_has_tsc) {
__u32 high;
rdtsc(time, high);
num ^= high;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [TRIVIAL][PATCH] cpu_has_tsc cleanup
2002-08-08 0:03 [TRIVIAL][PATCH] cpu_has_tsc cleanup john stultz
@ 2002-08-08 19:56 ` george anzinger
0 siblings, 0 replies; 2+ messages in thread
From: george anzinger @ 2002-08-08 19:56 UTC (permalink / raw)
To: john stultz; +Cc: marcelo, lkml
john stultz wrote:
>
> Marcelo,
>
> Here is a trivial cleanup patch that replaces:
> test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability)
> w/ the cpu_has_tsc macro.
>
> I believe this was originally by Brian Gerst for 2.5
>
This patch has a problem in the TSC not defined case in that
it access the PIT with out taking the required
locks. spin_lock_irq(&i8253_lock) is used to protect
the PIT...
--
George Anzinger george@mvista.com
High-res-timers:
http://sourceforge.net/projects/high-res-timers/
Preemption patch:
http://www.kernel.org/pub/linux/kernel/people/rml
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-08-08 19:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-08 0:03 [TRIVIAL][PATCH] cpu_has_tsc cleanup john stultz
2002-08-08 19:56 ` george anzinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox