All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix mdelay(1) for 64bit kernel with HZ == 1000
@ 2005-11-30  4:33 Atsushi Nemoto
  2005-12-05 14:35 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Atsushi Nemoto @ 2005-11-30  4:33 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

mdelay(1) (i.e. udelay(1000)) does not work correctly due to overflow.

1000 * 0x004189374BC6A7f0 = 0x10000000000000180 (>= 2**64)

0x004189374BC6A7ef (0x004189374BC6A7f0 - 1) is OK and it is exactly
same as catchall case (0x8000000000000000UL / (500000 / HZ)).

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

diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index 48d00cc..64dd451 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -52,13 +52,11 @@ static inline void __udelay(unsigned lon
 	unsigned long lo;
 
 	/*
-	 * The common rates of 1000 and 128 are rounded wrongly by the
-	 * catchall case for 64-bit.  Excessive precission?  Probably ...
+	 * The rates of 128 is rounded wrongly by the catchall case
+	 * for 64-bit.  Excessive precission?  Probably ...
 	 */
 #if defined(CONFIG_64BIT) && (HZ == 128)
 	usecs *= 0x0008637bd05af6c7UL;		/* 2**64 / (1000000 / HZ) */
-#elif defined(CONFIG_64BIT) && (HZ == 1000)
-	usecs *= 0x004189374BC6A7f0UL;		/* 2**64 / (1000000 / HZ) */
 #elif defined(CONFIG_64BIT)
 	usecs *= (0x8000000000000000UL / (500000 / HZ));
 #else /* 32-bit junk follows here */

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

* Re: [PATCH] fix mdelay(1) for 64bit kernel with HZ == 1000
  2005-11-30  4:33 [PATCH] fix mdelay(1) for 64bit kernel with HZ == 1000 Atsushi Nemoto
@ 2005-12-05 14:35 ` Ralf Baechle
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2005-12-05 14:35 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Wed, Nov 30, 2005 at 01:33:26PM +0900, Atsushi Nemoto wrote:

> mdelay(1) (i.e. udelay(1000)) does not work correctly due to overflow.
> 
> 1000 * 0x004189374BC6A7f0 = 0x10000000000000180 (>= 2**64)
> 
> 0x004189374BC6A7ef (0x004189374BC6A7f0 - 1) is OK and it is exactly
> same as catchall case (0x8000000000000000UL / (500000 / HZ)).
> 
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

Applied.

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

end of thread, other threads:[~2005-12-05 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-30  4:33 [PATCH] fix mdelay(1) for 64bit kernel with HZ == 1000 Atsushi Nemoto
2005-12-05 14:35 ` Ralf Baechle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.