From 9f55f2448184bf7588abbadea7e6303ea0ca0f11 Mon Sep 17 00:00:00 2001 From: Yongjin Lee Date: Sun, 9 Feb 2014 20:37:51 +0900 Subject: [PATCH] dma: pl330: Changed the timeout function Change-Id: I52449c51ade4ca3a4fe24a4988bc9912d7aecfb7 Signed-off-by: Yongjin Lee Signed-off-by: Seokju Yoon --- drivers/dma/pl330.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index b3832ca2ee8e..3f23c5137517 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -851,26 +851,21 @@ static inline u32 _emit_GO(unsigned dry_run, u8 buf[], return SZ_DMAGO; } -#define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t) - /* Returns Time-Out */ static bool _until_dmac_idle(struct pl330_thread *thrd) { void __iomem *regs = thrd->dmac->base; - unsigned long loops = msecs_to_loops(5); + unsigned long timeout = jiffies + msecs_to_jiffies(5); do { /* Until Manager is Idle */ if (!(readl(regs + DBGSTATUS) & DBG_BUSY)) - break; + return false; cpu_relax(); - } while (--loops); + } while (time_before(jiffies, timeout)); - if (!loops) - return true; - - return false; + return true; } static inline void _execute_DBGINSN(struct pl330_thread *thrd, -- 2.20.1