diff options
Diffstat (limited to 'arch/arm/kernel/time.c')
-rw-r--r-- | arch/arm/kernel/time.c | 70 |
1 files changed, 6 insertions, 64 deletions
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index 28753805d2d1..38c261f9951c 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
@@ -72,12 +72,15 @@ unsigned long profile_pc(struct pt_regs *regs) | |||
72 | EXPORT_SYMBOL(profile_pc); | 72 | EXPORT_SYMBOL(profile_pc); |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | #ifndef CONFIG_GENERIC_TIME | 75 | #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET |
76 | static unsigned long dummy_gettimeoffset(void) | 76 | u32 arch_gettimeoffset(void) |
77 | { | 77 | { |
78 | if (system_timer->offset != NULL) | ||
79 | return system_timer->offset() * 1000; | ||
80 | |||
78 | return 0; | 81 | return 0; |
79 | } | 82 | } |
80 | #endif | 83 | #endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */ |
81 | 84 | ||
82 | #ifdef CONFIG_LEDS_TIMER | 85 | #ifdef CONFIG_LEDS_TIMER |
83 | static inline void do_leds(void) | 86 | static inline void do_leds(void) |
@@ -93,63 +96,6 @@ static inline void do_leds(void) | |||
93 | #define do_leds() | 96 | #define do_leds() |
94 | #endif | 97 | #endif |
95 | 98 | ||
96 | #ifndef CONFIG_GENERIC_TIME | ||
97 | void do_gettimeofday(struct timeval *tv) | ||
98 | { | ||
99 | unsigned long flags; | ||
100 | unsigned long seq; | ||
101 | unsigned long usec, sec; | ||
102 | |||
103 | do { | ||
104 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | ||
105 | usec = system_timer->offset(); | ||
106 | sec = xtime.tv_sec; | ||
107 | usec += xtime.tv_nsec / 1000; | ||
108 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | ||
109 | |||
110 | /* usec may have gone up a lot: be safe */ | ||
111 | while (usec >= 1000000) { | ||
112 | usec -= 1000000; | ||
113 | sec++; | ||
114 | } | ||
115 | |||
116 | tv->tv_sec = sec; | ||
117 | tv->tv_usec = usec; | ||
118 | } | ||
119 | |||
120 | EXPORT_SYMBOL(do_gettimeofday); | ||
121 | |||
122 | int do_settimeofday(struct timespec *tv) | ||
123 | { | ||
124 | time_t wtm_sec, sec = tv->tv_sec; | ||
125 | long wtm_nsec, nsec = tv->tv_nsec; | ||
126 | |||
127 | if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) | ||
128 | return -EINVAL; | ||
129 | |||
130 | write_seqlock_irq(&xtime_lock); | ||
131 | /* | ||
132 | * This is revolting. We need to set "xtime" correctly. However, the | ||
133 | * value in this location is the value at the most recent update of | ||
134 | * wall time. Discover what correction gettimeofday() would have | ||
135 | * done, and then undo it! | ||
136 | */ | ||
137 | nsec -= system_timer->offset() * NSEC_PER_USEC; | ||
138 | |||
139 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | ||
140 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | ||
141 | |||
142 | set_normalized_timespec(&xtime, sec, nsec); | ||
143 | set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); | ||
144 | |||
145 | ntp_clear(); | ||
146 | write_sequnlock_irq(&xtime_lock); | ||
147 | clock_was_set(); | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | EXPORT_SYMBOL(do_settimeofday); | ||
152 | #endif /* !CONFIG_GENERIC_TIME */ | ||
153 | 99 | ||
154 | #ifndef CONFIG_GENERIC_CLOCKEVENTS | 100 | #ifndef CONFIG_GENERIC_CLOCKEVENTS |
155 | /* | 101 | /* |
@@ -214,10 +160,6 @@ device_initcall(timer_init_sysfs); | |||
214 | 160 | ||
215 | void __init time_init(void) | 161 | void __init time_init(void) |
216 | { | 162 | { |
217 | #ifndef CONFIG_GENERIC_TIME | ||
218 | if (system_timer->offset == NULL) | ||
219 | system_timer->offset = dummy_gettimeoffset; | ||
220 | #endif | ||
221 | system_timer->init(); | 163 | system_timer->init(); |
222 | } | 164 | } |
223 | 165 | ||