linux-mips
[Top] [All Lists]

[PATCH] Make c0_compare_int_usable faster

To: linux-mips@linux-mips.org
Subject: [PATCH] Make c0_compare_int_usable faster
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Tue, 23 Oct 2007 01:14:16 +0900 (JST)
Cc: ralf@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Use delta value based on its speed for faster probing.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index ae2984f..46a896f 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -179,7 +179,7 @@ static int c0_compare_int_pending(void)
 
 static int c0_compare_int_usable(void)
 {
-       const unsigned int delta = 0x300000;
+       unsigned int delta;
        unsigned int cnt;
 
        /*
@@ -192,6 +192,8 @@ static int c0_compare_int_usable(void)
                        return 0;
        }
 
+       delta = read_c0_count();
+       delta = ((read_c0_count() - delta) ?: 1) << 8;
        cnt = read_c0_count();
        cnt += delta;
        write_c0_compare(cnt);

<Prev in Thread] Current Thread [Next in Thread>