diff options
author | Marc Zyngier <Marc.Zyngier@arm.com> | 2012-05-05 14:28:44 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-05-06 06:09:21 -0400 |
commit | bd0493eaaf5c7a1ea00786d46cc2f4af44e76f28 (patch) | |
tree | bd7fbb1d21c5c00b0c37eeb3ac1b09a9d4f123ac /arch/arm/kernel/time.c | |
parent | f67860a76f162ebcc6a2cacf3b0538d8a67d55ae (diff) |
ARM: 7413/1: move read_{boot,persistent}_clock to the architecture level
At the moment, read_persistent_clock is implemented at the
platform level, which makes it impossible to compile these
platforms in a single kernel.
Implement these two functions at the architecture level, and
provide a thin registration interface for both read_boot_clock
and read_persistent_clock. The two affected platforms (OMAP and
Tegra) are converted at the same time.
Reported-by: Jeff Ohlstein <johlstei@codeaurora.org>
Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/time.c')
-rw-r--r-- | arch/arm/kernel/time.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index fe31b22f18fd..af2afb019672 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
@@ -110,6 +110,42 @@ void timer_tick(void) | |||
110 | } | 110 | } |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | static void dummy_clock_access(struct timespec *ts) | ||
114 | { | ||
115 | ts->tv_sec = 0; | ||
116 | ts->tv_nsec = 0; | ||
117 | } | ||
118 | |||
119 | static clock_access_fn __read_persistent_clock = dummy_clock_access; | ||
120 | static clock_access_fn __read_boot_clock = dummy_clock_access;; | ||
121 | |||
122 | void read_persistent_clock(struct timespec *ts) | ||
123 | { | ||
124 | __read_persistent_clock(ts); | ||
125 | } | ||
126 | |||
127 | void read_boot_clock(struct timespec *ts) | ||
128 | { | ||
129 | __read_boot_clock(ts); | ||
130 | } | ||
131 | |||
132 | int __init register_persistent_clock(clock_access_fn read_boot, | ||
133 | clock_access_fn read_persistent) | ||
134 | { | ||
135 | /* Only allow the clockaccess functions to be registered once */ | ||
136 | if (__read_persistent_clock == dummy_clock_access && | ||
137 | __read_boot_clock == dummy_clock_access) { | ||
138 | if (read_boot) | ||
139 | __read_boot_clock = read_boot; | ||
140 | if (read_persistent) | ||
141 | __read_persistent_clock = read_persistent; | ||
142 | |||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | return -EINVAL; | ||
147 | } | ||
148 | |||
113 | #if defined(CONFIG_PM) && !defined(CONFIG_GENERIC_CLOCKEVENTS) | 149 | #if defined(CONFIG_PM) && !defined(CONFIG_GENERIC_CLOCKEVENTS) |
114 | static int timer_suspend(void) | 150 | static int timer_suspend(void) |
115 | { | 151 | { |