diff mbox series

[v2] efi: sysfb_efi: Fix unused const variable 'efifb_fwnode_ops'

Message ID 20241026070228.3240177-1-zengheng4@huawei.com
State New
Headers show
Series [v2] efi: sysfb_efi: Fix unused const variable 'efifb_fwnode_ops' | expand

Commit Message

Zeng Heng Oct. 26, 2024, 7:02 a.m. UTC
Fix the following compilation warning:

drivers/firmware/efi/sysfb_efi.c:345:39: warning:
‘efifb_fwnode_ops’ defined but not used [-Wunused-const-variable=]
  345 | static const struct fwnode_operations efifb_fwnode_ops = {

drivers/firmware/efi/sysfb_efi.c:238:35: warning:
‘efifb_dmi_swap_width_height’ defined but not used
[-Wunused-const-variable=]
  238 | static const struct dmi_system_id
	efifb_dmi_swap_width_height[] __initconst = {

drivers/firmware/efi/sysfb_efi.c:188:35: warning:
‘efifb_dmi_system_table’ defined but not used
[-Wunused-const-variable=]
  188 | static const struct dmi_system_id
	efifb_dmi_system_table[] __initconst = {

In addition to the above warning messages, a series of unused warnings
because of cascading dependencies were found. The variables and functions
related to warnings are only used after CONFIG_EFI enabled. Therefore,
these warnings are addressed and fixed in this commit.

Fixes: 8633ef82f101 ("drivers/firmware: consolidate EFI framebuffer setup for all arches")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
 drivers/firmware/efi/sysfb_efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ard Biesheuvel Nov. 15, 2024, 9:34 a.m. UTC | #1
On Sat, 26 Oct 2024 at 08:48, Zeng Heng <zengheng4@huawei.com> wrote:
>
> Fix the following compilation warning:
>
> drivers/firmware/efi/sysfb_efi.c:345:39: warning:
> ‘efifb_fwnode_ops’ defined but not used [-Wunused-const-variable=]
>   345 | static const struct fwnode_operations efifb_fwnode_ops = {
>
> drivers/firmware/efi/sysfb_efi.c:238:35: warning:
> ‘efifb_dmi_swap_width_height’ defined but not used
> [-Wunused-const-variable=]
>   238 | static const struct dmi_system_id
>         efifb_dmi_swap_width_height[] __initconst = {
>
> drivers/firmware/efi/sysfb_efi.c:188:35: warning:
> ‘efifb_dmi_system_table’ defined but not used
> [-Wunused-const-variable=]
>   188 | static const struct dmi_system_id
>         efifb_dmi_system_table[] __initconst = {
>
> In addition to the above warning messages, a series of unused warnings
> because of cascading dependencies were found. The variables and functions
> related to warnings are only used after CONFIG_EFI enabled. Therefore,
> these warnings are addressed and fixed in this commit.
>
> Fixes: 8633ef82f101 ("drivers/firmware: consolidate EFI framebuffer setup for all arches")
> Signed-off-by: Zeng Heng <zengheng4@huawei.com>
> ---
>  drivers/firmware/efi/sysfb_efi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Is there any reason to build this file in the first place if
CONFIG_EFI is disabled? Should we fix this in the Makefile instead?


> diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c
> index cc807ed35aed..0cfc11ecc98b 100644
> --- a/drivers/firmware/efi/sysfb_efi.c
> +++ b/drivers/firmware/efi/sysfb_efi.c
> @@ -82,6 +82,7 @@ void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
>         }
>  }
>
> +#ifdef CONFIG_EFI
>  #define choose_value(dmivalue, fwvalue, field, flags) ({       \
>                 typeof(fwvalue) _ret_ = fwvalue;                \
>                 if ((flags) & (field))                          \
> @@ -346,7 +347,6 @@ static const struct fwnode_operations efifb_fwnode_ops = {
>         .add_links = efifb_add_links,
>  };
>
> -#ifdef CONFIG_EFI
>  static struct fwnode_handle efifb_fwnode;
>
>  __init void sysfb_apply_efi_quirks(void)
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c
index cc807ed35aed..0cfc11ecc98b 100644
--- a/drivers/firmware/efi/sysfb_efi.c
+++ b/drivers/firmware/efi/sysfb_efi.c
@@ -82,6 +82,7 @@  void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
 	}
 }
 
+#ifdef CONFIG_EFI
 #define choose_value(dmivalue, fwvalue, field, flags) ({	\
 		typeof(fwvalue) _ret_ = fwvalue;		\
 		if ((flags) & (field))				\
@@ -346,7 +347,6 @@  static const struct fwnode_operations efifb_fwnode_ops = {
 	.add_links = efifb_add_links,
 };
 
-#ifdef CONFIG_EFI
 static struct fwnode_handle efifb_fwnode;
 
 __init void sysfb_apply_efi_quirks(void)