MIPS: Fix mdelay(1) for 64bit kernel with HZ == 1000 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> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Atsushi Nemoto and committed by
f12555d2 6c355852

+2 -4
+2 -4
include/asm-mips/delay.h
··· 52 52 unsigned long lo; 53 53 54 54 /* 55 - * The common rates of 1000 and 128 are rounded wrongly by the 56 - * catchall case for 64-bit. Excessive precission? Probably ... 55 + * The rates of 128 is rounded wrongly by the catchall case 56 + * for 64-bit. Excessive precission? Probably ... 57 57 */ 58 58 #if defined(CONFIG_64BIT) && (HZ == 128) 59 59 usecs *= 0x0008637bd05af6c7UL; /* 2**64 / (1000000 / HZ) */ 60 - #elif defined(CONFIG_64BIT) && (HZ == 1000) 61 - usecs *= 0x004189374BC6A7f0UL; /* 2**64 / (1000000 / HZ) */ 62 60 #elif defined(CONFIG_64BIT) 63 61 usecs *= (0x8000000000000000UL / (500000 / HZ)); 64 62 #else /* 32-bit junk follows here */