aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-04-21 15:24:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-21 16:41:47 -0400
commit8e19608e8b5c001e4a66ce482edc474f05fb7355 (patch)
tree06af4be339136da7476396604c30112238d84339 /arch
parentff14ed5db6e7e5e5dc23712d3c877891d4d9a1a8 (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')
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c2
-rw-r--r--arch/arm/mach-at91/at91sam926x_time.c2
-rw-r--r--arch/arm/mach-davinci/time.c2
-rw-r--r--arch/arm/mach-imx/time.c2
-rw-r--r--arch/arm/mach-ixp4xx/common.c2
-rw-r--r--arch/arm/mach-msm/timer.c4
-rw-r--r--arch/arm/mach-netx/time.c2
-rw-r--r--arch/arm/mach-ns9xxx/time-ns9360.c2
-rw-r--r--arch/arm/mach-omap1/time.c2
-rw-r--r--arch/arm/mach-omap2/timer-gp.c2
-rw-r--r--arch/arm/mach-pxa/time.c2
-rw-r--r--arch/arm/mach-realview/core.c2
-rw-r--r--arch/arm/mach-versatile/core.c2
-rw-r--r--arch/arm/plat-mxc/time.c2
-rw-r--r--arch/arm/plat-omap/common.c4
-rw-r--r--arch/arm/plat-orion/time.c2
-rw-r--r--arch/avr32/kernel/time.c2
-rw-r--r--arch/blackfin/kernel/time-ts.c12
-rw-r--r--arch/ia64/kernel/cyclone.c2
-rw-r--r--arch/ia64/kernel/time.c4
-rw-r--r--arch/ia64/sn/kernel/sn2/timer.c2
-rw-r--r--arch/m68knommu/platform/68328/timers.c2
-rw-r--r--arch/m68knommu/platform/coldfire/dma_timer.c2
-rw-r--r--arch/m68knommu/platform/coldfire/pit.c2
-rw-r--r--arch/m68knommu/platform/coldfire/timers.c2
-rw-r--r--arch/mips/kernel/cevt-txx9.c2
-rw-r--r--arch/mips/kernel/csrc-bcm1480.c2
-rw-r--r--arch/mips/kernel/csrc-ioasic.c6
-rw-r--r--arch/mips/kernel/csrc-r4k.c2
-rw-r--r--arch/mips/kernel/csrc-sb1250.c2
-rw-r--r--arch/mips/kernel/i8253.c2
-rw-r--r--arch/mips/nxp/pnx8550/common/time.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c2
-rw-r--r--arch/powerpc/kernel/time.c8
-rw-r--r--arch/s390/kernel/time.c2
-rw-r--r--arch/sh/kernel/time_32.c2
-rw-r--r--arch/sh/kernel/timers/timer-tmu.c2
-rw-r--r--arch/sparc/kernel/time_64.c7
-rw-r--r--arch/um/kernel/time.c2
-rw-r--r--arch/x86/kernel/hpet.c6
-rw-r--r--arch/x86/kernel/i8253.c2
-rw-r--r--arch/x86/kernel/kvmclock.c7
-rw-r--r--arch/x86/kernel/tsc.c2
-rw-r--r--arch/x86/kernel/vmiclock_32.c2
-rw-r--r--arch/x86/lguest/boot.c2
-rw-r--r--arch/x86/xen/time.c7
46 files changed, 76 insertions, 61 deletions
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index 1ff1bda0a894..309f3511aa20 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -85,7 +85,7 @@ static struct irqaction at91rm9200_timer_irq = {
85 .handler = at91rm9200_timer_interrupt 85 .handler = at91rm9200_timer_interrupt
86}; 86};
87 87
88static cycle_t read_clk32k(void) 88static cycle_t read_clk32k(struct clocksource *cs)
89{ 89{
90 return read_CRTR(); 90 return read_CRTR();
91} 91}
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index b63e1d5f1bad..4bd56aee4370 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -31,7 +31,7 @@ static u32 pit_cnt; /* access only w/system irq blocked */
31 * Clocksource: just a monotonic counter of MCK/16 cycles. 31 * Clocksource: just a monotonic counter of MCK/16 cycles.
32 * We don't care whether or not PIT irqs are enabled. 32 * We don't care whether or not PIT irqs are enabled.
33 */ 33 */
34static cycle_t read_pit_clk(void) 34static cycle_t read_pit_clk(struct clocksource *cs)
35{ 35{
36 unsigned long flags; 36 unsigned long flags;
37 u32 elapsed; 37 u32 elapsed;
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index f8bcd29d17a6..6c227d4ba998 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -238,7 +238,7 @@ static void __init timer_init(void)
238/* 238/*
239 * clocksource 239 * clocksource
240 */ 240 */
241static cycle_t read_cycles(void) 241static cycle_t read_cycles(struct clocksource *cs)
242{ 242{
243 struct timer_s *t = &timers[TID_CLOCKSOURCE]; 243 struct timer_s *t = &timers[TID_CLOCKSOURCE];
244 244
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index aff0ebcfa847..5aef18b599e5 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -73,7 +73,7 @@ static void __init imx_timer_hardware_init(void)
73 IMX_TCTL(TIMER_BASE) = TCTL_FRR | TCTL_CLK_PCLK1 | TCTL_TEN; 73 IMX_TCTL(TIMER_BASE) = TCTL_FRR | TCTL_CLK_PCLK1 | TCTL_TEN;
74} 74}
75 75
76cycle_t imx_get_cycles(void) 76cycle_t imx_get_cycles(struct clocksource *cs)
77{ 77{
78 return IMX_TCN(TIMER_BASE); 78 return IMX_TCN(TIMER_BASE);
79} 79}
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index f4656d2ac8a8..1e93dfee7543 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -401,7 +401,7 @@ void __init ixp4xx_sys_init(void)
401/* 401/*
402 * clocksource 402 * clocksource
403 */ 403 */
404cycle_t ixp4xx_get_cycles(void) 404cycle_t ixp4xx_get_cycles(struct clocksource *cs)
405{ 405{
406 return *IXP4XX_OSTS; 406 return *IXP4XX_OSTS;
407} 407}
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 444d9c0f5ca6..4855b8ca5101 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -57,12 +57,12 @@ static irqreturn_t msm_timer_interrupt(int irq, void *dev_id)
57 return IRQ_HANDLED; 57 return IRQ_HANDLED;
58} 58}
59 59
60static cycle_t msm_gpt_read(void) 60static cycle_t msm_gpt_read(struct clocksource *cs)
61{ 61{
62 return readl(MSM_GPT_BASE + TIMER_COUNT_VAL); 62 return readl(MSM_GPT_BASE + TIMER_COUNT_VAL);
63} 63}
64 64
65static cycle_t msm_dgt_read(void) 65static cycle_t msm_dgt_read(struct clocksource *cs)
66{ 66{
67 return readl(MSM_DGT_BASE + TIMER_COUNT_VAL) >> MSM_DGT_SHIFT; 67 return readl(MSM_DGT_BASE + TIMER_COUNT_VAL) >> MSM_DGT_SHIFT;
68} 68}
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
index f201fddb594f..82801dbf0579 100644
--- a/arch/arm/mach-netx/time.c
+++ b/arch/arm/mach-netx/time.c
@@ -104,7 +104,7 @@ static struct irqaction netx_timer_irq = {
104 .handler = netx_timer_interrupt, 104 .handler = netx_timer_interrupt,
105}; 105};
106 106
107cycle_t netx_get_cycles(void) 107cycle_t netx_get_cycles(struct clocksource *cs)
108{ 108{
109 return readl(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE)); 109 return readl(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE));
110} 110}
diff --git a/arch/arm/mach-ns9xxx/time-ns9360.c b/arch/arm/mach-ns9xxx/time-ns9360.c
index 41df69721769..77281260358a 100644
--- a/arch/arm/mach-ns9xxx/time-ns9360.c
+++ b/arch/arm/mach-ns9xxx/time-ns9360.c
@@ -25,7 +25,7 @@
25#define TIMER_CLOCKEVENT 1 25#define TIMER_CLOCKEVENT 1
26static u32 latch; 26static u32 latch;
27 27
28static cycle_t ns9360_clocksource_read(void) 28static cycle_t ns9360_clocksource_read(struct clocksource *cs)
29{ 29{
30 return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE)); 30 return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE));
31} 31}
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 495a32c287b4..4d56408d3cff 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -198,7 +198,7 @@ static struct irqaction omap_mpu_timer2_irq = {
198 .handler = omap_mpu_timer2_interrupt, 198 .handler = omap_mpu_timer2_interrupt,
199}; 199};
200 200
201static cycle_t mpu_read(void) 201static cycle_t mpu_read(struct clocksource *cs)
202{ 202{
203 return ~omap_mpu_timer_read(1); 203 return ~omap_mpu_timer_read(1);
204} 204}
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 9fc13a2cc3f4..1cb2c0909c2b 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -138,7 +138,7 @@ static inline void __init omap2_gp_clocksource_init(void) {}
138 * clocksource 138 * clocksource
139 */ 139 */
140static struct omap_dm_timer *gpt_clocksource; 140static struct omap_dm_timer *gpt_clocksource;
141static cycle_t clocksource_read_cycles(void) 141static cycle_t clocksource_read_cycles(struct clocksource *cs)
142{ 142{
143 return (cycle_t)omap_dm_timer_read_counter(gpt_clocksource); 143 return (cycle_t)omap_dm_timer_read_counter(gpt_clocksource);
144} 144}
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index 8eb3830fbb0b..750c448db672 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -125,7 +125,7 @@ static struct clock_event_device ckevt_pxa_osmr0 = {
125 .set_mode = pxa_osmr0_set_mode, 125 .set_mode = pxa_osmr0_set_mode,
126}; 126};
127 127
128static cycle_t pxa_read_oscr(void) 128static cycle_t pxa_read_oscr(struct clocksource *cs)
129{ 129{
130 return OSCR; 130 return OSCR;
131} 131}
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 9ab947c14f26..942e1a7eb9b2 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -715,7 +715,7 @@ static struct irqaction realview_timer_irq = {
715 .handler = realview_timer_interrupt, 715 .handler = realview_timer_interrupt,
716}; 716};
717 717
718static cycle_t realview_get_cycles(void) 718static cycle_t realview_get_cycles(struct clocksource *cs)
719{ 719{
720 return ~readl(timer3_va_base + TIMER_VALUE); 720 return ~readl(timer3_va_base + TIMER_VALUE);
721} 721}
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 565776680d8c..1f929c391af7 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -948,7 +948,7 @@ static struct irqaction versatile_timer_irq = {
948 .handler = versatile_timer_interrupt, 948 .handler = versatile_timer_interrupt,
949}; 949};
950 950
951static cycle_t versatile_get_cycles(void) 951static cycle_t versatile_get_cycles(struct clocksource *cs)
952{ 952{
953 return ~readl(TIMER3_VA_BASE + TIMER_VALUE); 953 return ~readl(TIMER3_VA_BASE + TIMER_VALUE);
954} 954}
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index ef1b3cd85bd3..dab3357196fb 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -36,7 +36,7 @@ static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
36 36
37/* clock source */ 37/* clock source */
38 38
39static cycle_t mxc_get_cycles(void) 39static cycle_t mxc_get_cycles(struct clocksource *cs)
40{ 40{
41 return __raw_readl(TIMER_BASE + MXC_TCN); 41 return __raw_readl(TIMER_BASE + MXC_TCN);
42} 42}
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index d1797147732f..433021f3d7cc 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -185,7 +185,7 @@ console_initcall(omap_add_serial_console);
185 185
186#include <linux/clocksource.h> 186#include <linux/clocksource.h>
187 187
188static cycle_t omap_32k_read(void) 188static cycle_t omap_32k_read(struct clocksource *cs)
189{ 189{
190 return omap_readl(TIMER_32K_SYNCHRONIZED); 190 return omap_readl(TIMER_32K_SYNCHRONIZED);
191} 191}
@@ -207,7 +207,7 @@ unsigned long long sched_clock(void)
207{ 207{
208 unsigned long long ret; 208 unsigned long long ret;
209 209
210 ret = (unsigned long long)omap_32k_read(); 210 ret = (unsigned long long)omap_32k_read(&clocksource_32k);
211 ret = (ret * clocksource_32k.mult_orig) >> clocksource_32k.shift; 211 ret = (ret * clocksource_32k.mult_orig) >> clocksource_32k.shift;
212 return ret; 212 return ret;
213} 213}
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 6fa2923e6dca..2faf9dba4ef7 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -41,7 +41,7 @@ static u32 ticks_per_jiffy;
41/* 41/*
42 * Clocksource handling. 42 * Clocksource handling.
43 */ 43 */
44static cycle_t orion_clksrc_read(void) 44static cycle_t orion_clksrc_read(struct clocksource *cs)
45{ 45{
46 return 0xffffffff - readl(TIMER0_VAL); 46 return 0xffffffff - readl(TIMER0_VAL);
47} 47}
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 0ff46bf873b0..f27aa3b259fa 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -18,7 +18,7 @@
18#include <mach/pm.h> 18#include <mach/pm.h>
19 19
20 20
21static cycle_t read_cycle_count(void) 21static cycle_t read_cycle_count(struct clocksource *cs)
22{ 22{
23 return (cycle_t)sysreg_read(COUNT); 23 return (cycle_t)sysreg_read(COUNT);
24} 24}
diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c
index 0ed2badfd746..27646121280a 100644
--- a/arch/blackfin/kernel/time-ts.c
+++ b/arch/blackfin/kernel/time-ts.c
@@ -58,16 +58,11 @@ static inline unsigned long long cycles_2_ns(cycle_t cyc)
58 return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR; 58 return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
59} 59}
60 60
61static cycle_t read_cycles(void) 61static cycle_t read_cycles(struct clocksource *cs)
62{ 62{
63 return __bfin_cycles_off + (get_cycles() << __bfin_cycles_mod); 63 return __bfin_cycles_off + (get_cycles() << __bfin_cycles_mod);
64} 64}
65 65
66unsigned long long sched_clock(void)
67{
68 return cycles_2_ns(read_cycles());
69}
70
71static struct clocksource clocksource_bfin = { 66static struct clocksource clocksource_bfin = {
72 .name = "bfin_cycles", 67 .name = "bfin_cycles",
73 .rating = 350, 68 .rating = 350,
@@ -77,6 +72,11 @@ static struct clocksource clocksource_bfin = {
77 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 72 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
78}; 73};
79 74
75unsigned long long sched_clock(void)
76{
77 return cycles_2_ns(read_cycles(&clocksource_bfin));
78}
79
80static int __init bfin_clocksource_init(void) 80static int __init bfin_clocksource_init(void)
81{ 81{
82 set_cyc2ns_scale(get_cclk() / 1000); 82 set_cyc2ns_scale(get_cclk() / 1000);
diff --git a/arch/ia64/kernel/cyclone.c b/arch/ia64/kernel/cyclone.c
index 790ef0d87e12..71e35864d2e2 100644
--- a/arch/ia64/kernel/cyclone.c
+++ b/arch/ia64/kernel/cyclone.c
@@ -21,7 +21,7 @@ void __init cyclone_setup(void)
21 21
22static void __iomem *cyclone_mc; 22static void __iomem *cyclone_mc;
23 23
24static cycle_t read_cyclone(void) 24static cycle_t read_cyclone(struct clocksource *cs)
25{ 25{
26 return (cycle_t)readq((void __iomem *)cyclone_mc); 26 return (cycle_t)readq((void __iomem *)cyclone_mc);
27} 27}
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 641c8b61c4f1..604c1a35db33 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -33,7 +33,7 @@
33 33
34#include "fsyscall_gtod_data.h" 34#include "fsyscall_gtod_data.h"
35 35
36static cycle_t itc_get_cycles(void); 36static cycle_t itc_get_cycles(struct clocksource *cs);
37 37
38struct fsyscall_gtod_data_t fsyscall_gtod_data = { 38struct fsyscall_gtod_data_t fsyscall_gtod_data = {
39 .lock = SEQLOCK_UNLOCKED, 39 .lock = SEQLOCK_UNLOCKED,
@@ -383,7 +383,7 @@ ia64_init_itm (void)
383 } 383 }
384} 384}
385 385
386static cycle_t itc_get_cycles(void) 386static cycle_t itc_get_cycles(struct clocksource *cs)
387{ 387{
388 u64 lcycle, now, ret; 388 u64 lcycle, now, ret;
389 389
diff --git a/arch/ia64/sn/kernel/sn2/timer.c b/arch/ia64/sn/kernel/sn2/timer.c
index cf67fc562054..21d6f09e3447 100644
--- a/arch/ia64/sn/kernel/sn2/timer.c
+++ b/arch/ia64/sn/kernel/sn2/timer.c
@@ -23,7 +23,7 @@
23 23
24extern unsigned long sn_rtc_cycles_per_second; 24extern unsigned long sn_rtc_cycles_per_second;
25 25
26static cycle_t read_sn2(void) 26static cycle_t read_sn2(struct clocksource *cs)
27{ 27{
28 return (cycle_t)readq(RTC_COUNTER_ADDR); 28 return (cycle_t)readq(RTC_COUNTER_ADDR);
29} 29}
diff --git a/arch/m68knommu/platform/68328/timers.c b/arch/m68knommu/platform/68328/timers.c
index 6bafefa546e5..309f725995bf 100644
--- a/arch/m68knommu/platform/68328/timers.c
+++ b/arch/m68knommu/platform/68328/timers.c
@@ -75,7 +75,7 @@ static struct irqaction m68328_timer_irq = {
75 75
76/***************************************************************************/ 76/***************************************************************************/
77 77
78static cycle_t m68328_read_clk(void) 78static cycle_t m68328_read_clk(struct clocksource *cs)
79{ 79{
80 unsigned long flags; 80 unsigned long flags;
81 u32 cycles; 81 u32 cycles;
diff --git a/arch/m68knommu/platform/coldfire/dma_timer.c b/arch/m68knommu/platform/coldfire/dma_timer.c
index 772578b1084f..a5f562823d7a 100644
--- a/arch/m68knommu/platform/coldfire/dma_timer.c
+++ b/arch/m68knommu/platform/coldfire/dma_timer.c
@@ -34,7 +34,7 @@
34#define DMA_DTMR_CLK_DIV_16 (2 << 1) 34#define DMA_DTMR_CLK_DIV_16 (2 << 1)
35#define DMA_DTMR_ENABLE (1 << 0) 35#define DMA_DTMR_ENABLE (1 << 0)
36 36
37static cycle_t cf_dt_get_cycles(void) 37static cycle_t cf_dt_get_cycles(struct clocksource *cs)
38{ 38{
39 return __raw_readl(DTCN0); 39 return __raw_readl(DTCN0);
40} 40}
diff --git a/arch/m68knommu/platform/coldfire/pit.c b/arch/m68knommu/platform/coldfire/pit.c
index 2a12e7fa9748..61b96211f8ff 100644
--- a/arch/m68knommu/platform/coldfire/pit.c
+++ b/arch/m68knommu/platform/coldfire/pit.c
@@ -125,7 +125,7 @@ static struct irqaction pit_irq = {
125 125
126/***************************************************************************/ 126/***************************************************************************/
127 127
128static cycle_t pit_read_clk(void) 128static cycle_t pit_read_clk(struct clocksource *cs)
129{ 129{
130 unsigned long flags; 130 unsigned long flags;
131 u32 cycles; 131 u32 cycles;
diff --git a/arch/m68knommu/platform/coldfire/timers.c b/arch/m68knommu/platform/coldfire/timers.c
index 454f25493491..1ba8a3731653 100644
--- a/arch/m68knommu/platform/coldfire/timers.c
+++ b/arch/m68knommu/platform/coldfire/timers.c
@@ -78,7 +78,7 @@ static struct irqaction mcftmr_timer_irq = {
78 78
79/***************************************************************************/ 79/***************************************************************************/
80 80
81static cycle_t mcftmr_read_clk(void) 81static cycle_t mcftmr_read_clk(struct clocksource *cs)
82{ 82{
83 unsigned long flags; 83 unsigned long flags;
84 u32 cycles; 84 u32 cycles;
diff --git a/arch/mips/kernel/cevt-txx9.c b/arch/mips/kernel/cevt-txx9.c
index eccf7d6096bd..2e911e3da8d3 100644
--- a/arch/mips/kernel/cevt-txx9.c
+++ b/arch/mips/kernel/cevt-txx9.c
@@ -22,7 +22,7 @@
22 22
23static struct txx9_tmr_reg __iomem *txx9_cs_tmrptr; 23static struct txx9_tmr_reg __iomem *txx9_cs_tmrptr;
24 24
25static cycle_t txx9_cs_read(void) 25static cycle_t txx9_cs_read(struct clocksource *cs)
26{ 26{
27 return __raw_readl(&txx9_cs_tmrptr->trr); 27 return __raw_readl(&txx9_cs_tmrptr->trr);
28} 28}
diff --git a/arch/mips/kernel/csrc-bcm1480.c b/arch/mips/kernel/csrc-bcm1480.c
index 868745e7184b..51489f8a825e 100644
--- a/arch/mips/kernel/csrc-bcm1480.c
+++ b/arch/mips/kernel/csrc-bcm1480.c
@@ -28,7 +28,7 @@
28 28
29#include <asm/sibyte/sb1250.h> 29#include <asm/sibyte/sb1250.h>
30 30
31static cycle_t bcm1480_hpt_read(void) 31static cycle_t bcm1480_hpt_read(struct clocksource *cs)
32{ 32{
33 return (cycle_t) __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT)); 33 return (cycle_t) __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT));
34} 34}
diff --git a/arch/mips/kernel/csrc-ioasic.c b/arch/mips/kernel/csrc-ioasic.c
index 1d5f63cf8997..b551f48d3a07 100644
--- a/arch/mips/kernel/csrc-ioasic.c
+++ b/arch/mips/kernel/csrc-ioasic.c
@@ -25,7 +25,7 @@
25#include <asm/dec/ioasic.h> 25#include <asm/dec/ioasic.h>
26#include <asm/dec/ioasic_addrs.h> 26#include <asm/dec/ioasic_addrs.h>
27 27
28static cycle_t dec_ioasic_hpt_read(void) 28static cycle_t dec_ioasic_hpt_read(struct clocksource *cs)
29{ 29{
30 return ioasic_read(IO_REG_FCTR); 30 return ioasic_read(IO_REG_FCTR);
31} 31}
@@ -47,13 +47,13 @@ void __init dec_ioasic_clocksource_init(void)
47 while (!ds1287_timer_state()) 47 while (!ds1287_timer_state())
48 ; 48 ;
49 49
50 start = dec_ioasic_hpt_read(); 50 start = dec_ioasic_hpt_read(&clocksource_dec);
51 51
52 while (i--) 52 while (i--)
53 while (!ds1287_timer_state()) 53 while (!ds1287_timer_state())
54 ; 54 ;
55 55
56 end = dec_ioasic_hpt_read(); 56 end = dec_ioasic_hpt_read(&clocksource_dec);
57 57
58 freq = (end - start) * 10; 58 freq = (end - start) * 10;
59 printk(KERN_INFO "I/O ASIC clock frequency %dHz\n", freq); 59 printk(KERN_INFO "I/O ASIC clock frequency %dHz\n", freq);
diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
index f1a2893931ed..e95a3cd48eea 100644
--- a/arch/mips/kernel/csrc-r4k.c
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -10,7 +10,7 @@
10 10
11#include <asm/time.h> 11#include <asm/time.h>
12 12
13static cycle_t c0_hpt_read(void) 13static cycle_t c0_hpt_read(struct clocksource *cs)
14{ 14{
15 return read_c0_count(); 15 return read_c0_count();
16} 16}
diff --git a/arch/mips/kernel/csrc-sb1250.c b/arch/mips/kernel/csrc-sb1250.c
index 92212bbb8e45..d14d3d1907fa 100644
--- a/arch/mips/kernel/csrc-sb1250.c
+++ b/arch/mips/kernel/csrc-sb1250.c
@@ -33,7 +33,7 @@
33 * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over 33 * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over
34 * again. 34 * again.
35 */ 35 */
36static cycle_t sb1250_hpt_read(void) 36static cycle_t sb1250_hpt_read(struct clocksource *cs)
37{ 37{
38 unsigned int count; 38 unsigned int count;
39 39
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c
index 689719e34f08..ed20e7fe65e3 100644
--- a/arch/mips/kernel/i8253.c
+++ b/arch/mips/kernel/i8253.c
@@ -128,7 +128,7 @@ void __init setup_pit_timer(void)
128 * to just read by itself. So use jiffies to emulate a free 128 * to just read by itself. So use jiffies to emulate a free
129 * running counter: 129 * running counter:
130 */ 130 */
131static cycle_t pit_read(void) 131static cycle_t pit_read(struct clocksource *cs)
132{ 132{
133 unsigned long flags; 133 unsigned long flags;
134 int count; 134 int count;
diff --git a/arch/mips/nxp/pnx8550/common/time.c b/arch/mips/nxp/pnx8550/common/time.c
index cf293b279098..8df43e9e4d90 100644
--- a/arch/mips/nxp/pnx8550/common/time.c
+++ b/arch/mips/nxp/pnx8550/common/time.c
@@ -35,7 +35,7 @@
35 35
36static unsigned long cpj; 36static unsigned long cpj;
37 37
38static cycle_t hpt_read(void) 38static cycle_t hpt_read(struct clocksource *cs)
39{ 39{
40 return read_c0_count2(); 40 return read_c0_count2();
41} 41}
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index f024057a35f8..f10a7cd64f7e 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -159,7 +159,7 @@ static void __init hub_rt_clock_event_global_init(void)
159 setup_irq(irq, &hub_rt_irqaction); 159 setup_irq(irq, &hub_rt_irqaction);
160} 160}
161 161
162static cycle_t hub_rt_read(void) 162static cycle_t hub_rt_read(struct clocksource *cs)
163{ 163{
164 return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT); 164 return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT);
165} 165}
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 926ea864e34f..48571ac56fb7 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -77,7 +77,7 @@
77#include <linux/clockchips.h> 77#include <linux/clockchips.h>
78#include <linux/clocksource.h> 78#include <linux/clocksource.h>
79 79
80static cycle_t rtc_read(void); 80static cycle_t rtc_read(struct clocksource *);
81static struct clocksource clocksource_rtc = { 81static struct clocksource clocksource_rtc = {
82 .name = "rtc", 82 .name = "rtc",
83 .rating = 400, 83 .rating = 400,
@@ -88,7 +88,7 @@ static struct clocksource clocksource_rtc = {
88 .read = rtc_read, 88 .read = rtc_read,
89}; 89};
90 90
91static cycle_t timebase_read(void); 91static cycle_t timebase_read(struct clocksource *);
92static struct clocksource clocksource_timebase = { 92static struct clocksource clocksource_timebase = {
93 .name = "timebase", 93 .name = "timebase",
94 .rating = 400, 94 .rating = 400,
@@ -766,12 +766,12 @@ unsigned long read_persistent_clock(void)
766} 766}
767 767
768/* clocksource code */ 768/* clocksource code */
769static cycle_t rtc_read(void) 769static cycle_t rtc_read(struct clocksource *cs)
770{ 770{
771 return (cycle_t)get_rtc(); 771 return (cycle_t)get_rtc();
772} 772}
773 773
774static cycle_t timebase_read(void) 774static cycle_t timebase_read(struct clocksource *cs)
775{ 775{
776 return (cycle_t)get_tb(); 776 return (cycle_t)get_tb();
777} 777}
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 6ded50dfa75a..ef596d020573 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -201,7 +201,7 @@ unsigned long read_persistent_clock(void)
201 return ts.tv_sec; 201 return ts.tv_sec;
202} 202}
203 203
204static cycle_t read_tod_clock(void) 204static cycle_t read_tod_clock(struct clocksource *cs)
205{ 205{
206 return get_clock(); 206 return get_clock();
207} 207}
diff --git a/arch/sh/kernel/time_32.c b/arch/sh/kernel/time_32.c
index c34e1e0f9b02..1700d2465f6c 100644
--- a/arch/sh/kernel/time_32.c
+++ b/arch/sh/kernel/time_32.c
@@ -208,7 +208,7 @@ unsigned long long sched_clock(void)
208 if (!clocksource_sh.rating) 208 if (!clocksource_sh.rating)
209 return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ); 209 return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ);
210 210
211 cycles = clocksource_sh.read(); 211 cycles = clocksource_sh.read(&clocksource_sh);
212 return cyc2ns(&clocksource_sh, cycles); 212 return cyc2ns(&clocksource_sh, cycles);
213} 213}
214#endif 214#endif
diff --git a/arch/sh/kernel/timers/timer-tmu.c b/arch/sh/kernel/timers/timer-tmu.c
index c5d3396f5960..fe8d8930ccb6 100644
--- a/arch/sh/kernel/timers/timer-tmu.c
+++ b/arch/sh/kernel/timers/timer-tmu.c
@@ -81,7 +81,7 @@ static int tmu_timer_stop(void)
81 */ 81 */
82static int tmus_are_scaled; 82static int tmus_are_scaled;
83 83
84static cycle_t tmu_timer_read(void) 84static cycle_t tmu_timer_read(struct clocksource *cs)
85{ 85{
86 return ((cycle_t)(~_tmu_read(TMU1)))<<tmus_are_scaled; 86 return ((cycle_t)(~_tmu_read(TMU1)))<<tmus_are_scaled;
87} 87}
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index db310aa00183..5c12e79b4bdf 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -814,6 +814,11 @@ void udelay(unsigned long usecs)
814} 814}
815EXPORT_SYMBOL(udelay); 815EXPORT_SYMBOL(udelay);
816 816
817static cycle_t clocksource_tick_read(struct clocksource *cs)
818{
819 return tick_ops->get_tick();
820}
821
817void __init time_init(void) 822void __init time_init(void)
818{ 823{
819 unsigned long freq = sparc64_init_timers(); 824 unsigned long freq = sparc64_init_timers();
@@ -827,7 +832,7 @@ void __init time_init(void)
827 clocksource_tick.mult = 832 clocksource_tick.mult =
828 clocksource_hz2mult(freq, 833 clocksource_hz2mult(freq,
829 clocksource_tick.shift); 834 clocksource_tick.shift);
830 clocksource_tick.read = tick_ops->get_tick; 835 clocksource_tick.read = clocksource_tick_read;
831 836
832 printk("clocksource: mult[%x] shift[%d]\n", 837 printk("clocksource: mult[%x] shift[%d]\n",
833 clocksource_tick.mult, clocksource_tick.shift); 838 clocksource_tick.mult, clocksource_tick.shift);
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index b13a87a3ec95..c8b9c469fcd7 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -65,7 +65,7 @@ static irqreturn_t um_timer(int irq, void *dev)
65 return IRQ_HANDLED; 65 return IRQ_HANDLED;
66} 66}
67 67
68static cycle_t itimer_read(void) 68static cycle_t itimer_read(struct clocksource *cs)
69{ 69{
70 return os_nsecs() / 1000; 70 return os_nsecs() / 1000;
71} 71}
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 */
725static cycle_t read_hpet(void) 725static 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 */
132static cycle_t pit_read(void) 132static 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
80static 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
108static struct clocksource kvm_clock = { 113static 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 */
702static cycle_t read_tsc(void) 702static 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 */
284static struct clocksource clocksource_vmi; 284static struct clocksource clocksource_vmi;
285 285
286static cycle_t read_real_cycles(void) 286static 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. */
666static cycle_t lguest_clock_read(void) 666static 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
216static cycle_t xen_clocksource_get_cycles(struct clocksource *cs)
217{
218 return xen_clocksource_read();
219}
220
216static void xen_read_wallclock(struct timespec *ts) 221static 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)
241static struct clocksource xen_clocksource __read_mostly = { 246static 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,