From 187e4c4474a4b678a88b0f7df67e387f0d0d46fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Wed, 20 Feb 2019 17:38:45 +0200 Subject: timestamp: Move timestamp_should_run() call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Old location caused spurious error messages when called from APs, where timestamp_add_now() should do nothing. Moving the test also makes get_us_from_boot() usable from APs (assuming cache coherency). Change-Id: Ice9ece11b15bbe1a58a038cda3d299862e6f822b Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/31524 Reviewed-by: Aaron Durbin Reviewed-by: Furquan Shaikh Reviewed-by: Werner Zeh Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) --- src/lib/timestamp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c index 6885e7b55b..f84b9d5bc7 100644 --- a/src/lib/timestamp.c +++ b/src/lib/timestamp.c @@ -125,9 +125,6 @@ static struct timestamp_table *timestamp_table_get(void) MAYBE_STATIC struct timestamp_table *ts_table = NULL; struct timestamp_cache *ts_cache; - if (!timestamp_should_run()) - return NULL; - if (ts_table != NULL) return ts_table; @@ -188,6 +185,9 @@ void timestamp_add(enum timestamp_id id, uint64_t ts_time) { struct timestamp_table *ts_table; + if (!timestamp_should_run()) + return; + ts_table = timestamp_table_get(); if (!ts_table) { -- cgit v1.2.3