Commit ce39c640 authored by Stefani Seibold's avatar Stefani Seibold Committed by H. Peter Anvin

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: default avatarAndy Lutomirski <luto@amacapital.net>
Signed-off-by: default avatarStefani Seibold <stefani@seibold.net>
Link: http://lkml.kernel.org/r/1395094933-14252-5-git-send-email-stefani@seibold.netSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 411f790c
...@@ -209,7 +209,7 @@ notrace static int do_monotonic(struct timespec *ts) ...@@ -209,7 +209,7 @@ notrace static int do_monotonic(struct timespec *ts)
return mode; return mode;
} }
notrace static int do_realtime_coarse(struct timespec *ts) notrace static void do_realtime_coarse(struct timespec *ts)
{ {
unsigned long seq; unsigned long seq;
do { do {
...@@ -217,10 +217,9 @@ notrace static int do_realtime_coarse(struct timespec *ts) ...@@ -217,10 +217,9 @@ notrace static int do_realtime_coarse(struct timespec *ts)
ts->tv_sec = gtod->wall_time_coarse.tv_sec; ts->tv_sec = gtod->wall_time_coarse.tv_sec;
ts->tv_nsec = gtod->wall_time_coarse.tv_nsec; ts->tv_nsec = gtod->wall_time_coarse.tv_nsec;
} while (unlikely(read_seqcount_retry(&gtod->seq, seq))); } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
return 0;
} }
notrace static int do_monotonic_coarse(struct timespec *ts) notrace static void do_monotonic_coarse(struct timespec *ts)
{ {
unsigned long seq; unsigned long seq;
do { do {
...@@ -228,30 +227,32 @@ notrace static int do_monotonic_coarse(struct timespec *ts) ...@@ -228,30 +227,32 @@ notrace static int do_monotonic_coarse(struct timespec *ts)
ts->tv_sec = gtod->monotonic_time_coarse.tv_sec; ts->tv_sec = gtod->monotonic_time_coarse.tv_sec;
ts->tv_nsec = gtod->monotonic_time_coarse.tv_nsec; ts->tv_nsec = gtod->monotonic_time_coarse.tv_nsec;
} while (unlikely(read_seqcount_retry(&gtod->seq, seq))); } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
return 0;
} }
notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts) notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
{ {
int ret = VCLOCK_NONE;
switch (clock) { switch (clock) {
case CLOCK_REALTIME: case CLOCK_REALTIME:
ret = do_realtime(ts); if (do_realtime(ts) == VCLOCK_NONE)
goto fallback;
break; break;
case CLOCK_MONOTONIC: case CLOCK_MONOTONIC:
ret = do_monotonic(ts); if (do_monotonic(ts) == VCLOCK_NONE)
goto fallback;
break; break;
case CLOCK_REALTIME_COARSE: case CLOCK_REALTIME_COARSE:
return do_realtime_coarse(ts); do_realtime_coarse(ts);
break;
case CLOCK_MONOTONIC_COARSE: case CLOCK_MONOTONIC_COARSE:
return do_monotonic_coarse(ts); do_monotonic_coarse(ts);
break;
default:
goto fallback;
} }
if (ret == VCLOCK_NONE)
return vdso_fallback_gettime(clock, ts);
return 0; return 0;
fallback:
return vdso_fallback_gettime(clock, ts);
} }
int clock_gettime(clockid_t, struct timespec *) int clock_gettime(clockid_t, struct timespec *)
__attribute__((weak, alias("__vdso_clock_gettime"))); __attribute__((weak, alias("__vdso_clock_gettime")));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment