Re: [PATCH v2 06/15] delay: Rework udelay and ndelay

From: Anna-Maria Behnsen
Date: Mon Sep 23 2024 - 11:41:04 EST


Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx> writes:

> 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@xxxxxxxxxxxxx>
> Signed-off-by: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
> ---
> v2: New in v2 (as suggested by Thomas)
> ---
> include/asm-generic/delay.h | 64 +++++++++++++++++++++++++--------------------
> 1 file changed, 36 insertions(+), 28 deletions(-)
>
> diff --git a/include/asm-generic/delay.h b/include/asm-generic/delay.h
> index 70a1b20f3e1a..40d30dc2488b 100644
> --- a/include/asm-generic/delay.h
> +++ b/include/asm-generic/delay.h
> @@ -2,6 +2,8 @@
> #ifndef __ASM_GENERIC_DELAY_H
> #define __ASM_GENERIC_DELAY_H
>
> +#include <vdso/time64.h>

There was a build failure for i386 (missing include
<linux/math.h>). Will be updated with v3.

Thanks,

Anna-Maria