diff options
author | Magnus Damm <damm@igel.co.jp> | 2009-04-21 15:24:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-21 16:41:47 -0400 |
commit | 8e19608e8b5c001e4a66ce482edc474f05fb7355 (patch) | |
tree | 06af4be339136da7476396604c30112238d84339 /arch/x86 | |
parent | ff14ed5db6e7e5e5dc23712d3c877891d4d9a1a8 (diff) |
clocksource: pass clocksource to read() callback
Pass clocksource pointer to the read() callback for clocksources. This
allows us to share the callback between multiple instances.
[hugh@veritas.com: fix powerpc build of clocksource pass clocksource mods]
[akpm@linux-foundation.org: cleanup]
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Acked-by: John Stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/hpet.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/i8253.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/kvmclock.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/tsc.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/vmiclock_32.c | 2 | ||||
-rw-r--r-- | arch/x86/lguest/boot.c | 2 | ||||
-rw-r--r-- | arch/x86/xen/time.c | 7 |
7 files changed, 19 insertions, 9 deletions
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 648b3a2a3a44..3f0019e0a229 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -722,7 +722,7 @@ static int hpet_cpuhp_notify(struct notifier_block *n, | |||
722 | /* | 722 | /* |
723 | * Clock source related code | 723 | * Clock source related code |
724 | */ | 724 | */ |
725 | static cycle_t read_hpet(void) | 725 | static cycle_t read_hpet(struct clocksource *cs) |
726 | { | 726 | { |
727 | return (cycle_t)hpet_readl(HPET_COUNTER); | 727 | return (cycle_t)hpet_readl(HPET_COUNTER); |
728 | } | 728 | } |
@@ -756,7 +756,7 @@ static int hpet_clocksource_register(void) | |||
756 | hpet_restart_counter(); | 756 | hpet_restart_counter(); |
757 | 757 | ||
758 | /* Verify whether hpet counter works */ | 758 | /* Verify whether hpet counter works */ |
759 | t1 = read_hpet(); | 759 | t1 = hpet_readl(HPET_COUNTER); |
760 | rdtscll(start); | 760 | rdtscll(start); |
761 | 761 | ||
762 | /* | 762 | /* |
@@ -770,7 +770,7 @@ static int hpet_clocksource_register(void) | |||
770 | rdtscll(now); | 770 | rdtscll(now); |
771 | } while ((now - start) < 200000UL); | 771 | } while ((now - start) < 200000UL); |
772 | 772 | ||
773 | if (t1 == read_hpet()) { | 773 | if (t1 == hpet_readl(HPET_COUNTER)) { |
774 | printk(KERN_WARNING | 774 | printk(KERN_WARNING |
775 | "HPET counter not counting. HPET disabled\n"); | 775 | "HPET counter not counting. HPET disabled\n"); |
776 | return -ENODEV; | 776 | return -ENODEV; |
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c index 3475440baa54..c2e0bb0890d4 100644 --- a/arch/x86/kernel/i8253.c +++ b/arch/x86/kernel/i8253.c | |||
@@ -129,7 +129,7 @@ void __init setup_pit_timer(void) | |||
129 | * to just read by itself. So use jiffies to emulate a free | 129 | * to just read by itself. So use jiffies to emulate a free |
130 | * running counter: | 130 | * running counter: |
131 | */ | 131 | */ |
132 | static cycle_t pit_read(void) | 132 | static cycle_t pit_read(struct clocksource *cs) |
133 | { | 133 | { |
134 | static int old_count; | 134 | static int old_count; |
135 | static u32 old_jifs; | 135 | static u32 old_jifs; |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 137f2e8132df..223af43f1526 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -77,6 +77,11 @@ static cycle_t kvm_clock_read(void) | |||
77 | return ret; | 77 | return ret; |
78 | } | 78 | } |
79 | 79 | ||
80 | static cycle_t kvm_clock_get_cycles(struct clocksource *cs) | ||
81 | { | ||
82 | return kvm_clock_read(); | ||
83 | } | ||
84 | |||
80 | /* | 85 | /* |
81 | * If we don't do that, there is the possibility that the guest | 86 | * If we don't do that, there is the possibility that the guest |
82 | * will calibrate under heavy load - thus, getting a lower lpj - | 87 | * will calibrate under heavy load - thus, getting a lower lpj - |
@@ -107,7 +112,7 @@ static void kvm_get_preset_lpj(void) | |||
107 | 112 | ||
108 | static struct clocksource kvm_clock = { | 113 | static struct clocksource kvm_clock = { |
109 | .name = "kvm-clock", | 114 | .name = "kvm-clock", |
110 | .read = kvm_clock_read, | 115 | .read = kvm_clock_get_cycles, |
111 | .rating = 400, | 116 | .rating = 400, |
112 | .mask = CLOCKSOURCE_MASK(64), | 117 | .mask = CLOCKSOURCE_MASK(64), |
113 | .mult = 1 << KVM_SCALE, | 118 | .mult = 1 << KVM_SCALE, |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 7a567ebe6361..d57de05dc430 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -699,7 +699,7 @@ static struct clocksource clocksource_tsc; | |||
699 | * code, which is necessary to support wrapping clocksources like pm | 699 | * code, which is necessary to support wrapping clocksources like pm |
700 | * timer. | 700 | * timer. |
701 | */ | 701 | */ |
702 | static cycle_t read_tsc(void) | 702 | static cycle_t read_tsc(struct clocksource *cs) |
703 | { | 703 | { |
704 | cycle_t ret = (cycle_t)get_cycles(); | 704 | cycle_t ret = (cycle_t)get_cycles(); |
705 | 705 | ||
diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c index d303369a7bad..2b3eb82efeeb 100644 --- a/arch/x86/kernel/vmiclock_32.c +++ b/arch/x86/kernel/vmiclock_32.c | |||
@@ -283,7 +283,7 @@ void __devinit vmi_time_ap_init(void) | |||
283 | /** vmi clocksource */ | 283 | /** vmi clocksource */ |
284 | static struct clocksource clocksource_vmi; | 284 | static struct clocksource clocksource_vmi; |
285 | 285 | ||
286 | static cycle_t read_real_cycles(void) | 286 | static cycle_t read_real_cycles(struct clocksource *cs) |
287 | { | 287 | { |
288 | cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL); | 288 | cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL); |
289 | return max(ret, clocksource_vmi.cycle_last); | 289 | return max(ret, clocksource_vmi.cycle_last); |
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index a2085368a3dc..ca7ec44bafc3 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -663,7 +663,7 @@ static unsigned long lguest_tsc_khz(void) | |||
663 | 663 | ||
664 | /* If we can't use the TSC, the kernel falls back to our lower-priority | 664 | /* If we can't use the TSC, the kernel falls back to our lower-priority |
665 | * "lguest_clock", where we read the time value given to us by the Host. */ | 665 | * "lguest_clock", where we read the time value given to us by the Host. */ |
666 | static cycle_t lguest_clock_read(void) | 666 | static cycle_t lguest_clock_read(struct clocksource *cs) |
667 | { | 667 | { |
668 | unsigned long sec, nsec; | 668 | unsigned long sec, nsec; |
669 | 669 | ||
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 14f240623497..0a5aa44299a5 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c | |||
@@ -213,6 +213,11 @@ cycle_t xen_clocksource_read(void) | |||
213 | return ret; | 213 | return ret; |
214 | } | 214 | } |
215 | 215 | ||
216 | static cycle_t xen_clocksource_get_cycles(struct clocksource *cs) | ||
217 | { | ||
218 | return xen_clocksource_read(); | ||
219 | } | ||
220 | |||
216 | static void xen_read_wallclock(struct timespec *ts) | 221 | static void xen_read_wallclock(struct timespec *ts) |
217 | { | 222 | { |
218 | struct shared_info *s = HYPERVISOR_shared_info; | 223 | struct shared_info *s = HYPERVISOR_shared_info; |
@@ -241,7 +246,7 @@ int xen_set_wallclock(unsigned long now) | |||
241 | static struct clocksource xen_clocksource __read_mostly = { | 246 | static struct clocksource xen_clocksource __read_mostly = { |
242 | .name = "xen", | 247 | .name = "xen", |
243 | .rating = 400, | 248 | .rating = 400, |
244 | .read = xen_clocksource_read, | 249 | .read = xen_clocksource_get_cycles, |
245 | .mask = ~0, | 250 | .mask = ~0, |
246 | .mult = 1<<XEN_SHIFT, /* time directly in nanoseconds */ | 251 | .mult = 1<<XEN_SHIFT, /* time directly in nanoseconds */ |
247 | .shift = XEN_SHIFT, | 252 | .shift = XEN_SHIFT, |