Commit cb0e996378900fa05d5c779d6bfa52d55ebc3407
Committed by
Thomas Gleixner
1 parent
6ffdc5774a
Exists in
master
and in
7 other branches
blackfin: Convert blackfin to use read/update_persistent_clock
This patch converts the blackfin architecture to use the generic read_persistent_clock and update_persistent_clock interfaces, reducing the amount of arch specific code we have to maintain, and allowing for further cleanups in the future. I have not built or tested this patch, so help from arch maintainers would be appreciated. Signed-off-by: John Stultz <johnstul@us.ibm.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Andrew Morton <akpm@linux-foundation.org> LKML-Reference: <1267675049-12337-10-git-send-email-johnstul@us.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Showing 2 changed files with 13 additions and 39 deletions Side-by-side Diff
arch/blackfin/kernel/time-ts.c
... | ... | @@ -348,10 +348,16 @@ |
348 | 348 | return 0; |
349 | 349 | } |
350 | 350 | |
351 | -void __init time_init(void) | |
351 | +void read_persistent_clock(struct timespec *ts) | |
352 | 352 | { |
353 | 353 | time_t secs_since_1970 = (365 * 37 + 9) * 24 * 60 * 60; /* 1 Jan 2007 */ |
354 | + ts->tv_sec = secs_since_1970; | |
355 | + ts->tv_nsec = 0; | |
356 | +} | |
354 | 357 | |
358 | +void __init time_init(void) | |
359 | +{ | |
360 | + | |
355 | 361 | #ifdef CONFIG_RTC_DRV_BFIN |
356 | 362 | /* [#2663] hack to filter junk RTC values that would cause |
357 | 363 | * userspace to have to deal with time values greater than |
... | ... | @@ -362,11 +368,6 @@ |
362 | 368 | bfin_write_RTC_STAT(0); |
363 | 369 | } |
364 | 370 | #endif |
365 | - | |
366 | - /* Initialize xtime. From now on, xtime is updated with timer interrupts */ | |
367 | - xtime.tv_sec = secs_since_1970; | |
368 | - xtime.tv_nsec = 0; | |
369 | - set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); | |
370 | 371 | |
371 | 372 | bfin_cs_cycles_init(); |
372 | 373 | bfin_cs_gptimer0_init(); |
arch/blackfin/kernel/time.c
... | ... | @@ -112,11 +112,6 @@ |
112 | 112 | } |
113 | 113 | #endif |
114 | 114 | |
115 | -static inline int set_rtc_mmss(unsigned long nowtime) | |
116 | -{ | |
117 | - return 0; | |
118 | -} | |
119 | - | |
120 | 115 | /* |
121 | 116 | * timer_interrupt() needs to keep up the real-time clock, |
122 | 117 | * as well as call the "do_timer()" routine every clocktick |
123 | 118 | |
... | ... | @@ -126,29 +121,8 @@ |
126 | 121 | #endif |
127 | 122 | irqreturn_t timer_interrupt(int irq, void *dummy) |
128 | 123 | { |
129 | - /* last time the cmos clock got updated */ | |
130 | - static long last_rtc_update; | |
131 | - | |
132 | 124 | write_seqlock(&xtime_lock); |
133 | 125 | do_timer(1); |
134 | - | |
135 | - /* | |
136 | - * If we have an externally synchronized Linux clock, then update | |
137 | - * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | |
138 | - * called as close as possible to 500 ms before the new second starts. | |
139 | - */ | |
140 | - if (ntp_synced() && | |
141 | - xtime.tv_sec > last_rtc_update + 660 && | |
142 | - (xtime.tv_nsec / NSEC_PER_USEC) >= | |
143 | - 500000 - ((unsigned)TICK_SIZE) / 2 | |
144 | - && (xtime.tv_nsec / NSEC_PER_USEC) <= | |
145 | - 500000 + ((unsigned)TICK_SIZE) / 2) { | |
146 | - if (set_rtc_mmss(xtime.tv_sec) == 0) | |
147 | - last_rtc_update = xtime.tv_sec; | |
148 | - else | |
149 | - /* Do it again in 60s. */ | |
150 | - last_rtc_update = xtime.tv_sec - 600; | |
151 | - } | |
152 | 126 | write_sequnlock(&xtime_lock); |
153 | 127 | |
154 | 128 | #ifdef CONFIG_IPIPE |
155 | 129 | |
156 | 130 | |
... | ... | @@ -161,10 +135,15 @@ |
161 | 135 | return IRQ_HANDLED; |
162 | 136 | } |
163 | 137 | |
164 | -void __init time_init(void) | |
138 | +void read_persistent_clock(struct timespec *ts) | |
165 | 139 | { |
166 | 140 | time_t secs_since_1970 = (365 * 37 + 9) * 24 * 60 * 60; /* 1 Jan 2007 */ |
141 | + ts->tv_sec = secs_since_1970; | |
142 | + ts->tv_nsec = 0; | |
143 | +} | |
167 | 144 | |
145 | +void __init time_init(void) | |
146 | +{ | |
168 | 147 | #ifdef CONFIG_RTC_DRV_BFIN |
169 | 148 | /* [#2663] hack to filter junk RTC values that would cause |
170 | 149 | * userspace to have to deal with time values greater than |
... | ... | @@ -175,12 +154,6 @@ |
175 | 154 | bfin_write_RTC_STAT(0); |
176 | 155 | } |
177 | 156 | #endif |
178 | - | |
179 | - /* Initialize xtime. From now on, xtime is updated with timer interrupts */ | |
180 | - xtime.tv_sec = secs_since_1970; | |
181 | - xtime.tv_nsec = 0; | |
182 | - | |
183 | - wall_to_monotonic.tv_sec = -xtime.tv_sec; | |
184 | 157 | |
185 | 158 | time_sched_init(timer_interrupt); |
186 | 159 | } |