2023-05-23 19:26:33

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] [v2] efi: fix missing prototype warnings

From: Arnd Bergmann <[email protected]>

The cper.c file needs to include an extra header, and efi_zboot_entry
needs an extern declaration to avoid these 'make W=1' warnings:

drivers/firmware/efi/libstub/zboot.c:65:1: error: no previous prototype for 'efi_zboot_entry' [-Werror=missing-prototypes]
drivers/firmware/efi/efi.c:176:16: error: no previous prototype for 'efi_attr_is_visible' [-Werror=missing-prototypes]
drivers/firmware/efi/cper.c:626:6: error: no previous prototype for 'cper_estatus_print' [-Werror=missing-prototypes]
drivers/firmware/efi/cper.c:649:5: error: no previous prototype for 'cper_estatus_check_header' [-Werror=missing-prototypes]
drivers/firmware/efi/cper.c:662:5: error: no previous prototype for 'cper_estatus_check' [-Werror=missing-prototypes]

To make this easier, move the cper specific declarations to
include/linux/cper.h.

Signed-off-by: Arnd Bergmann <[email protected]>
---
v2: move the prototypes rather than including a file in a different
subdir
---
drivers/acpi/apei/apei-internal.h | 6 ------
drivers/acpi/apei/bert.c | 1 +
drivers/firmware/efi/libstub/efistub.h | 3 +++
include/linux/cper.h | 6 ++++++
include/linux/efi.h | 2 ++
5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h
index 1d6ef9654725..67c2c3b959e1 100644
--- a/drivers/acpi/apei/apei-internal.h
+++ b/drivers/acpi/apei/apei-internal.h
@@ -7,7 +7,6 @@
#ifndef APEI_INTERNAL_H
#define APEI_INTERNAL_H

-#include <linux/cper.h>
#include <linux/acpi.h>

struct apei_exec_context;
@@ -130,10 +129,5 @@ static inline u32 cper_estatus_len(struct acpi_hest_generic_status *estatus)
return sizeof(*estatus) + estatus->data_length;
}

-void cper_estatus_print(const char *pfx,
- const struct acpi_hest_generic_status *estatus);
-int cper_estatus_check_header(const struct acpi_hest_generic_status *estatus);
-int cper_estatus_check(const struct acpi_hest_generic_status *estatus);
-
int apei_osc_setup(void);
#endif
diff --git a/drivers/acpi/apei/bert.c b/drivers/acpi/apei/bert.c
index c23eb75866d0..7514e38d5640 100644
--- a/drivers/acpi/apei/bert.c
+++ b/drivers/acpi/apei/bert.c
@@ -23,6 +23,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/acpi.h>
+#include <linux/cper.h>
#include <linux/io.h>

#include "apei-internal.h"
diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
index 67d5a20802e0..54a2822cae77 100644
--- a/drivers/firmware/efi/libstub/efistub.h
+++ b/drivers/firmware/efi/libstub/efistub.h
@@ -1133,4 +1133,7 @@ const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record,
void efi_remap_image(unsigned long image_base, unsigned alloc_size,
unsigned long code_size);

+asmlinkage efi_status_t __efiapi
+efi_zboot_entry(efi_handle_t handle, efi_system_table_t *systab);
+
#endif
diff --git a/include/linux/cper.h b/include/linux/cper.h
index eacb7dd7b3af..c1a7dc325121 100644
--- a/include/linux/cper.h
+++ b/include/linux/cper.h
@@ -572,4 +572,10 @@ void cper_print_proc_ia(const char *pfx,
int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg);
int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg);

+struct acpi_hest_generic_status;
+void cper_estatus_print(const char *pfx,
+ const struct acpi_hest_generic_status *estatus);
+int cper_estatus_check_header(const struct acpi_hest_generic_status *estatus);
+int cper_estatus_check(const struct acpi_hest_generic_status *estatus);
+
#endif
diff --git a/include/linux/efi.h b/include/linux/efi.h
index bed3c92cbc31..120af31a5136 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1349,4 +1349,6 @@ bool efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table)
return xen_efi_config_table_is_usable(guid, table);
}

+umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n);
+
#endif /* _LINUX_EFI_H */
--
2.39.2



2023-05-24 14:38:30

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH] [v2] efi: fix missing prototype warnings

