All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefani Seibold <stefani@seibold.net>
To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	x86@kernel.org, tglx@linutronix.de, mingo@redhat.com,
	hpa@zytor.com, ak@linux.intel.com, aarcange@redhat.com,
	john.stultz@linaro.org, luto@amacapital.net, xemul@parallels.com,
	gorcunov@openvz.org, andriy.shevchenko@linux.intel.com
Cc: Martin.Runge@rohde-schwarz.com, Andreas.Brief@rohde-schwarz.com,
	Stefani Seibold <stefani@seibold.net>
Subject: [PATCH v21 04/12] vclock_gettime.c __vdso_clock_gettime cleanup
Date: Sun,  2 Mar 2014 10:20:12 +0100	[thread overview]
Message-ID: <1393752020-6740-5-git-send-email-stefani@seibold.net> (raw)
In-Reply-To: <1393752020-6740-1-git-send-email-stefani@seibold.net>

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.

Signed-off-by: Stefani Seibold <stefani@seibold.net>
---
 arch/x86/vdso/vclock_gettime.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index bbc8065..fd074dd 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)
 	return mode;
 }
 
-notrace static int do_realtime_coarse(struct timespec *ts)
+notrace static void do_realtime_coarse(struct timespec *ts)
 {
 	unsigned long seq;
 	do {
@@ -217,10 +217,9 @@ notrace static int do_realtime_coarse(struct timespec *ts)
 		ts->tv_sec = gtod->wall_time_coarse.tv_sec;
 		ts->tv_nsec = gtod->wall_time_coarse.tv_nsec;
 	} 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;
 	do {
@@ -228,30 +227,32 @@ notrace static int do_monotonic_coarse(struct timespec *ts)
 		ts->tv_sec = gtod->monotonic_time_coarse.tv_sec;
 		ts->tv_nsec = gtod->monotonic_time_coarse.tv_nsec;
 	} while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
-
-	return 0;
 }
 
 notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
 {
-	int ret = VCLOCK_NONE;
-
 	switch (clock) {
 	case CLOCK_REALTIME:
-		ret = do_realtime(ts);
+		if (do_realtime(ts) == VCLOCK_NONE)
+			goto fallback;
 		break;
 	case CLOCK_MONOTONIC:
-		ret = do_monotonic(ts);
+		if (do_monotonic(ts) == VCLOCK_NONE)
+			goto fallback;
 		break;
 	case CLOCK_REALTIME_COARSE:
-		return do_realtime_coarse(ts);
+		do_realtime_coarse(ts);
+		break;
 	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;
+fallback:
+	return vdso_fallback_gettime(clock, ts);
 }
 int clock_gettime(clockid_t, struct timespec *)
 	__attribute__((weak, alias("__vdso_clock_gettime")));
-- 
1.9.0


  parent reply	other threads:[~2014-03-02  9:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02  9:20 [PATCH v21 00/12] Add 32 bit VDSO time function support Stefani Seibold
2014-03-02  9:20 ` [PATCH v21 01/12] Make vsyscall_gtod_data handling x86 generic Stefani Seibold
2014-03-02  9:20 ` [PATCH v21 02/12] Add new func _install_special_mapping() to mmap.c Stefani Seibold
2014-03-02  9:20 ` [PATCH v21 03/12] revamp vclock_gettime.c Stefani Seibold
2014-03-02  9:20 ` Stefani Seibold [this message]
2014-03-02  9:20 ` [PATCH v21 05/12] replace VVAR(vsyscall_gtod_data) by gtod macro Stefani Seibold
2014-03-02  9:20 ` [PATCH v21 06/12] cleanup __vdso_gettimeofday Stefani Seibold
2014-03-02  9:20 ` [PATCH v21 07/12] introduce VVAR marco for vdso32 Stefani Seibold
2014-03-02  9:20 ` [PATCH v21 08/12] Patch alternatives in the 32-bit vDSO Stefani Seibold
2014-03-02  9:20 ` [PATCH v21 09/12] Add 32 bit VDSO time support for 32 bit kernel Stefani Seibold
2014-03-02  9:20 ` [PATCH v21 10/12] Add 32 bit VDSO time support for 64 " Stefani Seibold
2014-03-02  9:20 ` [PATCH v21 12/12] x86: Zero-pad the VVAR page Stefani Seibold
2014-03-02 10:46   ` Ingo Molnar
2014-03-02 10:47 ` [PATCH v21 00/12] Add 32 bit VDSO time function support Ingo Molnar
2014-03-02 16:32   ` Andy Lutomirski
2014-03-02 21:02     ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393752020-6740-5-git-send-email-stefani@seibold.net \
    --to=stefani@seibold.net \
    --cc=Andreas.Brief@rohde-schwarz.com \
    --cc=Martin.Runge@rohde-schwarz.com \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gorcunov@openvz.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xemul@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.