delay: Rework udelay and ndelay
authorAnna-Maria Behnsen <anna-maria@linutronix.de>
Mon, 14 Oct 2024 08:22:23 +0000 (10:22 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 15 Oct 2024 22:36:47 +0000 (00:36 +0200)
commit19e2d91d8cb1f333adf04731f2788ff6ca06cebd
tree5f6b8a96a2e5539265a6810e97519f24d8e6f7f2
parentf36eb171410839325fff9cd9b7b7400f7e606962
delay: Rework udelay and ndelay

udelay() as well as ndelay() are defines and no functions and are using
constants to be able to transform a sleep time into loops and to prevent
too long udelays/ndelays. There was a compiler error with non-const 8 bit
arguments which was fixed by commit a87e553fabe8 ("asm-generic: delay.h fix
udelay and ndelay for 8 bit args"). When using a function, the non-const 8
bit argument is type casted and the problem would be gone.

Transform udelay() and ndelay() into proper functions, remove the no longer
and confusing division, add defines for the magic values and add some
explanations as well.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/all/20241014-devel-anna-maria-b4-timers-flseep-v3-6-dc8b907cb62f@linutronix.de
include/asm-generic/delay.h