[coreboot-gerrit] Patch set updated for coreboot: include/timer.h: Guard `timer_monotonic_get()` calls by `CONFIG_MONOTONIC_TIMER`

Paul Menzel (paulepanter@users.sourceforge.net) gerrit at coreboot.org
Sun Oct 25 00:09:46 CEST 2015


Paul Menzel (paulepanter at users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12105

-gerrit

commit c844f3975f930928ee84320ce9a94ee87d06127e
Author: Paul Menzel <paulepanter at users.sourceforge.net>
Date:   Tue Oct 20 22:27:05 2015 +0200

    include/timer.h: Guard `timer_monotonic_get()` calls by `CONFIG_MONOTONIC_TIMER`
    
    Some platforms do not have `timer_monotonic_get()` implemented. So only
    call `timer_monotonic_get()` if `CONFIG_MONOTONIC_TIMER` is selected.
    
    Change-Id: If9cba4c0c17a7011aa357079d8fdd0aa47ad1b66
    Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
 src/include/timer.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/include/timer.h b/src/include/timer.h
index aa5746d..490e360 100644
--- a/src/include/timer.h
+++ b/src/include/timer.h
@@ -130,7 +130,11 @@ struct stopwatch {
 
 static inline void stopwatch_init(struct stopwatch *sw)
 {
-	timer_monotonic_get(&sw->start);
+	if (IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER))
+		timer_monotonic_get(&sw->start);
+	else
+		sw->start = 0
+
 	sw->current = sw->expires = sw->start;
 }
 
@@ -150,7 +154,10 @@ static inline void stopwatch_init_msecs_expire(struct stopwatch *sw, long ms)
  */
 static inline void stopwatch_tick(struct stopwatch *sw)
 {
-	timer_monotonic_get(&sw->current);
+	if (IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER))
+		timer_monotonic_get(&sw->current);
+	else
+		sw->current = 0
 }
 
 /*



More information about the coreboot-gerrit mailing list