public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] delay: s/#include <asm/delay.h>/#include <linux/delay.h>/
       [not found] <200609220955.35826.vda.linux@googlemail.com>
@ 2006-09-22  7:57 ` Denis Vlasenko
  2006-09-22  7:58   ` [PATCH 2/3] delay: remove references to MAX_UDELAY_MS; fix comment Denis Vlasenko
  0 siblings, 1 reply; 5+ messages in thread
From: Denis Vlasenko @ 2006-09-22  7:57 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Russell King

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

A few arch files won't see the definition of udelay()
in asm/delay.h anymore. Prevent that from biting us later.

Signed-off-by: Denis Vlasenko <vda.linux@googlemail.com>
--
vda

[-- Attachment #2: delay8.1.patch --]
[-- Type: text/x-diff, Size: 15765 bytes --]

diff -urpN linux-2.6.18/arch/alpha/kernel/core_t2.c linux-2.6.18.new.1/arch/alpha/kernel/core_t2.c
--- linux-2.6.18/arch/alpha/kernel/core_t2.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/alpha/kernel/core_t2.c	2006-09-21 23:57:45.000000000 +0200
@@ -18,9 +18,9 @@
 #include <linux/pci.h>
 #include <linux/sched.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 
 #include <asm/ptrace.h>
-#include <asm/delay.h>
 
 #include "proto.h"
 #include "pci_impl.h"
diff -urpN linux-2.6.18/arch/arm/mach-integrator/platsmp.c linux-2.6.18.new.1/arch/arm/mach-integrator/platsmp.c
--- linux-2.6.18/arch/arm/mach-integrator/platsmp.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/arm/mach-integrator/platsmp.c	2006-09-21 23:57:45.000000000 +0200
@@ -13,10 +13,10 @@
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
+#include <linux/delay.h>
 
 #include <asm/atomic.h>
 #include <asm/cacheflush.h>
-#include <asm/delay.h>
 #include <asm/mmu_context.h>
 #include <asm/procinfo.h>
 #include <asm/ptrace.h>
diff -urpN linux-2.6.18/arch/arm/mach-omap2/board-h4.c linux-2.6.18.new.1/arch/arm/mach-omap2/board-h4.c
--- linux-2.6.18/arch/arm/mach-omap2/board-h4.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/arm/mach-omap2/board-h4.c	2006-09-21 23:57:45.000000000 +0200
@@ -19,6 +19,7 @@
 #include <linux/delay.h>
 #include <linux/workqueue.h>
 #include <linux/input.h>
+#include <linux/delay.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
@@ -39,7 +40,6 @@
 #include "prcm-regs.h"
 
 #include <asm/io.h>
-#include <asm/delay.h>
 
 static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 };
 static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 };
diff -urpN linux-2.6.18/arch/arm/plat-omap/mcbsp.c linux-2.6.18.new.1/arch/arm/plat-omap/mcbsp.c
--- linux-2.6.18/arch/arm/plat-omap/mcbsp.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/arm/plat-omap/mcbsp.c	2006-09-21 23:57:45.000000000 +0200
@@ -20,8 +20,8 @@
 #include <linux/interrupt.h>
 #include <linux/err.h>
 #include <linux/clk.h>
+#include <linux/delay.h>
 
-#include <asm/delay.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 
diff -urpN linux-2.6.18/arch/cris/arch-v10/drivers/i2c.c linux-2.6.18.new.1/arch/cris/arch-v10/drivers/i2c.c
--- linux-2.6.18/arch/cris/arch-v10/drivers/i2c.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/cris/arch-v10/drivers/i2c.c	2006-09-21 23:59:25.000000000 +0200
@@ -96,13 +96,13 @@
 #include <linux/fs.h>
 #include <linux/string.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 
 #include <asm/etraxi2c.h>
 
 #include <asm/system.h>
 #include <asm/arch/svinto.h>
 #include <asm/io.h>
-#include <asm/delay.h>
 #include <asm/arch/io_interface_mux.h>
 
 #include "i2c.h"
diff -urpN linux-2.6.18/arch/cris/arch-v32/drivers/i2c.c linux-2.6.18.new.1/arch/cris/arch-v32/drivers/i2c.c
--- linux-2.6.18/arch/cris/arch-v32/drivers/i2c.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/cris/arch-v32/drivers/i2c.c	2006-09-21 23:58:59.000000000 +0200
@@ -33,12 +33,12 @@
 #include <linux/fs.h>
 #include <linux/string.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 
 #include <asm/etraxi2c.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
-#include <asm/delay.h>
 
 #include "i2c.h"
 
diff -urpN linux-2.6.18/arch/cris/arch-v32/kernel/smp.c linux-2.6.18.new.1/arch/cris/arch-v32/kernel/smp.c
--- linux-2.6.18/arch/cris/arch-v32/kernel/smp.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/cris/arch-v32/kernel/smp.c	2006-09-21 23:57:45.000000000 +0200
@@ -1,4 +1,3 @@
-#include <asm/delay.h>
 #include <asm/arch/irq.h>
 #include <asm/arch/hwregs/intr_vect.h>
 #include <asm/arch/hwregs/intr_vect_defs.h>
@@ -8,6 +7,7 @@
 #include <asm/arch/hwregs/supp_reg.h>
 #include <asm/atomic.h>
 
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/timex.h>
diff -urpN linux-2.6.18/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c linux-2.6.18.new.1/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
--- linux-2.6.18/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	2006-09-21 23:57:45.000000000 +0200
@@ -32,8 +32,8 @@
 #include <linux/seq_file.h>
 #include <linux/compiler.h>
 #include <linux/sched.h>	/* current */
+#include <linux/delay.h>
 #include <asm/io.h>
-#include <asm/delay.h>
 #include <asm/uaccess.h>
 
 #include <linux/acpi.h>
diff -urpN linux-2.6.18/arch/i386/kernel/cpu/cpufreq/powernow-k8.c linux-2.6.18.new.1/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
--- linux-2.6.18/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	2006-09-21 23:57:45.000000000 +0200
@@ -33,10 +33,10 @@
 #include <linux/string.h>
 #include <linux/cpumask.h>
 #include <linux/sched.h>	/* for current / set_cpus_allowed() */
+#include <linux/delay.h>
 
 #include <asm/msr.h>
 #include <asm/io.h>
-#include <asm/delay.h>
 
 #ifdef CONFIG_X86_POWERNOW_K8_ACPI
 #include <linux/acpi.h>
diff -urpN linux-2.6.18/arch/i386/kernel/i8259.c linux-2.6.18.new.1/arch/i386/kernel/i8259.c
--- linux-2.6.18/arch/i386/kernel/i8259.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/i386/kernel/i8259.c	2006-09-21 23:57:45.000000000 +0200
@@ -10,6 +10,7 @@
 #include <linux/kernel_stat.h>
 #include <linux/sysdev.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <asm/8253pit.h>
 #include <asm/atomic.h>
@@ -17,7 +18,6 @@
 #include <asm/io.h>
 #include <asm/timer.h>
 #include <asm/pgtable.h>
-#include <asm/delay.h>
 #include <asm/desc.h>
 #include <asm/apic.h>
 #include <asm/arch_hooks.h>
diff -urpN linux-2.6.18/arch/i386/kernel/reboot_fixups.c linux-2.6.18.new.1/arch/i386/kernel/reboot_fixups.c
--- linux-2.6.18/arch/i386/kernel/reboot_fixups.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/i386/kernel/reboot_fixups.c	2006-09-21 23:57:45.000000000 +0200
@@ -8,7 +8,7 @@
  *
  */
 
-#include <asm/delay.h>
+#include <linux/delay.h>
 #include <linux/pci.h>
 #include <linux/reboot_fixups.h>
 
diff -urpN linux-2.6.18/arch/i386/lib/delay.c linux-2.6.18.new.1/arch/i386/lib/delay.c
--- linux-2.6.18/arch/i386/lib/delay.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/i386/lib/delay.c	2006-09-21 23:59:50.000000000 +0200
@@ -16,7 +16,6 @@
 #include <linux/delay.h>
 
 #include <asm/processor.h>
-#include <asm/delay.h>
 #include <asm/timer.h>
 
 #ifdef CONFIG_SMP
diff -urpN linux-2.6.18/arch/ia64/kernel/mca.c linux-2.6.18.new.1/arch/ia64/kernel/mca.c
--- linux-2.6.18/arch/ia64/kernel/mca.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/ia64/kernel/mca.c	2006-09-21 23:58:07.000000000 +0200
@@ -69,8 +69,8 @@
 #include <linux/smp.h>
 #include <linux/workqueue.h>
 #include <linux/cpumask.h>