On Wed, 24 May 2023 at 16:32, Rafael J. Wysocki <[email protected]> wrote:
>
> On Tue, May 23, 2023 at 9:02 PM Arnd Bergmann <[email protected]> wrote:
> >
> > From: Arnd Bergmann <[email protected]>
> >
> > The cper.c file needs to include an extra header, and efi_zboot_entry
> > needs an extern declaration to avoid these 'make W=1' warnings:
> >
> > drivers/firmware/efi/libstub/zboot.c:65:1: error: no previous prototype for 'efi_zboot_entry' [-Werror=missing-prototypes]
> > drivers/firmware/efi/efi.c:176:16: error: no previous prototype for 'efi_attr_is_visible' [-Werror=missing-prototypes]
> > drivers/firmware/efi/cper.c:626:6: error: no previous prototype for 'cper_estatus_print' [-Werror=missing-prototypes]
> > drivers/firmware/efi/cper.c:649:5: error: no previous prototype for 'cper_estatus_check_header' [-Werror=missing-prototypes]
> > drivers/firmware/efi/cper.c:662:5: error: no previous prototype for 'cper_estatus_check' [-Werror=missing-prototypes]
> >
> > To make this easier, move the cper specific declarations to
> > include/linux/cper.h.
> >
> > Signed-off-by: Arnd Bergmann <[email protected]>
>
> For the APEI change:
>
> Acked-by: Rafael J. Wysocki <[email protected]>
>

Thanks - I'll queue this up.


> > ---
> > v2: move the prototypes rather than including a file in a different
> > subdir
> > ---
> > drivers/acpi/apei/apei-internal.h | 6 ------
> > drivers/acpi/apei/bert.c | 1 +
> > drivers/firmware/efi/libstub/efistub.h | 3 +++
> > include/linux/cper.h | 6 ++++++
> > include/linux/efi.h | 2 ++
> > 5 files changed, 12 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h
> > index 1d6ef9654725..67c2c3b959e1 100644
> > --- a/drivers/acpi/apei/apei-internal.h
> > +++ b/drivers/acpi/apei/apei-internal.h
> > @@ -7,7 +7,6 @@
> > #ifndef APEI_INTERNAL_H
> > #define APEI_INTERNAL_H
> >
> > -#include <linux/cper.h>
> > #include <linux/acpi.h>
> >
> > struct apei_exec_context;
> > @@ -130,10 +129,5 @@ static inline u32 cper_estatus_len(struct acpi_hest_generic_status *estatus)
> > return sizeof(*estatus) + estatus->data_length;
> > }
> >
> > -void cper_estatus_print(const char *pfx,
> > - const struct acpi_hest_generic_status *estatus);
> > -int cper_estatus_check_header(const struct acpi_hest_generic_status *estatus);
> > -int cper_estatus_check(const struct acpi_hest_generic_status *estatus);
> > -
> > int apei_osc_setup(void);
> > #endif
> > diff --git a/drivers/acpi/apei/bert.c b/drivers/acpi/apei/bert.c
> > index c23eb75866d0..7514e38d5640 100644
> > --- a/drivers/acpi/apei/bert.c
> > +++ b/drivers/acpi/apei/bert.c
> > @@ -23,6 +23,7 @@
> > #include <linux/module.h>
> > #include <linux/init.h>
> > #include <linux/acpi.h>
> > +#include <linux/cper.h>
> > #include <linux/io.h>
> >
> > #include "apei-internal.h"
> > diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
> > index 67d5a20802e0..54a2822cae77 100644
> > --- a/drivers/firmware/efi/libstub/efistub.h
> > +++ b/drivers/firmware/efi/libstub/efistub.h
> > @@ -1133,4 +1133,7 @@ const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record,
> > void efi_remap_image(unsigned long image_base, unsigned alloc_size,
> > unsigned long code_size);
> >
> > +asmlinkage efi_status_t __efiapi
> > +efi_zboot_entry(efi_handle_t handle, efi_system_table_t *systab);
> > +
> > #endif
> > diff --git a/include/linux/cper.h b/include/linux/cper.h
> > index eacb7dd7b3af..c1a7dc325121 100644
> > --- a/include/linux/cper.h
> > +++ b/include/linux/cper.h
> > @@ -572,4 +572,10 @@ void cper_print_proc_ia(const char *pfx,
> > int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg);
> > int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg);
> >
> > +struct acpi_hest_generic_status;
> > +void cper_estatus_print(const char *pfx,
> > + const struct acpi_hest_generic_status *estatus);
> > +int cper_estatus_check_header(const struct acpi_hest_generic_status *estatus);
> > +int cper_estatus_check(const struct acpi_hest_generic_status *estatus);
> > +
> > #endif
> > diff --git a/include/linux/efi.h b/include/linux/efi.h
> > index bed3c92cbc31..120af31a5136 100644
> > --- a/include/linux/efi.h
> > +++ b/include/linux/efi.h
> > @@ -1349,4 +1349,6 @@ bool efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table)
> > return xen_efi_config_table_is_usable(guid, table);
> > }
> >
> > +umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n);
> > +
> > #endif /* _LINUX_EFI_H */
> > --
> > 2.39.2
> >

