summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-05-05 14:49:25 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-05-24 09:14:38 +0200
commite4b9bcd663546852621f44d135da6096f90bbb1e (patch)
tree9d207fbb564f2671c8cc5c5e47bf709ef8774e53
parent194fc7294a47a58abd51a258dabde455c9c80143 (diff)
downloadbarebox-e4b9bcd663546852621f44d135da6096f90bbb1e.tar.gz
clock: initialize dummy clocksource statically
Assigning the dummy clocksource in a initcall has the problem that get_time_ns() crashes before that initcall is executed. This happens when dmesg support is enabled in conjunction with CONFIG_DEBUG_INITCALLS. In this case the dmesg code wants to have the timestamp of a log message. Solve this by setting the current clocksource to the dummy clock statically and not at runtime. This way we always have a dummy clock available. Fixes: commit 8972eb7ff17ad058a6c6018305bb912138ab0ca2 Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Date: Fri Mar 3 13:34:02 2017 +0100 clocksource: move dummy clock source to init_clock Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/clock.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/common/clock.c b/common/clock.c
index 0d581c2..f98176d 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -27,7 +27,6 @@
#include <clock.h>
#include <poller.h>
-static struct clocksource *current_clock;
static uint64_t time_ns;
/*
@@ -53,11 +52,7 @@ static struct clocksource dummy_cs = {
.priority = -1,
};
-static int dummy_csrc_init(void)
-{
- return init_clock(&dummy_cs);
-}
-pure_initcall(dummy_csrc_init);
+static struct clocksource *current_clock = &dummy_cs;
static int dummy_csrc_warn(void)
{