summaryrefslogtreecommitdiffstats
path: root/common/clock.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2017-03-03 13:34:01 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-09 07:36:15 +0100
commit6bc48eabbfe78906ac2b7fa8e12cc9b0608c76bd (patch)
treef33412aab697a989397b0152ab4256ada4a138ee /common/clock.c
parent92c1033036a0f1d65fb71e7c04cfb9393d31aa1c (diff)
downloadbarebox-6bc48eabbfe78906ac2b7fa8e12cc9b0608c76bd.tar.gz
clocksource: allow to have multiple device from clock source
use the one with the most priority. We can not select the clocksource at user level. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/clock.c')
-rw-r--r--common/clock.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/clock.c b/common/clock.c
index 2c5dd91..1090b60 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -213,6 +213,17 @@ EXPORT_SYMBOL(mdelay_non_interruptible);
int init_clock(struct clocksource *cs)
{
+ if (current_clock && cs->priority <= current_clock->priority)
+ return 0;
+
+ if (cs->init) {
+ int ret;
+
+ ret = cs->init(cs);
+ if (ret)
+ return ret;
+ }
+
current_clock = cs;
time_beginning = get_time_ns();