mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARC: Fix __udelay parentheses
@ 2013-08-28 18:29 Mischa Jonker
  2013-08-28 18:45 ` Joe Perches
  2013-08-29  5:55 ` Vineet Gupta
  0 siblings, 2 replies; 11+ messages in thread
From: Mischa Jonker @ 2013-08-28 18:29 UTC (permalink / raw)
  To: Vineet.Gupta1, linux-kernel; +Cc: Mischa Jonker

Make sure that usecs is casted to long long, to ensure that the
(usecs * 4295 * HZ) multiplication is 64 bit.

Initially, the (usecs * 4295 * HZ) part was done as a 32 bit
multiplication, with the result casted to 64 bit. This led to some bits
falling off.

Signed-off-by: Mischa Jonker <mjonker@synopsys.com>
---
 arch/arc/include/asm/delay.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arc/include/asm/delay.h b/arch/arc/include/asm/delay.h
index 442ce5d..8d35fe1 100644
--- a/arch/arc/include/asm/delay.h
+++ b/arch/arc/include/asm/delay.h
@@ -56,8 +56,8 @@ static inline void __udelay(unsigned long usecs)
 	/* (long long) cast ensures 64 bit MPY - real or emulated
 	 * HZ * 4295 is pre-evaluated by gcc - hence only 2 mpy ops
 	 */
-	loops = ((long long)(usecs * 4295 * HZ) *
-		 (long long)(loops_per_jiffy)) >> 32;
+	loops = (((long long) usecs) * 4295 * HZ *
+		  (long long) loops_per_jiffy) >> 32;
 
 	__delay(loops);
 }
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-08-29  6:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-28 18:29 [PATCH] ARC: Fix __udelay parentheses Mischa Jonker
2013-08-28 18:45 ` Joe Perches
2013-08-28 18:53   ` Mischa Jonker
2013-08-28 19:01     ` Joe Perches
2013-08-28 19:12       ` Mischa Jonker
2013-08-29  1:43         ` Joe Perches
2013-08-29  5:55 ` Vineet Gupta
2013-08-29  6:01   ` Joe Perches
2013-08-29  6:24     ` Vineet Gupta
2013-08-29  6:37       ` Joe Perches
2013-08-29  6:49         ` Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®