[PATCH] add clocksource_get_next

From: Giuseppe Cavallaro
Date: Tue Apr 06 2010 - 10:04:46 EST


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@xxxxxx>
---
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


--------------090707060902010107000608--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/