diff mbox series

vdso: Fix powerpc build U64_MAX undeclared error

Message ID 20240409062639.3393-1-adrian.hunter@intel.com (mailing list archive)
State Handled Elsewhere
Headers show
Series vdso: Fix powerpc build U64_MAX undeclared error | expand

Commit Message

Adrian Hunter April 9, 2024, 6:26 a.m. UTC
U64_MAX is not in include/vdso/limits.h, although that isn't noticed on x86
because x86 includes include/linux/limits.h indirectly. However powerpc
is more selective, resulting in the following build error:

  In file included from <command-line>:
  lib/vdso/gettimeofday.c: In function 'vdso_calc_ns':
  lib/vdso/gettimeofday.c:11:33: error: 'U64_MAX' undeclared
     11 | # define VDSO_DELTA_MASK(vd)    U64_MAX
        |                                 ^~~~~~~

Use ULLONG_MAX instead which will work just as well and is in
include/vdso/limits.h.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Closes: https://lore.kernel.org/all/20240409124905.6816db37@canb.auug.org.au/
Fixes: c8e3a8b6f2e6 ("vdso: Consolidate vdso_calc_delta()")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 lib/vdso/gettimeofday.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

John Stultz April 9, 2024, 5:07 p.m. UTC | #1
On Mon, Apr 8, 2024 at 11:27 PM Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> U64_MAX is not in include/vdso/limits.h, although that isn't noticed on x86
> because x86 includes include/linux/limits.h indirectly. However powerpc
> is more selective, resulting in the following build error:
>
>   In file included from <command-line>:
>   lib/vdso/gettimeofday.c: In function 'vdso_calc_ns':
>   lib/vdso/gettimeofday.c:11:33: error: 'U64_MAX' undeclared
>      11 | # define VDSO_DELTA_MASK(vd)    U64_MAX
>         |                                 ^~~~~~~
>
> Use ULLONG_MAX instead which will work just as well and is in
> include/vdso/limits.h.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Closes: https://lore.kernel.org/all/20240409124905.6816db37@canb.auug.org.au/
> Fixes: c8e3a8b6f2e6 ("vdso: Consolidate vdso_calc_delta()")
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

Acked-by: John Stultz <jstultz@google.com>
Stephen Rothwell April 10, 2024, 2:47 a.m. UTC | #2
Hi Adrian,

On Tue,  9 Apr 2024 09:26:39 +0300 Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> U64_MAX is not in include/vdso/limits.h, although that isn't noticed on x86
> because x86 includes include/linux/limits.h indirectly. However powerpc
> is more selective, resulting in the following build error:
> 
>   In file included from <command-line>:
>   lib/vdso/gettimeofday.c: In function 'vdso_calc_ns':
>   lib/vdso/gettimeofday.c:11:33: error: 'U64_MAX' undeclared
>      11 | # define VDSO_DELTA_MASK(vd)    U64_MAX
>         |                                 ^~~~~~~
> 
> Use ULLONG_MAX instead which will work just as well and is in
> include/vdso/limits.h.
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Closes: https://lore.kernel.org/all/20240409124905.6816db37@canb.auug.org.au/
> Fixes: c8e3a8b6f2e6 ("vdso: Consolidate vdso_calc_delta()")
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  lib/vdso/gettimeofday.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
> index 9c3a8d2440c9..899850bd6f0b 100644
> --- a/lib/vdso/gettimeofday.c
> +++ b/lib/vdso/gettimeofday.c
> @@ -8,7 +8,7 @@
>  #ifndef vdso_calc_ns
>  
>  #ifdef VDSO_DELTA_NOMASK
> -# define VDSO_DELTA_MASK(vd)	U64_MAX
> +# define VDSO_DELTA_MASK(vd)	ULLONG_MAX
>  #else
>  # define VDSO_DELTA_MASK(vd)	(vd->mask)
>  #endif
> -- 
> 2.34.1
> 

I have applied that to linux-next today and it builds for me.

Tested-by: Stephen Rothwell <sfr@canb.auug.org.au> # build only
diff mbox series

Patch

diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index 9c3a8d2440c9..899850bd6f0b 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -8,7 +8,7 @@ 
 #ifndef vdso_calc_ns
 
 #ifdef VDSO_DELTA_NOMASK
-# define VDSO_DELTA_MASK(vd)	U64_MAX
+# define VDSO_DELTA_MASK(vd)	ULLONG_MAX
 #else
 # define VDSO_DELTA_MASK(vd)	(vd->mask)
 #endif