Re: [GIT PULL] ACPI fixes for v5.15-rc7

From: Rafael J. Wysocki
Date: Fri Oct 29 2021 - 13:51:52 EST


On Fri, Oct 22, 2021 at 9:13 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Oct 22, 2021 at 9:01 AM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
> >
> > - Fix an ACPI tools build issue introduced recently when the minimal
> > stdarg.h was added (Miguel Bernal Marin).
>
> Hmm. ACPI already has that odd ACPI_USE_BUILTIN_STDARG case in
> acgcc.h, which ends up using _exactly_ the same macros as the
> <linux/stdarg.h> implementation does, and is basically exactly the
> same "minimal stdarg".
>
> Ok, so the macro argument names are different, and there are
> whitespace differences, but semantically identical.
>
> So maybe the ACPI code could drop one or the other in favor of the
> identical macros?

The ACPI_USE_BUILTIN_STDARG check comes from the upstream code
assuming that whoever doesn't use the "common" stdarg.h will set
ACPI_USE_BUILTIN_STDARG, but we don't set it and we provide our own
stdarg.h, so we can make the following change (on top of the -rc7):

---
include/acpi/platform/acgcc.h | 13 -------------
1 file changed, 13 deletions(-)

Index: linux-pm/include/acpi/platform/acgcc.h
===================================================================
--- linux-pm.orig/include/acpi/platform/acgcc.h
+++ linux-pm/include/acpi/platform/acgcc.h
@@ -10,25 +10,12 @@
#ifndef __ACGCC_H__
#define __ACGCC_H__

-/*
- * Use compiler specific <stdarg.h> is a good practice for even when
- * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
- */
#ifndef va_arg
-#ifdef ACPI_USE_BUILTIN_STDARG
-typedef __builtin_va_list va_list;
-#define va_start(v, l) __builtin_va_start(v, l)
-#define va_end(v) __builtin_va_end(v)
-#define va_arg(v, l) __builtin_va_arg(v, l)
-#define va_copy(d, s) __builtin_va_copy(d, s)
-#else
#ifdef __KERNEL__
#include <linux/stdarg.h>
#else
-/* Used to build acpi tools */
#include <stdarg.h>
#endif /* __KERNEL__ */
-#endif /* ACPI_USE_BUILTIN_STDARG */
#endif /* ! va_arg */

#define ACPI_INLINE __inline__