[PATCH v5 33/54] clock: Use udelay() to implement mdelay()

Andrey Smirnov andrew.smirnov at gmail.com
Tue Jun 12 13:52:49 PDT 2018


Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
 lib/clock.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/clock.c b/lib/clock.c
index b7cc49fa6..37e45489c 100644
--- a/lib/clock.c
+++ b/lib/clock.c
@@ -50,9 +50,11 @@ EXPORT_SYMBOL(udelay);
 
 void mdelay(unsigned long msecs)
 {
-	uint64_t start = get_time_ns();
-
-	while(!is_timeout(start, msecs * MSECOND));
+	/*
+	 * Parens around division below are needed to pervent ARM/EABI
+	 * toolchain from emitting a call to __aeabi_uldivmod.
+	 */
+	udelay(msecs * (MSECOND / USECOND));
 }
 EXPORT_SYMBOL(mdelay);
 
-- 
2.17.0




More information about the barebox mailing list