diff options
author | Stefani Seibold <stefani@seibold.net> | 2014-03-17 18:22:04 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-03-18 15:52:01 -0400 |
commit | ce39c64028a075d14af32bfb8336bfe1370c0443 (patch) | |
tree | d782e79dd4d326ebe411e4ff552e629c3c06f7cc /arch/x86/vdso | |
parent | 411f790cd7e91fac0db80d3cf789cb6deeac298e (diff) |
x86, vdso: __vdso_clock_gettime() cleanup
This patch is a small code cleanup for the __vdso_clock_gettime() function.
It removes the unneeded return values from do_monotonic_coarse() and
do_realtime_coarse() and add a fallback label for doing the kernel
gettimeofday() system call.
Reviewed-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Stefani Seibold <stefani@seibold.net>
Link: http://lkml.kernel.org/r/1395094933-14252-5-git-send-email-stefani@seibold.net
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/vdso')
-rw-r--r-- | arch/x86/vdso/vclock_gettime.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c index bbc80657050f..fd074dd19a4a 100644 --- a/arch/x86/vdso/vclock_gettime.c +++ b/arch/x86/vdso/vclock_gettime.c | |||
@@ -209,7 +209,7 @@ notrace static int do_monotonic(struct timespec *ts) | |||
209 | return mode; | 209 | return mode; |
210 | } | 210 | } |
211 | 211 | ||
212 | notrace static int do_realtime_coarse(struct timespec *ts) | 212 | notrace static void do_realtime_coarse(struct timespec *ts) |
213 | { | 213 | { |
214 | unsigned long seq; | 214 | unsigned long seq; |
215 | do { | 215 | do { |
@@ -217,10 +217,9 @@ notrace static int do_realtime_coarse(struct timespec *ts) | |||
217 | ts->tv_sec = gtod->wall_time_coarse.tv_sec; | 217 | ts->tv_sec = gtod->wall_time_coarse.tv_sec; |
218 | ts->tv_nsec = gtod->wall_time_coarse.tv_nsec; | 218 | ts->tv_nsec = gtod->wall_time_coarse.tv_nsec; |
219 | } while (unlikely(read_seqcount_retry(>od->seq, seq))); | 219 | } while (unlikely(read_seqcount_retry(>od->seq, seq))); |
220 | return 0; | ||
221 | } | 220 | } |
222 | 221 | ||
223 | notrace static int do_monotonic_coarse(struct timespec *ts) | 222 | notrace static void do_monotonic_coarse(struct timespec *ts) |
224 | { | 223 | { |
225 | unsigned long seq; | 224 | unsigned long seq; |
226 | do { | 225 | do { |
@@ -228,30 +227,32 @@ notrace static int do_monotonic_coarse(struct timespec *ts) | |||
228 | ts->tv_sec = gtod->monotonic_time_coarse.tv_sec; | 227 | ts->tv_sec = gtod->monotonic_time_coarse.tv_sec; |
229 | ts->tv_nsec = gtod->monotonic_time_coarse.tv_nsec; | 228 | ts->tv_nsec = gtod->monotonic_time_coarse.tv_nsec; |
230 | } while (unlikely(read_seqcount_retry(>od->seq, seq))); | 229 | } while (unlikely(read_seqcount_retry(>od->seq, seq))); |
231 | |||
232 | return 0; | ||
233 | } | 230 | } |
234 | 231 | ||
235 | notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts) | 232 | notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts) |
236 | { | 233 | { |
237 | int ret = VCLOCK_NONE; | ||
238 | |||
239 | switch (clock) { | 234 | switch (clock) { |
240 | case CLOCK_REALTIME: | 235 | case CLOCK_REALTIME: |
241 | ret = do_realtime(ts); | 236 | if (do_realtime(ts) == VCLOCK_NONE) |
237 | goto fallback; | ||
242 | break; | 238 | break; |
243 | case CLOCK_MONOTONIC: | 239 | case CLOCK_MONOTONIC: |
244 | ret = do_monotonic(ts); | 240 | if (do_monotonic(ts) == VCLOCK_NONE) |
241 | goto fallback; | ||
245 | break; | 242 | break; |
246 | case CLOCK_REALTIME_COARSE: | 243 | case CLOCK_REALTIME_COARSE: |
247 | return do_realtime_coarse(ts); | 244 | do_realtime_coarse(ts); |
245 | break; | ||
248 | case CLOCK_MONOTONIC_COARSE: | 246 | case CLOCK_MONOTONIC_COARSE: |
249 | return do_monotonic_coarse(ts); | 247 | do_monotonic_coarse(ts); |
248 | break; | ||
249 | default: | ||
250 | goto fallback; | ||
250 | } | 251 | } |
251 | 252 | ||
252 | if (ret == VCLOCK_NONE) | ||
253 | return vdso_fallback_gettime(clock, ts); | ||
254 | return 0; | 253 | return 0; |
254 | fallback: | ||
255 | return vdso_fallback_gettime(clock, ts); | ||
255 | } | 256 | } |
256 | int clock_gettime(clockid_t, struct timespec *) | 257 | int clock_gettime(clockid_t, struct timespec *) |
257 | __attribute__((weak, alias("__vdso_clock_gettime"))); | 258 | __attribute__((weak, alias("__vdso_clock_gettime"))); |