Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] define MAX_UDELAY_MS
@ 2005-11-04 17:02 Atsushi Nemoto
  2005-11-04 17:18 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Atsushi Nemoto @ 2005-11-04 17:02 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

If HZ was 1000, mdelay(2) cause overflow on multiplication in
__udelay.  We should define MAX_UDELAY_MS properly to prevent this.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -84,4 +84,13 @@ static inline void __udelay(unsigned lon
 
 #define udelay(usecs) __udelay((usecs),__udelay_val)
 
+/* make sure "usecs *= ..." in udelay do not overflow. */
+#if HZ >= 1000
+#define MAX_UDELAY_MS	1
+#elif HZ <= 200
+#define MAX_UDELAY_MS	5
+#else
+#define MAX_UDELAY_MS	(1000 / HZ)
+#endif
+
 #endif /* _ASM_DELAY_H */

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

* Re: [PATCH] define MAX_UDELAY_MS
  2005-11-04 17:02 [PATCH] define MAX_UDELAY_MS Atsushi Nemoto
@ 2005-11-04 17:18 ` Ralf Baechle
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2005-11-04 17:18 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Sat, Nov 05, 2005 at 02:02:54AM +0900, Atsushi Nemoto wrote:

> If HZ was 1000, mdelay(2) cause overflow on multiplication in
> __udelay.  We should define MAX_UDELAY_MS properly to prevent this.

Applied,

  Ralf

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

end of thread, other threads:[~2005-11-04 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-04 17:02 [PATCH] define MAX_UDELAY_MS Atsushi Nemoto
2005-11-04 17:18 ` Ralf Baechle

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