2023-05-24 14:44:06

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] [v2] efi: fix missing prototype warnings

On Tue, May 23, 2023 at 9:02 PM Arnd Bergmann <[email protected]> wrote:
>
> From: Arnd Bergmann <[email protected]>
>
> The cper.c file needs to include an extra header, and efi_zboot_entry
> needs an extern declaration to avoid these 'make W=1' warnings:
>
> drivers/firmware/efi/libstub/zboot.c:65:1: error: no previous prototype for 'efi_zboot_entry' [-Werror=missing-prototypes]
> drivers/firmware/efi/efi.c:176:16: error: no previous prototype for 'efi_attr_is_visible' [-Werror=missing-prototypes]
> drivers/firmware/efi/cper.c:626:6: error: no previous prototype for 'cper_estatus_print' [-Werror=missing-prototypes]
> drivers/firmware/efi/cper.c:649:5: error: no previous prototype for 'cper_estatus_check_header' [-Werror=missing-prototypes]
> drivers/firmware/efi/cper.c:662:5: error: no previous prototype for 'cper_estatus_check' [-Werror=missing-prototypes]
>
> To make this easier, move the cper specific declarations to
> include/linux/cper.h.
>
> Signed-off-by: Arnd Bergmann <[email protected]>

For the APEI change:

Acked-by: Rafael J. Wysocki <[email protected]>

> ---
> v2: move the prototypes rather than including a file in a different
> subdir
> ---
> drivers/acpi/apei/apei-internal.h | 6 ------
> drivers/acpi/apei/bert.c | 1 +
> drivers/firmware/efi/libstub/efistub.h | 3 +++
> include/linux/cper.h | 6 ++++++
> include/linux/efi.h | 2 ++
> 5 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h
> index 1d6ef9654725..67c2c3b959e1 100644
> --- a/drivers/acpi/apei/apei-internal.h
> +++ b/drivers/acpi/apei/apei-internal.h
> @@ -7,7 +7,6 @@
> #ifndef APEI_INTERNAL_H
> #define APEI_INTERNAL_H
>
> -#include <linux/cper.h>
> #include <linux/acpi.h>
>
> struct apei_exec_context;
> @@ -130,10 +129,5 @@ static inline u32 cper_estatus_len(struct acpi_hest_generic_status *estatus)
> return sizeof(*estatus) + estatus->data_length;
> }
>
> -void cper_estatus_print(const char *pfx,
> - const struct acpi_hest_generic_status *estatus);
> -int cper_estatus_check_header(const struct acpi_hest_generic_status *estatus);
> -int cper_estatus_check(const struct acpi_hest_generic_status *estatus);
> -
> int apei_osc_setup(void);
> #endif
> diff --git a/drivers/acpi/apei/bert.c b/drivers/acpi/apei/bert.c
> index c23eb75866d0..7514e38d5640 100644
> --- a/drivers/acpi/apei/bert.c
> +++ b/drivers/acpi/apei/bert.c
> @@ -23,6 +23,7 @@
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/acpi.h>
> +#include <linux/cper.h>
> #include <linux/io.h>
>
> #include "apei-internal.h"
> diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
> index 67d5a20802e0..54a2822cae77 100644
> --- a/drivers/firmware/efi/libstub/efistub.h
> +++ b/drivers/firmware/efi/libstub/efistub.h
> @@ -1133,4 +1133,7 @@ const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record,
> void efi_remap_image(unsigned long image_base, unsigned alloc_size,
> unsigned long code_size);
>
> +asmlinkage efi_status_t __efiapi
> +efi_zboot_entry(efi_handle_t handle, efi_system_table_t *systab);
> +
> #endif
> diff --git a/include/linux/cper.h b/include/linux/cper.h
> index eacb7dd7b3af..c1a7dc325121 100644
> --- a/include/linux/cper.h
> +++ b/include/linux/cper.h
> @@ -572,4 +572,10 @@ void cper_print_proc_ia(const char *pfx,
> int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg);
> int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg);
>
> +struct acpi_hest_generic_status;
> +void cper_estatus_print(const char *pfx,
> + const struct acpi_hest_generic_status *estatus);
> +int cper_estatus_check_header(const struct acpi_hest_generic_status *estatus);
> +int cper_estatus_check(const struct acpi_hest_generic_status *estatus);
> +
> #endif
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index bed3c92cbc31..120af31a5136 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -1349,4 +1349,6 @@ bool efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table)
> return xen_efi_config_table_is_usable(guid, table);
> }
>
> +umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n);
> +
> #endif /* _LINUX_EFI_H */
> --
> 2.39.2
>