aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/vdso
diff options
context:
space:
mode:
authorStefani Seibold <stefani@seibold.net>2014-03-17 18:22:06 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2014-03-18 15:52:26 -0400
commit0df1ea2b7955d3cb311a549c44ed482452b859ff (patch)
tree6ac3651a888e78dd0f89aa077036ac410c86f76e /arch/x86/vdso
parentaf8c93d8d9809c3cf71cae2c398069399e64efa3 (diff)
x86, vdso: Cleanup __vdso_gettimeofday()
This patch cleans up the __vdso_gettimeofday() function a little. It kicks out an unneeded ret local variable and makes the code faster if only the timezone is needed (an admittedly rare case.) Reviewed-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Stefani Seibold <stefani@seibold.net> Link: http://lkml.kernel.org/r/1395094933-14252-7-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.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 743f27774b73..09dae4a1c6dc 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -259,13 +259,12 @@ int clock_gettime(clockid_t, struct timespec *)
259 259
260notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) 260notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
261{ 261{
262 long ret = VCLOCK_NONE;
263
264 if (likely(tv != NULL)) { 262 if (likely(tv != NULL)) {
265 BUILD_BUG_ON(offsetof(struct timeval, tv_usec) != 263 BUILD_BUG_ON(offsetof(struct timeval, tv_usec) !=
266 offsetof(struct timespec, tv_nsec) || 264 offsetof(struct timespec, tv_nsec) ||
267 sizeof(*tv) != sizeof(struct timespec)); 265 sizeof(*tv) != sizeof(struct timespec));
268 ret = do_realtime((struct timespec *)tv); 266 if (unlikely(do_realtime((struct timespec *)tv) == VCLOCK_NONE))
267 return vdso_fallback_gtod(tv, tz);
269 tv->tv_usec /= 1000; 268 tv->tv_usec /= 1000;
270 } 269 }
271 if (unlikely(tz != NULL)) { 270 if (unlikely(tz != NULL)) {
@@ -274,8 +273,6 @@ notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
274 tz->tz_dsttime = gtod->sys_tz.tz_dsttime; 273 tz->tz_dsttime = gtod->sys_tz.tz_dsttime;
275 } 274 }
276 275
277 if (ret == VCLOCK_NONE)
278 return vdso_fallback_gtod(tv, tz);
279 return 0; 276 return 0;
280} 277}
281int gettimeofday(struct timeval *, struct timezone *) 278int gettimeofday(struct timeval *, struct timezone *)