+#include <linux/delay.h>
 
-#include <asm/delay.h>
 #include <asm/kdebug.h>
 #include <asm/machvec.h>
 #include <asm/meminit.h>
diff -urpN linux-2.6.18/arch/ia64/kernel/smpboot.c linux-2.6.18.new.1/arch/ia64/kernel/smpboot.c
--- linux-2.6.18/arch/ia64/kernel/smpboot.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/ia64/kernel/smpboot.c	2006-09-21 23:58:07.000000000 +0200
@@ -40,11 +40,11 @@
 #include <linux/efi.h>
 #include <linux/percpu.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <asm/atomic.h>
 #include <asm/cache.h>
 #include <asm/current.h>
-#include <asm/delay.h>
 #include <asm/ia32.h>
 #include <asm/io.h>
 #include <asm/irq.h>
diff -urpN linux-2.6.18/arch/mips/galileo-boards/ev96100/setup.c linux-2.6.18.new.1/arch/mips/galileo-boards/ev96100/setup.c
--- linux-2.6.18/arch/mips/galileo-boards/ev96100/setup.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/mips/galileo-boards/ev96100/setup.c	2006-09-21 23:58:07.000000000 +0200
@@ -38,12 +38,12 @@
 #include <linux/string.h>
 #include <linux/ctype.h>
 #include <linux/pci.h>
+#include <linux/delay.h>
 
 #include <asm/cpu.h>
 #include <asm/bootinfo.h>
 #include <asm/mipsregs.h>
 #include <asm/irq.h>
-#include <asm/delay.h>
 #include <asm/gt64120.h>
 #include <asm/galileo-boards/ev96100int.h>
 
diff -urpN linux-2.6.18/arch/mips/pci/ops-gt96100.c linux-2.6.18.new.1/arch/mips/pci/ops-gt96100.c
--- linux-2.6.18/arch/mips/pci/ops-gt96100.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/mips/pci/ops-gt96100.c	2006-09-21 23:58:07.000000000 +0200
@@ -37,8 +37,8 @@
 #include <linux/pci.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 
-#include <asm/delay.h>
 #include <asm/gt64120.h>
 #include <asm/galileo-boards/ev96100.h>
 
diff -urpN linux-2.6.18/arch/parisc/kernel/smp.c linux-2.6.18.new.1/arch/parisc/kernel/smp.c
--- linux-2.6.18/arch/parisc/kernel/smp.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/parisc/kernel/smp.c	2006-09-21 23:58:07.000000000 +0200
@@ -33,11 +33,11 @@
 #include <linux/mm.h>
 #include <linux/delay.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <asm/system.h>
 #include <asm/atomic.h>
 #include <asm/current.h>
-#include <asm/delay.h>
 #include <asm/tlbflush.h>
 
 #include <asm/io.h>
diff -urpN linux-2.6.18/arch/powerpc/kernel/rtas.c linux-2.6.18.new.1/arch/powerpc/kernel/rtas.c
--- linux-2.6.18/arch/powerpc/kernel/rtas.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/powerpc/kernel/rtas.c	2006-09-21 23:58:07.000000000 +0200
@@ -29,7 +29,6 @@
 #include <asm/page.h>
 #include <asm/param.h>
 #include <asm/system.h>
-#include <asm/delay.h>
 #include <asm/uaccess.h>
 #include <asm/lmb.h>
 #include <asm/udbg.h>
diff -urpN linux-2.6.18/arch/powerpc/kernel/rtas_flash.c linux-2.6.18.new.1/arch/powerpc/kernel/rtas_flash.c
--- linux-2.6.18/arch/powerpc/kernel/rtas_flash.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/powerpc/kernel/rtas_flash.c	2006-09-21 23:58:07.000000000 +0200
@@ -16,7 +16,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/proc_fs.h>
-#include <asm/delay.h>
+#include <linux/delay.h>
 #include <asm/uaccess.h>
 #include <asm/rtas.h>
 #include <asm/abs_addr.h>
diff -urpN linux-2.6.18/arch/ppc/platforms/mpc885ads_setup.c linux-2.6.18.new.1/arch/ppc/platforms/mpc885ads_setup.c
--- linux-2.6.18/arch/ppc/platforms/mpc885ads_setup.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/ppc/platforms/mpc885ads_setup.c	2006-09-21 23:58:07.000000000 +0200
@@ -17,12 +17,12 @@
 #include <linux/string.h>
 #include <linux/ioport.h>
 #include <linux/device.h>
+#include <linux/delay.h>
 
 #include <linux/fs_enet_pd.h>
 #include <linux/fs_uart_pd.h>
 #include <linux/mii.h>
 
-#include <asm/delay.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
 #include <asm/page.h>
diff -urpN linux-2.6.18/arch/ppc/syslib/mpc52xx_pci.c linux-2.6.18.new.1/arch/ppc/syslib/mpc52xx_pci.c
--- linux-2.6.18/arch/ppc/syslib/mpc52xx_pci.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/ppc/syslib/mpc52xx_pci.c	2006-09-22 00:00:16.000000000 +0200
@@ -11,13 +11,13 @@
  * kind, whether express or implied.
  */
 
+#include <linux/delay.h>
 
 #include <asm/pci.h>
 
 #include <asm/mpc52xx.h>
 #include "mpc52xx_pci.h"
 
-#include <asm/delay.h>
 #include <asm/machdep.h>
 
 
diff -urpN linux-2.6.18/arch/ppc/syslib/mv64x60_dbg.c linux-2.6.18.new.1/arch/ppc/syslib/mv64x60_dbg.c
--- linux-2.6.18/arch/ppc/syslib/mv64x60_dbg.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/ppc/syslib/mv64x60_dbg.c	2006-09-21 23:58:07.000000000 +0200
@@ -19,7 +19,7 @@
 
 
 #include <linux/irq.h>
-#include <asm/delay.h>
+#include <linux/delay.h>
 #include <asm/mv64x60.h>
 #include <asm/machdep.h>
 
diff -urpN linux-2.6.18/arch/ppc/syslib/ppc83xx_setup.c linux-2.6.18.new.1/arch/ppc/syslib/ppc83xx_setup.c
--- linux-2.6.18/arch/ppc/syslib/ppc83xx_setup.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/ppc/syslib/ppc83xx_setup.c	2006-09-21 23:58:07.000000000 +0200
@@ -30,13 +30,13 @@
 #include <linux/tty.h>	/* for linux/serial_core.h */
 #include <linux/serial_core.h>
 #include <linux/serial_8250.h>
+#include <linux/delay.h>
 
 #include <asm/time.h>
 #include <asm/mpc83xx.h>
 #include <asm/mmu.h>
 #include <asm/ppc_sys.h>
 #include <asm/kgdb.h>
-#include <asm/delay.h>
 #include <asm/machdep.h>
 
 #include <syslib/ppc83xx_setup.h>
diff -urpN linux-2.6.18/arch/sparc/kernel/process.c linux-2.6.18.new.1/arch/sparc/kernel/process.c
--- linux-2.6.18/arch/sparc/kernel/process.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/sparc/kernel/process.c	2006-09-21 23:58:07.000000000 +0200
@@ -28,6 +28,7 @@
 #include <linux/delay.h>
 #include <linux/pm.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 
 #include <asm/auxio.h>
 #include <asm/oplib.h>
@@ -36,7 +37,6 @@
 #include <asm/page.h>
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
-#include <asm/delay.h>
 #include <asm/processor.h>
 #include <asm/psr.h>
 #include <asm/elf.h>
diff -urpN linux-2.6.18/arch/sparc/kernel/sun4d_smp.c linux-2.6.18.new.1/arch/sparc/kernel/sun4d_smp.c
--- linux-2.6.18/arch/sparc/kernel/sun4d_smp.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/sparc/kernel/sun4d_smp.c	2006-09-21 23:58:07.000000000 +0200
@@ -20,11 +20,11 @@
 #include <linux/mm.h>
 #include <linux/swap.h>
 #include <linux/profile.h>
+#include <linux/delay.h>
 
 #include <asm/ptrace.h>
 #include <asm/atomic.h>
 
-#include <asm/delay.h>
 #include <asm/irq.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
