[U-Boot] [PATCH 1/2] lib: time: export usec_to_tick()

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Jun 2 19:33:15 UTC 2019


In the UEFI Stall() boottime service we need access to usec_to_tick().

Export the function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 include/time.h | 9 +++++++++
 lib/time.c     | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/time.h b/include/time.h
index 9fd0d73fb4..99d45d3ae2 100644
--- a/include/time.h
+++ b/include/time.h
@@ -4,6 +4,7 @@
 #define _TIME_H

 #include <linux/typecheck.h>
+#include <linux/types.h>

 unsigned long get_timer(unsigned long base);

@@ -21,6 +22,14 @@ unsigned long timer_get_us(void);
  */
 void timer_test_add_offset(unsigned long offset);

+/**
+ * usec_to_tick() - convert microseconds to clock ticks
+ *
+ * @usec:	duration in microseconds
+ * Return:	duration in clock ticks
+ */
+uint64_t usec_to_tick(unsigned long usec);
+
 /*
  *	These inlines deal with timer wrapping correctly. You are
  *	strongly encouraged to use them
diff --git a/lib/time.c b/lib/time.c
index 9c55da6f1b..f5751ab162 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -139,7 +139,7 @@ unsigned long __weak notrace timer_get_us(void)
 	return tick_to_time(get_ticks() * 1000);
 }

-static uint64_t usec_to_tick(unsigned long usec)
+uint64_t usec_to_tick(unsigned long usec)
 {
 	uint64_t tick = usec;
 	tick *= get_tbclk();
--
2.20.1



More information about the U-Boot mailing list