public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
To: linux-kernel@vger.kernel.org
Subject: re-adding clocksource_get_next ?
Date: Fri, 09 Apr 2010 08:53:11 +0200	[thread overview]
Message-ID: <4BBECED7.4010004@st.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

Hello!
this function was removed in the past but I've not clear all the details.
While testing LLTng, I wrote the patch, in attachment, that re-adds it
again.
The clocksource_get_next returns the first clock source available
(without looking at the rating).
In my environment, a clock source is a TMU channel (e.g. TMU1) and,
indeed, clocksource_get_next works fine.

Let me know if it makes sense or if I'm missing something.

Best Regards,
Giuseppe

[-- Attachment #2: 0001-add-clocksource_get_next.patch --]
[-- Type: text/x-patch, Size: 1330 bytes --]

>From d05e9a31e4d697b704a1d9170aeee7235ffffb0f Mon Sep 17 00:00:00 2001
From: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Date: Tue, 6 Apr 2010 16:04:46 +0200
Subject: [PATCH] add clocksource_get_next

Added the clocksource_get_next function, it returns a source clock.
The clocksource_get_next function has been used for testing LTT
and implementing trace clock definitions on ST platforms.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 kernel/time/clocksource.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 0e98497..c9e8f56 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -613,6 +613,23 @@ static void clocksource_enqueue(struct clocksource *cs)
 	list_add(&cs->list, entry);
 }
 
+/*
+ * Return a clocksource if available
+ */
+struct clocksource *clocksource_get_next(void)
+{
+	struct clocksource *clock = NULL;
+
+	mutex_lock(&clocksource_mutex);
+	if (!list_empty(&clocksource_list)) {
+		struct list_head *list = clocksource_list.next;
+		clock = container_of(list, struct clocksource, list);
+	}
+	mutex_unlock(&clocksource_mutex);
+
+	return clock;
+}
+
 /**
  * clocksource_register - Used to install new clocksources
  * @t:		clocksource to be registered
-- 
1.6.0.4


             reply	other threads:[~2010-04-09  6:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09  6:53 Giuseppe CAVALLARO [this message]
2010-04-09 20:58 ` re-adding clocksource_get_next ? john stultz
2010-04-12  6:02   ` Giuseppe CAVALLARO
2010-04-12 18:50     ` john stultz
2010-04-13  5:44       ` Giuseppe CAVALLARO

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=4BBECED7.4010004@st.com \
    --to=peppe.cavallaro@st.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox