mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] clock: initialize dummy clocksource statically
Date: Mon,  8 May 2017 10:48:50 +0200	[thread overview]
Message-ID: <20170508084850.9215-1-s.hauer@pengutronix.de> (raw)

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>
---
 common/clock.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/common/clock.c b/common/clock.c
index 0d581c2c7e..f98176dd52 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)
 {
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2017-05-08  8:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170508084850.9215-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox