diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2017-03-03 13:34:01 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-09 07:36:15 +0100 |
commit | 6bc48eabbfe78906ac2b7fa8e12cc9b0608c76bd (patch) | |
tree | f33412aab697a989397b0152ab4256ada4a138ee /common | |
parent | 92c1033036a0f1d65fb71e7c04cfb9393d31aa1c (diff) | |
download | barebox-6bc48eabbfe78906ac2b7fa8e12cc9b0608c76bd.tar.gz barebox-6bc48eabbfe78906ac2b7fa8e12cc9b0608c76bd.tar.xz |
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')
-rw-r--r-- | common/clock.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/clock.c b/common/clock.c index 2c5dd91ccd..1090b605f8 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(); |