[U-Boot] [PATCH v1 (WIP) 09/16] [Timer]Replace get_timer() usage in drivers/block/

Graeme Russ graeme.russ at gmail.com
Tue Jun 28 13:41:02 CEST 2011


Signed-off-by: Graeme Russ <graeme.russ at gmail.com>
---
 drivers/block/mg_disk.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 2198017..c8cc195 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -88,17 +88,16 @@ static void mg_dump_status (const char *msg, unsigned int stat, unsigned err)
 static unsigned int mg_wait (u32 expect, u32 msec)
 {
 	u8 status;
-	u32 from, cur, err;
+	u32 ts, err;
 
 	err = MG_ERR_NONE;
 #ifdef CONFIG_NIOS2
 	reset_timer();
 #endif
-	from = get_timer(0);
+	ts = time_now_ms();
 
 	status = readb(mg_base() + MG_REG_STATUS);
 	do {
-		cur = get_timer(from);
 		if (status & MG_REG_STATUS_BIT_BUSY) {
 			if (expect == MG_REG_STATUS_BIT_BUSY)
 				break;
@@ -119,9 +118,9 @@ static unsigned int mg_wait (u32 expect, u32 msec)
 					break;
 		}
 		status = readb(mg_base() + MG_REG_STATUS);
-	} while (cur < msec);
+	} while (time_since_ms(ts) < msec);
 
-	if (cur >= msec)
+	if (time_since_ms(ts) >= msec)
 		err = MG_ERR_TIMEOUT;
 
 	return err;
-- 
1.7.5.2.317.g391b14



More information about the U-Boot mailing list