dma: pl330: Changed the timeout function
authorYongjin Lee <yongjin0.lee@samsung.com>
Sun, 9 Feb 2014 11:37:51 +0000 (20:37 +0900)
committerTaekki Kim <taekki.kim@samsung.com>
Mon, 14 May 2018 05:42:46 +0000 (14:42 +0900)
Change-Id: I52449c51ade4ca3a4fe24a4988bc9912d7aecfb7
Signed-off-by: Yongjin Lee <yongjin0.lee@samsung.com>
Signed-off-by: Seokju Yoon <sukju.yoon@samsung.com>
drivers/dma/pl330.c

index b3832ca2ee8e3d4d19181636ec0794ed8d165f0e..3f23c5137517b105dbfc60aa1d96725b94e35637 100644 (file)
@@ -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,