diff options
author | john stultz <johnstul@us.ibm.com> | 2006-09-06 06:02:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-06 14:00:02 -0400 |
commit | ebd6c17109aed086908ae3b0949265fd07712659 (patch) | |
tree | 7a1af4b2ac8b6ce062206d0e967272d2ae457ff6 | |
parent | b4a228346c1a7d09f565e750d2e988c5671e9fa3 (diff) |
[PATCH] FRV: Use the generic time stuff for FRV
Use the generic time stuff for FRV.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/frv/Kconfig | 4 | ||||
-rw-r--r-- | arch/frv/kernel/time.c | 81 |
2 files changed, 4 insertions, 81 deletions
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index 95a3892b8d1b..a601a17cf568 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -29,6 +29,10 @@ config GENERIC_HARDIRQS | |||
29 | bool | 29 | bool |
30 | default n | 30 | default n |
31 | 31 | ||
32 | config GENERIC_TIME | ||
33 | bool | ||
34 | default y | ||
35 | |||
32 | config TIME_LOW_RES | 36 | config TIME_LOW_RES |
33 | bool | 37 | bool |
34 | default y | 38 | default y |
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c index d5b64e193d92..68a77fe3bb40 100644 --- a/arch/frv/kernel/time.c +++ b/arch/frv/kernel/time.c | |||
@@ -32,8 +32,6 @@ | |||
32 | 32 | ||
33 | #define TICK_SIZE (tick_nsec / 1000) | 33 | #define TICK_SIZE (tick_nsec / 1000) |
34 | 34 | ||
35 | extern unsigned long wall_jiffies; | ||
36 | |||
37 | unsigned long __nongprelbss __clkin_clock_speed_HZ; | 35 | unsigned long __nongprelbss __clkin_clock_speed_HZ; |
38 | unsigned long __nongprelbss __ext_bus_clock_speed_HZ; | 36 | unsigned long __nongprelbss __ext_bus_clock_speed_HZ; |
39 | unsigned long __nongprelbss __res_bus_clock_speed_HZ; | 37 | unsigned long __nongprelbss __res_bus_clock_speed_HZ; |
@@ -145,85 +143,6 @@ void time_init(void) | |||
145 | } | 143 | } |
146 | 144 | ||
147 | /* | 145 | /* |
148 | * This version of gettimeofday has near microsecond resolution. | ||
149 | */ | ||
150 | void do_gettimeofday(struct timeval *tv) | ||
151 | { | ||
152 | unsigned long seq; | ||
153 | unsigned long usec, sec; | ||
154 | unsigned long max_ntp_tick; | ||
155 | |||
156 | do { | ||
157 | unsigned long lost; | ||
158 | |||
159 | seq = read_seqbegin(&xtime_lock); | ||
160 | |||
161 | usec = 0; | ||
162 | lost = jiffies - wall_jiffies; | ||
163 | |||
164 | /* | ||
165 | * If time_adjust is negative then NTP is slowing the clock | ||
166 | * so make sure not to go into next possible interval. | ||
167 | * Better to lose some accuracy than have time go backwards.. | ||
168 | */ | ||
169 | if (unlikely(time_adjust < 0)) { | ||
170 | max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj; | ||
171 | usec = min(usec, max_ntp_tick); | ||
172 | |||
173 | if (lost) | ||
174 | usec += lost * max_ntp_tick; | ||
175 | } | ||
176 | else if (unlikely(lost)) | ||
177 | usec += lost * (USEC_PER_SEC / HZ); | ||
178 | |||
179 | sec = xtime.tv_sec; | ||
180 | usec += (xtime.tv_nsec / 1000); | ||
181 | } while (read_seqretry(&xtime_lock, seq)); | ||
182 | |||
183 | while (usec >= 1000000) { | ||
184 | usec -= 1000000; | ||
185 | sec++; | ||
186 | } | ||
187 | |||
188 | tv->tv_sec = sec; | ||
189 | tv->tv_usec = usec; | ||
190 | } | ||
191 | |||
192 | EXPORT_SYMBOL(do_gettimeofday); | ||
193 | |||
194 | int do_settimeofday(struct timespec *tv) | ||
195 | { | ||
196 | time_t wtm_sec, sec = tv->tv_sec; | ||
197 | long wtm_nsec, nsec = tv->tv_nsec; | ||
198 | |||
199 | if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) | ||
200 | return -EINVAL; | ||
201 | |||
202 | write_seqlock_irq(&xtime_lock); | ||
203 | /* | ||
204 | * This is revolting. We need to set "xtime" correctly. However, the | ||
205 | * value in this location is the value at the most recent update of | ||
206 | * wall time. Discover what correction gettimeofday() would have | ||
207 | * made, and then undo it! | ||
208 | */ | ||
209 | nsec -= 0 * NSEC_PER_USEC; | ||
210 | nsec -= (jiffies - wall_jiffies) * TICK_NSEC; | ||
211 | |||
212 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | ||
213 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | ||
214 | |||
215 | set_normalized_timespec(&xtime, sec, nsec); | ||
216 | set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); | ||
217 | |||
218 | ntp_clear(); | ||
219 | write_sequnlock_irq(&xtime_lock); | ||
220 | clock_was_set(); | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | EXPORT_SYMBOL(do_settimeofday); | ||
225 | |||
226 | /* | ||
227 | * Scheduler clock - returns current time in nanosec units. | 146 | * Scheduler clock - returns current time in nanosec units. |
228 | */ | 147 | */ |
229 | unsigned long long sched_clock(void) | 148 | unsigned long long sched_clock(void) |