ARM: make sched_clock just call a function pointer
authorRob Herring <rob.herring@calxeda.com>
Mon, 1 Apr 2013 18:53:38 +0000 (13:53 -0500)
committerRob Herring <rob.herring@calxeda.com>
Wed, 10 Apr 2013 23:27:12 +0000 (18:27 -0500)
This converts sched_clock to simply a call to a function pointer in order
to allow overriding it. This will allow for use with 64-bit counters where
overflow handling is not needed.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
arch/arm/include/asm/sched_clock.h
arch/arm/kernel/sched_clock.c

index e3f7572634381bd28fbf3225eb375788431ee3fc..3d520ddca61bba9f58cd53f914af87fe86b30e83 100644 (file)
@@ -11,4 +11,6 @@
 extern void sched_clock_postinit(void);
 extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
 
+extern unsigned long long (*sched_clock_func)(void);
+
 #endif
index 040168e8a60dd38017b9952d013d372aebdc50bf..880584852fca660d9726101e28270004f4f74675 100644 (file)
@@ -165,12 +165,19 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
        pr_debug("Registered %pF as sched_clock source\n", read);
 }
 
-unsigned long long notrace sched_clock(void)
+static unsigned long long notrace sched_clock_32(void)
 {
        u32 cyc = read_sched_clock();
        return cyc_to_sched_clock(cyc, sched_clock_mask);
 }
 
+unsigned long long __read_mostly (*sched_clock_func)(void) = sched_clock_32;
+
+unsigned long long notrace sched_clock(void)
+{
+       return sched_clock_func();
+}
+
 void __init sched_clock_postinit(void)
 {
        /*