Re: [2.6.25 patch] drivers/crypto/hifn_795x.c: fix 64bit division

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Tuesday, February 26, 2008 - 11:47 pm

On Wed, 27 Feb 2008 08:22:07 +0200 Adrian Bunk <bunk@kernel.org> wrote:


well found.

Something like this:


--- a/include/linux/delay.h~a
+++ a/include/linux/delay.h
@@ -7,10 +7,12 @@
  * Delay routines, using a pre-computed "loops_per_jiffy" value.
  */
 
-extern unsigned long loops_per_jiffy;
+#include <linux/kernel.h>
 
 #include <asm/delay.h>
 
+extern unsigned long loops_per_jiffy;
+
 /*
  * Using udelay() for intervals greater than a few milliseconds can
  * risk overflow for high loops_per_jiffy (high bogomips) machines. The
@@ -32,7 +34,11 @@ extern unsigned long loops_per_jiffy;
 #endif
 
 #ifndef ndelay
-#define ndelay(x)	udelay(((x)+999)/1000)
+static inline void ndelay(unsigned long x)
+{
+	udelay(DIV_ROUND_UP(x, 1000));
+}
+#define ndelay(x) ndelay(x)
 #endif
 
 void calibrate_delay(void);
_


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [2.6.25 patch] drivers/crypto/hifn_795x.c: fix 64bit d ..., Martin Michlmayr, (Tue Feb 26, 10:20 am)
Re: [2.6.25 patch] drivers/crypto/hifn_795x.c: fix 64bit d ..., Evgeniy Polyakov, (Tue Feb 26, 11:52 am)
Re: [2.6.25 patch] drivers/crypto/hifn_795x.c: fix 64bit d ..., Andrew Morton, (Tue Feb 26, 11:47 pm)