diff -urpN linux-2.6.18/arch/sparc/kernel/sun4m_smp.c linux-2.6.18.new.1/arch/sparc/kernel/sun4m_smp.c
--- linux-2.6.18/arch/sparc/kernel/sun4m_smp.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/sparc/kernel/sun4m_smp.c	2006-09-21 23:58:07.000000000 +0200
@@ -17,13 +17,13 @@
 #include <linux/mm.h>
 #include <linux/swap.h>
 #include <linux/profile.h>
+#include <linux/delay.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 
 #include <asm/ptrace.h>
 #include <asm/atomic.h>
 
-#include <asm/delay.h>
 #include <asm/irq.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
diff -urpN linux-2.6.18/arch/x86_64/kernel/i8259.c linux-2.6.18.new.1/arch/x86_64/kernel/i8259.c
--- linux-2.6.18/arch/x86_64/kernel/i8259.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/x86_64/kernel/i8259.c	2006-09-21 23:58:07.000000000 +0200
@@ -12,6 +12,7 @@
 #include <linux/kernel_stat.h>
 #include <linux/sysdev.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <asm/acpi.h>
 #include <asm/atomic.h>
@@ -19,7 +20,6 @@
 #include <asm/io.h>
 #include <asm/hw_irq.h>
 #include <asm/pgtable.h>
-#include <asm/delay.h>
 #include <asm/desc.h>
 #include <asm/apic.h>
 
diff -urpN linux-2.6.18/arch/x86_64/kernel/reboot.c linux-2.6.18.new.1/arch/x86_64/kernel/reboot.c
--- linux-2.6.18/arch/x86_64/kernel/reboot.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/x86_64/kernel/reboot.c	2006-09-21 23:58:07.000000000 +0200
@@ -7,9 +7,9 @@
 #include <linux/ctype.h>
 #include <linux/string.h>
 #include <linux/pm.h>
+#include <linux/delay.h>
 #include <asm/io.h>
 #include <asm/kdebug.h>
-#include <asm/delay.h>
 #include <asm/hw_irq.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
diff -urpN linux-2.6.18/arch/x86_64/lib/delay.c linux-2.6.18.new.1/arch/x86_64/lib/delay.c
--- linux-2.6.18/arch/x86_64/lib/delay.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.1/arch/x86_64/lib/delay.c	2006-09-21 23:58:07.000000000 +0200
@@ -12,7 +12,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/delay.h>
-#include <asm/delay.h>
+#include <linux/delay.h>
 #include <asm/msr.h>
 
 #ifdef CONFIG_SMP

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

* [PATCH 2/3] delay: remove references to MAX_UDELAY_MS; fix comment
  2006-09-22  7:57 ` [PATCH 1/3] delay: s/#include <asm/delay.h>/#include <linux/delay.h>/ Denis Vlasenko
@ 2006-09-22  7:58   ` Denis Vlasenko
  2006-09-22  8:00     ` [PATCH 3/3] delay: add generic udelay(), mdelay() and ssleep() Denis Vlasenko
  0 siblings, 1 reply; 5+ messages in thread
From: Denis Vlasenko @ 2006-09-22  7:58 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Russell King

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

We are going to kill MAX_UDELAY_MS, so replace it
in common code with 1. Also fix a buglet on the way:
mpc83xx_spi->nsecs > MAX_UDELAY_MS * 1000
was comparing nanoseconds to microseconds.

Signed-off-by: Denis Vlasenko <vda.linux@googlemail.com>
--
vda

[-- Attachment #2: delay8.2.patch --]
[-- Type: text/x-diff, Size: 2356 bytes --]

diff -urpN linux-2.6.18.new.1/drivers/scsi/ipr.c linux-2.6.18.new.2/drivers/scsi/ipr.c
--- linux-2.6.18.new.1/drivers/scsi/ipr.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.2/drivers/scsi/ipr.c	2006-09-22 00:00:48.000000000 +0200
@@ -1596,11 +1596,7 @@ static int ipr_wait_iodbg_ack(struct ipr
 		if (pcii_reg & IPR_PCII_IO_DEBUG_ACKNOWLEDGE)
 			return 0;
 
-		/* udelay cannot be used if delay is more than a few milliseconds */
-		if ((delay / 1000) > MAX_UDELAY_MS)
-			mdelay(delay / 1000);
-		else
-			udelay(delay);
+		udelay(delay);
 
 		delay += delay;
 	}
diff -urpN linux-2.6.18.new.1/drivers/spi/spi_bitbang.c linux-2.6.18.new.2/drivers/spi/spi_bitbang.c
--- linux-2.6.18.new.1/drivers/spi/spi_bitbang.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.2/drivers/spi/spi_bitbang.c	2006-09-22 00:00:48.000000000 +0200
@@ -168,7 +168,7 @@ int spi_bitbang_setup_transfer(struct sp
 		hz = spi->max_speed_hz;
 	if (hz) {
 		cs->nsecs = (1000000000/2) / hz;
-		if (cs->nsecs > (MAX_UDELAY_MS * 1000 * 1000))
+		if (cs->nsecs > (1000 * 1000))
 			return -EINVAL;
 	}
 
diff -urpN linux-2.6.18.new.1/drivers/spi/spi_mpc83xx.c linux-2.6.18.new.2/drivers/spi/spi_mpc83xx.c
--- linux-2.6.18.new.1/drivers/spi/spi_mpc83xx.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.2/drivers/spi/spi_mpc83xx.c	2006-09-22 00:00:48.000000000 +0200
@@ -211,7 +211,7 @@ int mpc83xx_spi_setup_transfer(struct sp
 	if (!hz)
 		hz = spi->max_speed_hz;
 	mpc83xx_spi->nsecs = (1000000000 / 2) / hz;
-	if (mpc83xx_spi->nsecs > MAX_UDELAY_MS * 1000)
+	if (mpc83xx_spi->nsecs > (1000 * 1000))
 		return -EINVAL;
 
 	if (bits_per_word == 32)
diff -urpN linux-2.6.18.new.1/include/asm-parisc/delay.h linux-2.6.18.new.2/include/asm-parisc/delay.h
--- linux-2.6.18.new.1/include/asm-parisc/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.2/include/asm-parisc/delay.h	2006-09-22 00:00:48.000000000 +0200
@@ -24,9 +24,8 @@ static __inline__ void __cr16_delay(unsi
 
 	/*
 	 * Note: Due to unsigned math, cr16 rollovers shouldn't be
-	 * a problem here. However, on 32 bit, we need to make sure
-	 * we don't pass in too big a value. The current default
-	 * value of MAX_UDELAY_MS should help prevent this.
+	 * a problem here. On 32 bit, we are protected in udelay()
+	 * from passing in too big a value.
 	 */
 
 	start = mfctl(16);

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

* [PATCH 3/3] delay: add generic udelay(), mdelay() and ssleep()
  2006-09-22  7:58   ` [PATCH 2/3] delay: remove references to MAX_UDELAY_MS; fix comment Denis Vlasenko
@ 2006-09-22  8:00     ` Denis Vlasenko
  2006-09-22  9:36       ` Russell King
  0 siblings, 1 reply; 5+ messages in thread
From: Denis Vlasenko @ 2006-09-22  8:00 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Russell King

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

This patch does the following:
* make it so than asm/delay.h does not define udelay(),
  only __udelay(), to be used in generic udelay()
* add generic udelay() which calls __udelay() repeatedly
  as needed. Protect against overflow in udelay() argument.
* similarly for mdelay() and ssleep()
* __const_udelay for all arches is removed or renamed to
  __const_delay (it did not do microsecond delays anyway)
  if still used by arch ndelay() function/macro
* remove EXPORT_SYMBOL(__udelay). It is not used in modules
  anymore
* remove MAX_UDELAY_MS

We specifically do not touch ndelay() in these patches.

Signed-off-by: Denis Vlasenko <vda.linux@googlemail.com>
--
vda

