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>
This commit is contained in:
parent
92c1033036
commit
6bc48eabbf
|
@ -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();
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ struct clocksource {
|
|||
uint64_t (*read)(void);
|
||||
uint64_t cycle_last;
|
||||
uint64_t mask;
|
||||
|
||||
int priority;
|
||||
int (*init)(struct clocksource*);
|
||||
};
|
||||
|
||||
static inline uint32_t cyc2ns(struct clocksource *cs, uint64_t cycles)
|
||||
|
|
Loading…
Reference in New Issue