Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

[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>

authored by

john stultz and committed by
Linus Torvalds
ebd6c171 b4a22834

+4 -81
+4
arch/frv/Kconfig
··· 29 29 bool 30 30 default n 31 31 32 + config GENERIC_TIME 33 + bool 34 + default y 35 + 32 36 config TIME_LOW_RES 33 37 bool 34 38 default y
-81
arch/frv/kernel/time.c
··· 32 32 33 33 #define TICK_SIZE (tick_nsec / 1000) 34 34 35 - extern unsigned long wall_jiffies; 36 - 37 35 unsigned long __nongprelbss __clkin_clock_speed_HZ; 38 36 unsigned long __nongprelbss __ext_bus_clock_speed_HZ; 39 37 unsigned long __nongprelbss __res_bus_clock_speed_HZ; ··· 141 143 142 144 time_divisor_init(); 143 145 } 144 - 145 - /* 146 - * This version of gettimeofday has near microsecond resolution. 147 - */ 148 - void do_gettimeofday(struct timeval *tv) 149 - { 150 - unsigned long seq; 151 - unsigned long usec, sec; 152 - unsigned long max_ntp_tick; 153 - 154 - do { 155 - unsigned long lost; 156 - 157 - seq = read_seqbegin(&xtime_lock); 158 - 159 - usec = 0; 160 - lost = jiffies - wall_jiffies; 161 - 162 - /* 163 - * If time_adjust is negative then NTP is slowing the clock 164 - * so make sure not to go into next possible interval. 165 - * Better to lose some accuracy than have time go backwards.. 166 - */ 167 - if (unlikely(time_adjust < 0)) { 168 - max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj; 169 - usec = min(usec, max_ntp_tick); 170 - 171 - if (lost) 172 - usec += lost * max_ntp_tick; 173 - } 174 - else if (unlikely(lost)) 175 - usec += lost * (USEC_PER_SEC / HZ); 176 - 177 - sec = xtime.tv_sec; 178 - usec += (xtime.tv_nsec / 1000); 179 - } while (read_seqretry(&xtime_lock, seq)); 180 - 181 - while (usec >= 1000000) { 182 - usec -= 1000000; 183 - sec++; 184 - } 185 - 186 - tv->tv_sec = sec; 187 - tv->tv_usec = usec; 188 - } 189 - 190 - EXPORT_SYMBOL(do_gettimeofday); 191 - 192 - int do_settimeofday(struct timespec *tv) 193 - { 194 - time_t wtm_sec, sec = tv->tv_sec; 195 - long wtm_nsec, nsec = tv->tv_nsec; 196 - 197 - if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) 198 - return -EINVAL; 199 - 200 - write_seqlock_irq(&xtime_lock); 201 - /* 202 - * This is revolting. We need to set "xtime" correctly. However, the 203 - * value in this location is the value at the most recent update of 204 - * wall time. Discover what correction gettimeofday() would have 205 - * made, and then undo it! 206 - */ 207 - nsec -= 0 * NSEC_PER_USEC; 208 - nsec -= (jiffies - wall_jiffies) * TICK_NSEC; 209 - 210 - wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 211 - wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 212 - 213 - set_normalized_timespec(&xtime, sec, nsec); 214 - set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 215 - 216 - ntp_clear(); 217 - write_sequnlock_irq(&xtime_lock); 218 - clock_was_set(); 219 - return 0; 220 - } 221 - 222 - EXPORT_SYMBOL(do_settimeofday); 223 146 224 147 /* 225 148 * Scheduler clock - returns current time in nanosec units.