[-- Attachment #2: delay8.3.patch --]
[-- Type: text/x-diff, Size: 32618 bytes --]

diff -urpN linux-2.6.18.new.2/arch/arm/kernel/armksyms.c linux-2.6.18.new.3/arch/arm/kernel/armksyms.c
--- linux-2.6.18.new.2/arch/arm/kernel/armksyms.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/arm/kernel/armksyms.c	2006-09-22 02:30:27.000000000 +0200
@@ -70,10 +70,6 @@ EXPORT_SYMBOL_ALIAS(fp_send_sig,send_sig
 
 EXPORT_SYMBOL(__backtrace);
 
-	/* platform dependent support */
-EXPORT_SYMBOL(__udelay);
-EXPORT_SYMBOL(__const_udelay);
-
 	/* networking */
 EXPORT_SYMBOL(csum_partial);
 EXPORT_SYMBOL(csum_partial_copy_nocheck);
diff -urpN linux-2.6.18.new.2/arch/arm/lib/delay.S linux-2.6.18.new.3/arch/arm/lib/delay.S
--- linux-2.6.18.new.2/arch/arm/lib/delay.S	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/arm/lib/delay.S	2006-09-22 02:30:27.000000000 +0200
@@ -24,7 +24,7 @@
 ENTRY(__udelay)
 		ldr	r2, .LC1
 		mul	r0, r2, r0
-ENTRY(__const_udelay)				@ 0 <= r0 <= 0x7fffff06
+						@ 0 <= r0 <= 0x7fffff06
 		ldr	r2, .LC0
 		ldr	r2, [r2]		@ max = 0x01ffffff
 		mov	r0, r0, lsr #14		@ max = 0x0001ffff
diff -urpN linux-2.6.18.new.2/arch/i386/lib/delay.c linux-2.6.18.new.3/arch/i386/lib/delay.c
--- linux-2.6.18.new.2/arch/i386/lib/delay.c	2006-09-21 23:59:50.000000000 +0200
+++ linux-2.6.18.new.3/arch/i386/lib/delay.c	2006-09-22 02:30:27.000000000 +0200
@@ -74,7 +74,8 @@ void __delay(unsigned long loops)
 	delay_fn(loops);
 }
 
-inline void __const_udelay(unsigned long xloops)
+/* cannot be static: ndelay macro needs it */
+inline void __const_delay(unsigned long xloops)
 {
 	int d0;
 
@@ -89,15 +90,14 @@ inline void __const_udelay(unsigned long
 
 void __udelay(unsigned long usecs)
 {
-	__const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */
+	__const_delay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */
 }
 
 void __ndelay(unsigned long nsecs)
 {
-	__const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
+	__const_delay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
 }
 
 EXPORT_SYMBOL(__delay);
-EXPORT_SYMBOL(__const_udelay);
-EXPORT_SYMBOL(__udelay);
+EXPORT_SYMBOL(__const_delay);
 EXPORT_SYMBOL(__ndelay);
diff -urpN linux-2.6.18.new.2/arch/m32r/kernel/m32r_ksyms.c linux-2.6.18.new.3/arch/m32r/kernel/m32r_ksyms.c
--- linux-2.6.18.new.2/arch/m32r/kernel/m32r_ksyms.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/m32r/kernel/m32r_ksyms.c	2006-09-22 02:30:27.000000000 +0200
@@ -30,9 +30,7 @@ EXPORT_SYMBOL(__down_trylock);
 
 /* Networking helper routines. */
 /* Delay loops */
-EXPORT_SYMBOL(__udelay);
 EXPORT_SYMBOL(__delay);
-EXPORT_SYMBOL(__const_udelay);
 
 EXPORT_SYMBOL(strncpy_from_user);
 EXPORT_SYMBOL(__strncpy_from_user);
diff -urpN linux-2.6.18.new.2/arch/m32r/lib/delay.c linux-2.6.18.new.3/arch/m32r/lib/delay.c
--- linux-2.6.18.new.2/arch/m32r/lib/delay.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/m32r/lib/delay.c	2006-09-22 02:30:27.000000000 +0200
@@ -57,7 +57,7 @@ void __delay(unsigned long loops)
 #endif
 }
 
-void __const_udelay(unsigned long xloops)
+void __const_delay(unsigned long xloops)
 {
 #if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
 	/*
@@ -116,10 +116,10 @@ void __const_udelay(unsigned long xloops
 
 void __udelay(unsigned long usecs)
 {
-	__const_udelay(usecs * 0x000010c7);  /* 2**32 / 1000000 (rounded up) */
+	__const_delay(usecs * 0x000010c7);  /* 2**32 / 1000000 (rounded up) */
 }
 
 void __ndelay(unsigned long nsecs)
 {
-	__const_udelay(nsecs * 0x00005);  /* 2**32 / 1000000000 (rounded up) */
+	__const_delay(nsecs * 0x00005);  /* 2**32 / 1000000000 (rounded up) */
 }
diff -urpN linux-2.6.18.new.2/arch/m68knommu/lib/delay.c linux-2.6.18.new.3/arch/m68knommu/lib/delay.c
--- linux-2.6.18.new.2/arch/m68knommu/lib/delay.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/m68knommu/lib/delay.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,21 +0,0 @@
-/*
- *	arch/m68knommu/lib/delay.c
- *
- *	(C) Copyright 2004, Greg Ungerer <gerg@snapgear.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/module.h>
-#include <asm/param.h>
-#include <asm/delay.h>
-
-EXPORT_SYMBOL(udelay);
-
-void udelay(unsigned long usecs)
-{
-	_udelay(usecs);
-}
-
diff -urpN linux-2.6.18.new.2/arch/m68knommu/lib/Makefile linux-2.6.18.new.3/arch/m68knommu/lib/Makefile
--- linux-2.6.18.new.2/arch/m68knommu/lib/Makefile	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/m68knommu/lib/Makefile	2006-09-22 02:30:27.000000000 +0200
@@ -4,4 +4,4 @@
 
 lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o \
 	   muldi3.o mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
-	   checksum.o semaphore.o memcpy.o memset.o delay.o
+	   checksum.o semaphore.o memcpy.o memset.o
diff -urpN linux-2.6.18.new.2/arch/powerpc/kernel/time.c linux-2.6.18.new.3/arch/powerpc/kernel/time.c
--- linux-2.6.18.new.2/arch/powerpc/kernel/time.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/powerpc/kernel/time.c	2006-09-22 02:30:27.000000000 +0200
@@ -368,11 +368,11 @@ void __delay(unsigned long loops)
 }
 EXPORT_SYMBOL(__delay);
 
-void udelay(unsigned long usecs)
+void __udelay(unsigned long usecs)
 {
 	__delay(tb_ticks_per_usec * usecs);
 }
-EXPORT_SYMBOL(udelay);
+EXPORT_SYMBOL(__udelay);
 
 static __inline__ void timer_check_rtc(void)
 {
diff -urpN linux-2.6.18.new.2/arch/sh/kernel/sh_ksyms.c linux-2.6.18.new.3/arch/sh/kernel/sh_ksyms.c
--- linux-2.6.18.new.2/arch/sh/kernel/sh_ksyms.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/sh/kernel/sh_ksyms.c	2006-09-22 02:30:27.000000000 +0200
@@ -71,9 +71,8 @@ EXPORT_SYMBOL(__up);
 EXPORT_SYMBOL(__down);
 EXPORT_SYMBOL(__down_interruptible);
 
-EXPORT_SYMBOL(__udelay);
 EXPORT_SYMBOL(__ndelay);
-EXPORT_SYMBOL(__const_udelay);
+EXPORT_SYMBOL(__const_delay);
 
 EXPORT_SYMBOL(__div64_32);
 
diff -urpN linux-2.6.18.new.2/arch/sh/lib/delay.c linux-2.6.18.new.3/arch/sh/lib/delay.c
--- linux-2.6.18.new.2/arch/sh/lib/delay.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/sh/lib/delay.c	2006-09-22 02:30:27.000000000 +0200
@@ -19,7 +19,8 @@ void __delay(unsigned long loops)
 		: "t");
 }
 
-inline void __const_udelay(unsigned long xloops)
+/* cannot be static: ndelay macro needs it */
+inline void __const_delay(unsigned long xloops)
 {
 	__asm__("dmulu.l	%0, %2\n\t"
 		"sts	mach, %0"
@@ -31,11 +32,10 @@ inline void __const_udelay(unsigned long
 
 void __udelay(unsigned long usecs)
 {
-	__const_udelay(usecs * 0x000010c6);  /* 2**32 / 1000000 */
+	__const_delay(usecs * 0x000010c6);  /* 2**32 / 1000000 */
 }
 
 void __ndelay(unsigned long nsecs)
 {
-	__const_udelay(nsecs * 0x00000005);
+	__const_delay(nsecs * 0x00000005);
 }
-
diff -urpN linux-2.6.18.new.2/arch/sh64/lib/udelay.c linux-2.6.18.new.3/arch/sh64/lib/udelay.c
--- linux-2.6.18.new.2/arch/sh64/lib/udelay.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/sh64/lib/udelay.c	2006-09-22 02:30:27.000000000 +0200
@@ -35,25 +35,24 @@ void __delay(int loops)
 			     :"0"(loops));
 }
 
-void __udelay(unsigned long long usecs, unsigned long lpj)
+static inline void __arch_udelay(unsigned long long usecs, unsigned long lpj)
 {
 	usecs *= (((unsigned long long) HZ << 32) / 1000000) * lpj;
 	__delay((long long) usecs >> 32);
 }
 
-void __ndelay(unsigned long long nsecs, unsigned long lpj)
+static inline void __arch_ndelay(unsigned long long nsecs, unsigned long lpj)
 {
 	nsecs *= (((unsigned long long) HZ << 32) / 1000000000) * lpj;
 	__delay((long long) nsecs >> 32);
 }
 
-void udelay(unsigned long usecs)
+void __udelay(unsigned long usecs)
 {
-	__udelay(usecs, loops_per_jiffy);
+	__arch_udelay(usecs, loops_per_jiffy);
 }
 
 void ndelay(unsigned long nsecs)
 {
-	__ndelay(nsecs, loops_per_jiffy);
+	__arch_ndelay(nsecs, loops_per_jiffy);
 }
-
diff -urpN linux-2.6.18.new.2/arch/sparc64/kernel/sparc64_ksyms.c linux-2.6.18.new.3/arch/sparc64/kernel/sparc64_ksyms.c
--- linux-2.6.18.new.2/arch/sparc64/kernel/sparc64_ksyms.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/sparc64/kernel/sparc64_ksyms.c	2006-09-22 02:30:27.000000000 +0200
@@ -334,7 +334,7 @@ EXPORT_SYMBOL(strncmp);
 /* Delay routines. */
 EXPORT_SYMBOL(__udelay);
 EXPORT_SYMBOL(__ndelay);
-EXPORT_SYMBOL(__const_udelay);
+EXPORT_SYMBOL(__const_delay);
 EXPORT_SYMBOL(__delay);
 
 void VISenter(void);
diff -urpN linux-2.6.18.new.2/arch/sparc64/lib/delay.c linux-2.6.18.new.3/arch/sparc64/lib/delay.c
--- linux-2.6.18.new.2/arch/sparc64/lib/delay.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/sparc64/lib/delay.c	2006-09-22 02:30:27.000000000 +0200
@@ -24,7 +24,7 @@ void __delay(unsigned long loops)
  * but that runs into problems for higher values of HZ and
  * slow cpus.
  */
-void __const_udelay(unsigned long n)
+void __const_delay(unsigned long n)
 {
 	n *= 4;
 
@@ -36,11 +36,11 @@ void __const_udelay(unsigned long n)
 
 void __udelay(unsigned long n)
 {
-	__const_udelay(n * 0x10c7UL);
+	__const_delay(n * 0x10c7UL);
 }
 
 
 void __ndelay(unsigned long n)
 {
-	__const_udelay(n * 0x5UL);
+	__const_delay(n * 0x5UL);
 }
diff -urpN linux-2.6.18.new.2/arch/um/sys-i386/delay.c linux-2.6.18.new.3/arch/um/sys-i386/delay.c
--- linux-2.6.18.new.2/arch/um/sys-i386/delay.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/um/sys-i386/delay.c	2006-09-22 02:30:27.000000000 +0200
@@ -25,16 +25,3 @@ void __udelay(unsigned long usecs)
         for(i=0;i<n;i++)
                 cpu_relax();
 }
-
-EXPORT_SYMBOL(__udelay);
-
-void __const_udelay(unsigned long usecs)
-{
-	int i, n;
-
-	n = (loops_per_jiffy * HZ * usecs) / MILLION;
-        for(i=0;i<n;i++)
-                cpu_relax();
-}
-
-EXPORT_SYMBOL(__const_udelay);
diff -urpN linux-2.6.18.new.2/arch/um/sys-x86_64/delay.c linux-2.6.18.new.3/arch/um/sys-x86_64/delay.c
--- linux-2.6.18.new.2/arch/um/sys-x86_64/delay.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/um/sys-x86_64/delay.c	2006-09-22 02:30:27.000000000 +0200
@@ -26,16 +26,3 @@ void __udelay(unsigned long usecs)
         for(i=0;i<n;i++)
                 cpu_relax();
 }
-
-EXPORT_SYMBOL(__udelay);
-
-void __const_udelay(unsigned long usecs)
-{
-	unsigned long i, n;
-
-	n = (loops_per_jiffy * HZ * usecs) / MILLION;
-        for(i=0;i<n;i++)
-                cpu_relax();
-}
-
-EXPORT_SYMBOL(__const_udelay);
diff -urpN linux-2.6.18.new.2/arch/x86_64/kernel/functionlist linux-2.6.18.new.3/arch/x86_64/kernel/functionlist
--- linux-2.6.18.new.2/arch/x86_64/kernel/functionlist	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/arch/x86_64/kernel/functionlist	2006-09-22 02:30:27.000000000 +0200
@@ -494,7 +494,7 @@
 *(.text.do_setitimer)
 *(.text.dev_queue_xmit_nit)
 *(.text.copy_from_read_buf)
-*(.text.__const_udelay)
+*(.text.__const_delay)
 *(.text.console_conditional_schedule)
 *(.text.wake_up_new_task)
 *(.text.wait_for_completion_interruptible)
diff -urpN linux-2.6.18.new.2/arch/x86_64/lib/delay.c linux-2.6.18.new.3/arch/x86_64/lib/delay.c
--- linux-2.6.18.new.2/arch/x86_64/lib/delay.c	2006-09-21 23:58:07.000000000 +0200
+++ linux-2.6.18.new.3/arch/x86_64/lib/delay.c	2006-09-22 02:30:43.000000000 +0200
@@ -39,20 +39,21 @@ void __delay(unsigned long loops)
 }
 EXPORT_SYMBOL(__delay);
 
-inline void __const_udelay(unsigned long xloops)
+/* cannot be static: ndelay macro needs it */
+inline void __const_delay(unsigned long xloops)
 {
 	__delay((xloops * HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32);
 }
-EXPORT_SYMBOL(__const_udelay);
+EXPORT_SYMBOL(__const_delay);
 
 void __udelay(unsigned long usecs)
 {
-	__const_udelay(usecs * 0x000010c6);  /* 2**32 / 1000000 */
+	__const_delay(usecs * 0x000010c6);  /* 2**32 / 1000000 */
 }
 EXPORT_SYMBOL(__udelay);
 
 void __ndelay(unsigned long nsecs)
 {
-	__const_udelay(nsecs * 0x00005);  /* 2**32 / 1000000000 (rounded up) */
+	__const_delay(nsecs * 0x00005);  /* 2**32 / 1000000000 (rounded up) */
 }
 EXPORT_SYMBOL(__ndelay);
diff -urpN linux-2.6.18.new.2/include/asm-arm/delay.h linux-2.6.18.new.3/include/asm-arm/delay.h
--- linux-2.6.18.new.2/include/asm-arm/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-arm/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -9,36 +9,6 @@
 #include <asm/param.h>	/* HZ */
 
 extern void __delay(int loops);
-
-/*
- * This function intentionally does not exist; if you see references to
- * it, it means that you're calling udelay() with an out of range value.
- *
- * With currently imposed limits, this means that we support a max delay
- * of 2000us. Further limits: HZ<=1000 and bogomips<=3355
- */
-extern void __bad_udelay(void);
-
-/*
- * division by multiplication: you don't have to worry about
- * loss of precision.
- *
- * Use only for very small delays ( < 1 msec).  Should probably use a
- * lookup table, really, as the multiplications take much too long with
- * short delays.  This is a "reasonable" implementation, though (and the
- * first constant multiplications gets optimized away if the delay is
- * a constant)
- */
 extern void __udelay(unsigned long usecs);
-extern void __const_udelay(unsigned long);
-
-#define MAX_UDELAY_MS 2
-
-#define udelay(n)							\
-	(__builtin_constant_p(n) ?					\
-	  ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() :		\
-			__const_udelay((n) * ((2199023U*HZ)>>11))) :	\
-	  __udelay(n))
 
 #endif /* defined(_ARM_DELAY_H) */
-
diff -urpN linux-2.6.18.new.2/include/asm-arm26/delay.h linux-2.6.18.new.3/include/asm-arm26/delay.h
--- linux-2.6.18.new.2/include/asm-arm26/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-arm26/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -21,14 +21,10 @@ extern void __delay(int loops);
  *
  * FIXME - lets improve it then...
  */
-extern void udelay(unsigned long usecs);
-
 static inline unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
 {
 	return a * b / c;
 }
 
-	
-
 #endif /* defined(_ARM_DELAY_H) */
 
diff -urpN linux-2.6.18.new.2/include/asm-cris/delay.h linux-2.6.18.new.3/include/asm-cris/delay.h
--- linux-2.6.18.new.2/include/asm-cris/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-cris/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -13,12 +13,9 @@
 
 extern unsigned long loops_per_usec; /* arch/cris/mm/init.c */
 
-static inline void udelay(unsigned long usecs)
+static inline void __udelay(unsigned long usecs)
 {
 	__delay(usecs * loops_per_usec);
 }
 
 #endif /* defined(_CRIS_DELAY_H) */
-
-
-
diff -urpN linux-2.6.18.new.2/include/asm-frv/delay.h linux-2.6.18.new.3/include/asm-frv/delay.h
--- linux-2.6.18.new.2/include/asm-frv/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-frv/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -40,11 +40,12 @@ static inline void __delay(unsigned long
 
 extern unsigned long loops_per_jiffy;
 
-static inline void udelay(unsigned long usecs)
+static inline void __udelay(unsigned long usecs)
 {
 	__delay(usecs * __delay_loops_MHz);
 }
 
+/* FIXME: looks like bug to me: */
 #define ndelay(n)	udelay((n) * 5)
 
 #endif /* _ASM_DELAY_H */
diff -urpN linux-2.6.18.new.2/include/asm-h8300/delay.h linux-2.6.18.new.3/include/asm-h8300/delay.h
--- linux-2.6.18.new.2/include/asm-h8300/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-h8300/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -27,7 +27,7 @@ extern __inline__ void __delay(unsigned 
 
 extern unsigned long loops_per_jiffy;
 
-extern __inline__ void udelay(unsigned long usecs)
+extern __inline__ void __udelay(unsigned long usecs)
 {
 	usecs *= 4295;		/* 2**32 / 1000000 */
 	usecs /= (loops_per_jiffy*HZ);
diff -urpN linux-2.6.18.new.2/include/asm-i386/delay.h linux-2.6.18.new.3/include/asm-i386/delay.h
--- linux-2.6.18.new.2/include/asm-i386/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-i386/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -7,20 +7,15 @@
  * Delay routines calling functions in arch/i386/lib/delay.c
  */
  
-extern void __bad_udelay(void);
 extern void __bad_ndelay(void);
 
 extern void __udelay(unsigned long usecs);
 extern void __ndelay(unsigned long nsecs);
-extern void __const_udelay(unsigned long usecs);
+extern void __const_delay(unsigned long usecs);
 extern void __delay(unsigned long loops);
 
-#define udelay(n) (__builtin_constant_p(n) ? \
-	((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \
-	__udelay(n))
-	
 #define ndelay(n) (__builtin_constant_p(n) ? \
-	((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
+	((n) > 20000 ? __bad_ndelay() : __const_delay((n) * 5ul)) : \
 	__ndelay(n))
 
 void use_tsc_delay(void);
diff -urpN linux-2.6.18.new.2/include/asm-ia64/delay.h linux-2.6.18.new.3/include/asm-ia64/delay.h
--- linux-2.6.18.new.2/include/asm-ia64/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-ia64/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -83,6 +83,4 @@ __delay (unsigned long loops)
 	ia64_delay_loop (loops - 1);
 }
 
-extern void udelay (unsigned long usecs);
-
 #endif /* _ASM_IA64_DELAY_H */
diff -urpN linux-2.6.18.new.2/include/asm-m32r/delay.h linux-2.6.18.new.3/include/asm-m32r/delay.h
--- linux-2.6.18.new.2/include/asm-m32r/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-m32r/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -9,20 +9,15 @@
  * Delay routines calling functions in arch/m32r/lib/delay.c
  */
 
-extern void __bad_udelay(void);
 extern void __bad_ndelay(void);
 
 extern void __udelay(unsigned long usecs);
 extern void __ndelay(unsigned long nsecs);
-extern void __const_udelay(unsigned long usecs);
+extern void __const_delay(unsigned long usecs);
 extern void __delay(unsigned long loops);
 
-#define udelay(n) (__builtin_constant_p(n) ? \
-	((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \
-	__udelay(n))
-
 #define ndelay(n) (__builtin_constant_p(n) ? \
-	((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
+	((n) > 20000 ? __bad_ndelay() : __const_delay((n) * 5ul)) : \
 	__ndelay(n))
 
 #endif /* _ASM_M32R_DELAY_H */
diff -urpN linux-2.6.18.new.2/include/asm-m68k/delay.h linux-2.6.18.new.3/include/asm-m68k/delay.h
--- linux-2.6.18.new.2/include/asm-m68k/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-m68k/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -15,8 +15,6 @@ static inline void __delay(unsigned long
 		: "=d" (loops) : "0" (loops));
 }
 
-extern void __bad_udelay(void);
-
 /*
  * Use only for very small delays ( < 1 msec).  Should probably use a
  * lookup table, really, as the multiplications take much too long with
@@ -24,7 +22,7 @@ extern void __bad_udelay(void);
  * first constant multiplications gets optimized away if the delay is
  * a constant)
  */
-static inline void __const_udelay(unsigned long xloops)
+static inline void __const_delay(unsigned long xloops)
 {
 	unsigned long tmp;
 
@@ -36,13 +34,9 @@ static inline void __const_udelay(unsign
 
 static inline void __udelay(unsigned long usecs)
 {
-	__const_udelay(usecs * 4295);	/* 2**32 / 1000000 */
+	__const_delay(usecs * 4295);	/* 2**32 / 1000000 */
 }
 
-#define udelay(n) (__builtin_constant_p(n) ? \
-	((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 4295)) : \
-	__udelay(n))
-
 static inline unsigned long muldiv(unsigned long a, unsigned long b,
 				   unsigned long c)
 {
diff -urpN linux-2.6.18.new.2/include/asm-m68knommu/delay.h linux-2.6.18.new.3/include/asm-m68knommu/delay.h
--- linux-2.6.18.new.2/include/asm-m68knommu/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-m68knommu/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -48,7 +48,7 @@ static inline void __delay(unsigned long
 
 extern unsigned long loops_per_jiffy;
 
-static inline void _udelay(unsigned long usecs)
+static inline void __udelay(unsigned long usecs)
 {
 #if defined(CONFIG_M68328) || defined(CONFIG_M68EZ328) || \
     defined(CONFIG_M68VZ328) || defined(CONFIG_M68360) || \
@@ -65,12 +65,4 @@ static inline void _udelay(unsigned long
 #endif
 }
 
-/*
- *	Moved the udelay() function into library code, no longer inlined.
- *	I had to change the algorithm because we are overflowing now on
- *	the faster ColdFire parts. The code is a little biger, so it makes
- *	sense to library it.
- */
-extern void udelay(unsigned long usecs);
-
 #endif /* defined(_M68KNOMMU_DELAY_H) */
diff -urpN linux-2.6.18.new.2/include/asm-mips/delay.h linux-2.6.18.new.3/include/asm-mips/delay.h
--- linux-2.6.18.new.2/include/asm-mips/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-mips/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -48,7 +48,7 @@ static inline void __delay(unsigned long
  * a constant)
  */
 
-static inline void __udelay(unsigned long usecs, unsigned long lpj)
+static inline void __arch_udelay(unsigned long usecs, unsigned long lpj)
 {
 	unsigned long lo;
 
@@ -81,15 +81,6 @@ static inline void __udelay(unsigned lon
 
 #define __udelay_val cpu_data[smp_processor_id()].udelay_val
 
-#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
+#define __udelay(usecs) __arch_udelay((usecs),__udelay_val)
 
 #endif /* _ASM_DELAY_H */
diff -urpN linux-2.6.18.new.2/include/asm-parisc/delay.h linux-2.6.18.new.3/include/asm-parisc/delay.h
--- linux-2.6.18.new.2/include/asm-parisc/delay.h	2006-09-22 00:00:48.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-parisc/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -37,6 +37,4 @@ static __inline__ void __udelay(unsigned
 	__cr16_delay(usecs * ((unsigned long)boot_cpu_data.cpu_hz / 1000000UL));
 }
 
-#define udelay(n) __udelay(n)
-
 #endif /* defined(_PARISC_DELAY_H) */
diff -urpN linux-2.6.18.new.2/include/asm-powerpc/delay.h linux-2.6.18.new.3/include/asm-powerpc/delay.h
--- linux-2.6.18.new.2/include/asm-powerpc/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-powerpc/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -15,7 +15,7 @@
  */
 
 extern void __delay(unsigned long loops);
-extern void udelay(unsigned long usecs);
+extern void __udelay(unsigned long usecs);
 
 /*
  * On shared processor machines the generic implementation of mdelay can
diff -urpN linux-2.6.18.new.2/include/asm-ppc/delay.h linux-2.6.18.new.3/include/asm-ppc/delay.h
--- linux-2.6.18.new.2/include/asm-ppc/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-ppc/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -30,10 +30,9 @@ extern void __delay(unsigned int loops);
  * (which corresponds to ~3800 bogomips at HZ = 100).
  *  -- paulus
  */
-#define __MAX_UDELAY	(226050910UL/HZ)	/* maximum udelay argument */
 #define __MAX_NDELAY	(4294967295UL/HZ)	/* maximum ndelay argument */
 
-extern __inline__ void __udelay(unsigned int x)
+extern __inline__ void __arch_udelay(unsigned int x)
 {
 	unsigned int loops;
 
@@ -42,7 +41,7 @@ extern __inline__ void __udelay(unsigned
 	__delay(loops);
 }
 
-extern __inline__ void __ndelay(unsigned int x)
+extern __inline__ void __arch_ndelay(unsigned int x)
 {
 	unsigned int loops;
 
@@ -51,16 +50,13 @@ extern __inline__ void __ndelay(unsigned
 	__delay(loops);
 }
 
-extern void __bad_udelay(void);		/* deliberately undefined */
 extern void __bad_ndelay(void);		/* deliberately undefined */
 
-#define udelay(n) (__builtin_constant_p(n)? \
-	((n) > __MAX_UDELAY? __bad_udelay(): __udelay((n) * (19 * HZ))) : \
-	__udelay((n) * (19 * HZ)))
+#define __udelay(n) __arch_udelay((n) * (19 * HZ))
 
 #define ndelay(n) (__builtin_constant_p(n)? \
-	((n) > __MAX_NDELAY? __bad_ndelay(): __ndelay((n) * HZ)) : \
-	__ndelay((n) * HZ))
+	((n) > __MAX_NDELAY? __bad_ndelay(): __arch_ndelay((n) * HZ)) : \
+	__arch_ndelay((n) * HZ))
 
 #endif /* defined(_PPC_DELAY_H) */
 #endif /* __KERNEL__ */
diff -urpN linux-2.6.18.new.2/include/asm-s390/delay.h linux-2.6.18.new.3/include/asm-s390/delay.h
--- linux-2.6.18.new.2/include/asm-s390/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-s390/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -17,6 +17,4 @@
 extern void __udelay(unsigned long usecs);
 extern void __delay(unsigned long loops);
 
-#define udelay(n) __udelay(n)
-
 #endif /* defined(_S390_DELAY_H) */
diff -urpN linux-2.6.18.new.2/include/asm-sh/delay.h linux-2.6.18.new.3/include/asm-sh/delay.h
--- linux-2.6.18.new.2/include/asm-sh/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-sh/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -7,21 +7,15 @@
  * Delay routines calling functions in arch/sh/lib/delay.c
  */
  
-extern void __bad_udelay(void);
 extern void __bad_ndelay(void);
 
 extern void __udelay(unsigned long usecs);
 extern void __ndelay(unsigned long nsecs);
-extern void __const_udelay(unsigned long usecs);
+extern void __const_delay(unsigned long usecs);
 extern void __delay(unsigned long loops);
 
-#define udelay(n) (__builtin_constant_p(n) ? \
-	((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \
-	__udelay(n))
-
-
 #define ndelay(n) (__builtin_constant_p(n) ? \
-	((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
+	((n) > 20000 ? __bad_ndelay() : __const_delay((n) * 5ul)) : \
 	__ndelay(n))
 
 #endif /* __ASM_SH_DELAY_H */
diff -urpN linux-2.6.18.new.2/include/asm-sh64/delay.h linux-2.6.18.new.3/include/asm-sh64/delay.h
--- linux-2.6.18.new.2/include/asm-sh64/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-sh64/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -2,10 +2,10 @@
 #define __ASM_SH64_DELAY_H
 
 extern void __delay(int loops);
-extern void __udelay(unsigned long long usecs, unsigned long lpj);
-extern void __ndelay(unsigned long long nsecs, unsigned long lpj);
-extern void udelay(unsigned long usecs);
+extern void __udelay(unsigned long usecs);
 extern void ndelay(unsigned long nsecs);
+/* for linux/delay.h: */
+#define ndelay ndelay
 
 #endif /* __ASM_SH64_DELAY_H */
 
diff -urpN linux-2.6.18.new.2/include/asm-sparc/delay.h linux-2.6.18.new.3/include/asm-sparc/delay.h
--- linux-2.6.18.new.2/include/asm-sparc/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-sparc/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -28,7 +28,6 @@ extern void __ndelay(unsigned long nsecs
 #else /* SMP */
 #define __udelay_val	loops_per_jiffy
 #endif /* SMP */
-#define udelay(__usecs)	__udelay(__usecs, __udelay_val)
 #define ndelay(__nsecs)	__ndelay(__nsecs, __udelay_val)
 
 #endif /* defined(__SPARC_DELAY_H) */
diff -urpN linux-2.6.18.new.2/include/asm-sparc64/delay.h linux-2.6.18.new.3/include/asm-sparc64/delay.h
--- linux-2.6.18.new.2/include/asm-sparc64/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-sparc64/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -21,15 +21,11 @@ extern void __bad_ndelay(void);
 
 extern void __udelay(unsigned long usecs);
 extern void __ndelay(unsigned long nsecs);
-extern void __const_udelay(unsigned long usecs);
+extern void __const_delay(unsigned long usecs);
 extern void __delay(unsigned long loops);
 
-#define udelay(n) (__builtin_constant_p(n) ? \
-	((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \
-	__udelay(n))
-	
 #define ndelay(n) (__builtin_constant_p(n) ? \
-	((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
+	((n) > 20000 ? __bad_ndelay() : __const_delay((n) * 5ul)) : \
 	__ndelay(n))
 
 #endif /* !__ASSEMBLY__ */
diff -urpN linux-2.6.18.new.2/include/asm-v850/delay.h linux-2.6.18.new.3/include/asm-v850/delay.h
--- linux-2.6.18.new.2/include/asm-v850/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-v850/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -33,7 +33,7 @@ static inline void __delay(unsigned long
 
 extern unsigned long loops_per_jiffy;
 
-static inline void udelay(unsigned long usecs)
+static inline void __udelay(unsigned long usecs)
 {
 	register unsigned long full_loops, part_loops;
 
diff -urpN linux-2.6.18.new.2/include/asm-x86_64/delay.h linux-2.6.18.new.3/include/asm-x86_64/delay.h
--- linux-2.6.18.new.2/include/asm-x86_64/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-x86_64/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -7,20 +7,15 @@
  * Delay routines calling functions in arch/x86_64/lib/delay.c
  */
  
-extern void __bad_udelay(void);
 extern void __bad_ndelay(void);
 
 extern void __udelay(unsigned long usecs);
 extern void __ndelay(unsigned long usecs);
-extern void __const_udelay(unsigned long usecs);
+extern void __const_delay(unsigned long usecs);
 extern void __delay(unsigned long loops);
 
-#define udelay(n) (__builtin_constant_p(n) ? \
-	((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \
-	__udelay(n))
-
 #define ndelay(n) (__builtin_constant_p(n) ? \
-       ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
+       ((n) > 20000 ? __bad_ndelay() : __const_delay((n) * 5ul)) : \
        __ndelay(n))
 
 
diff -urpN linux-2.6.18.new.2/include/asm-xtensa/delay.h linux-2.6.18.new.3/include/asm-xtensa/delay.h
--- linux-2.6.18.new.2/include/asm-xtensa/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/asm-xtensa/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -35,7 +35,7 @@ static __inline__ u32 xtensa_get_ccount(
  * local_cpu_data->... where local_cpu_data points to the current
  * cpu. */
 
-static __inline__ void udelay (unsigned long usecs)
+static __inline__ void __udelay (unsigned long usecs)
 {
 	unsigned long start = xtensa_get_ccount();
 	unsigned long cycles = usecs * (loops_per_jiffy / (1000000UL / HZ));
diff -urpN linux-2.6.18.new.2/include/linux/delay.h linux-2.6.18.new.3/include/linux/delay.h
--- linux-2.6.18.new.2/include/linux/delay.h	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/include/linux/delay.h	2006-09-22 02:30:27.000000000 +0200
@@ -11,37 +11,15 @@ extern unsigned long loops_per_jiffy;
 
 #include <asm/delay.h>
 
-/*
- * Using udelay() for intervals greater than a few milliseconds can
- * risk overflow for high loops_per_jiffy (high bogomips) machines. The
- * mdelay() provides a wrapper to prevent this.  For delays greater
- * than MAX_UDELAY_MS milliseconds, the wrapper is used.  Architecture
- * specific values can be defined in asm-???/delay.h as an override.
- * The 2nd mdelay() definition ensures GCC will optimize away the 
- * while loop for the common cases where n <= MAX_UDELAY_MS  --  Paul G.
- */
-
-#ifndef MAX_UDELAY_MS
-#define MAX_UDELAY_MS	5
-#endif
-
-#ifndef mdelay
-#define mdelay(n) (\
-	(__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
-	({unsigned long __ms=(n); while (__ms--) udelay(1000);}))
-#endif
-
+void calibrate_delay(void);
+void udelay(unsigned int usecs);
+void mdelay(unsigned int msecs);
 #ifndef ndelay
 #define ndelay(x)	udelay(((x)+999)/1000)
 #endif
 
-void calibrate_delay(void);
 void msleep(unsigned int msecs);
+void ssleep(unsigned int secs);
 unsigned long msleep_interruptible(unsigned int msecs);
 
-static inline void ssleep(unsigned int seconds)
-{
-	msleep(seconds * 1000);
-}
-
 #endif /* defined(_LINUX_DELAY_H) */
diff -urpN linux-2.6.18.new.2/kernel/timer.c linux-2.6.18.new.3/kernel/timer.c
--- linux-2.6.18.new.2/kernel/timer.c	2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new.3/kernel/timer.c	2006-09-22 02:30:27.000000000 +0200
@@ -1882,6 +1882,36 @@ unregister_time_interpolator(struct time
 }
 #endif /* CONFIG_TIME_INTERPOLATION */
 
+/*
+ * Not inlined because we do not optimize delays for speed. ;)
+ */
+void udelay(unsigned int usecs)
+{
+	unsigned int k;
+	if (unlikely(usecs > 200*1000)) {
+		printk("BUG: delay too large: udelay(%u)\n", usecs);
+		dump_stack();
+		usecs = 200*1000;
+	}
+	k = usecs / 1024;
+	usecs %= 1024;
+	while (k) {
+		__udelay(1024);
+		k--;
+	}
+	__udelay(usecs);
+}
+
+EXPORT_SYMBOL(udelay);
+
+void mdelay(unsigned int msecs)
+{
+	while (msecs--)
+		__udelay(1000);
+}
+
+EXPORT_SYMBOL(mdelay);
+
 /**
  * msleep - sleep safely even with waitqueue interruptions
  * @msecs: Time in milliseconds to sleep for
@@ -1896,6 +1926,13 @@ void msleep(unsigned int msecs)
 
 EXPORT_SYMBOL(msleep);
 
+void ssleep(unsigned int secs)
+{
+        msleep(secs * 1000);
+}
+
+EXPORT_SYMBOL(ssleep);
+
 /**
  * msleep_interruptible - sleep waiting for signals
  * @msecs: Time in milliseconds to sleep for

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

* Re: [PATCH 3/3] delay: add generic udelay(), mdelay() and ssleep()
  2006-09-22  8:00     ` [PATCH 3/3] delay: add generic udelay(), mdelay() and ssleep() Denis Vlasenko
@ 2006-09-22  9:36       ` Russell King
  2006-09-22 13:46         ` Denis Vlasenko
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King @ 2006-09-22  9:36 UTC (permalink / raw)
  To: Denis Vlasenko; +Cc: linux-kernel, Andrew Morton

On Fri, Sep 22, 2006 at 10:00:33AM +0200, Denis Vlasenko wrote:
> * __const_udelay for all arches is removed or renamed to
> ? __const_delay (it did not do microsecond delays anyway)

You never explained this properly - in fact I think your logic is
reversed.  Let me remind you of my reply (which afaics never got
a response):

On Wed, Aug 23, 2006 a 09:14:52AM +0100, Russell King wrote:
> On Wed, Aug 23, 2006 at 07:50:24AM +0200, Denis Vlasenko wrote:
> > On Tuesday 22 August 2006 18:55, Russell King wrote:
> > > Please keep a "const" version in ARM.  Thanks.
> >
> > Are you talking about this hunk? Why do you want to keep it?
> >
> > I mean, without it udelay(n) will become slower by the time
> > needed for one extra multiply. So we will have maybe
> > udelay(n) ==> udelay(n+0.1).
> 
> Why do you think that?  With the constant version, the additional
> unnecessary multiply is optimised away by the compiler (since
> constant * constant = constant), so it's actually slightly faster,
> not sligntly slower as you seem to think.
> 
> Since the multiply is pure overhead, it's better to get rid of it.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

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

* Re: [PATCH 3/3] delay: add generic udelay(), mdelay() and ssleep()
  2006-09-22  9:36       ` Russell King
@ 2006-09-22 13:46         ` Denis Vlasenko
  0 siblings, 0 replies; 5+ messages in thread
From: Denis Vlasenko @ 2006-09-22 13:46 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel, Andrew Morton

On Friday 22 September 2006 11:36, Russell King wrote:
> On Fri, Sep 22, 2006 at 10:00:33AM +0200, Denis Vlasenko wrote:
> > * __const_udelay for all arches is removed or renamed to
> > ? __const_delay (it did not do microsecond delays anyway)

> You never explained this properly - in fact I think your logic is
> reversed.

linux-2.6.18/arch/i386/lib/delay.c:

void __udelay(unsigned long usecs)
{
       __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */
}

__udelay(n) is meant to busy loop for N microseconds,
and it is easy to see from above code that
__udelay(n) == __const_udelay(n*0x10c7).
So __const_udelay(x) doesn not delay for x microseconds.
It's a bad name.


> Let me remind you of my reply (which afaics never got
> a response):

> On Wed, Aug 23, 2006 a 09:14:52AM +0100, Russell King wrote:
> > On Wed, Aug 23, 2006 at 07:50:24AM +0200, Denis Vlasenko wrote:
> > > On Tuesday 22 August 2006 18:55, Russell King wrote:
> > > > Please keep a "const" version in ARM.  Thanks.
> > >
> > > Are you talking about this hunk? Why do you want to keep it?
> > >
> > > I mean, without it udelay(n) will become slower by the time
> > > needed for one extra multiply. So we will have maybe
> > > udelay(n) ==> udelay(n+0.1).
> > 
> > Why do you think that?  With the constant version, the additional
> > unnecessary multiply is optimised away by the compiler (since
> > constant * constant = constant), so it's actually slightly faster,
> > not sligntly slower as you seem to think.
> > 
> > Since the multiply is pure overhead, it's better to get rid of it.


I did send a reply. Maybe the problem was that I removed
l-k from CC...

On Wednesday 23 August 2006 10:39, Denis Vlasenko wrote:
> > Why do you think that?  With the constant version, the additional
> > unnecessary multiply is optimised away by the compiler (since
> > constant * constant = constant), so it's actually slightly faster,
> > not sligntly slower as you seem to think.
> 
> We are not disagreeind. I said it wrong way. I meant
> "with this #define removed, udelay(n) will become slower...".
> 
> And I am saying that it is _100% okay_ for it to become slower:
> 
> > Since the multiply is pure overhead, it's better to get rid of it.
> 
> You do not need to optimize delay for speed. If you
> really want to, then you can do:
> 
> #define udelay(n) do {} while(0)
> 
> Makes sense? No it does not. That's what I'm trying to say.
> You WANT to pause for thousands of cycles. Why you are trying
> to shave off ~10 cycles at the very same time?
> 
> Hope it makes things clearer.

So, to reiterate, optimizing udelay(N) for speed makes no sense.
--
vda

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

end of thread, other threads:[~2006-09-22 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200609220955.35826.vda.linux@googlemail.com>
2006-09-22  7:57 ` [PATCH 1/3] delay: s/#include <asm/delay.h>/#include <linux/delay.h>/ Denis Vlasenko
2006-09-22  7:58   ` [PATCH 2/3] delay: remove references to MAX_UDELAY_MS; fix comment Denis Vlasenko
2006-09-22  8:00     ` [PATCH 3/3] delay: add generic udelay(), mdelay() and ssleep() Denis Vlasenko
2006-09-22  9:36       ` Russell King
2006-09-22 13:46         ` Denis Vlasenko

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