Skip to contentSkip to conversation

efi: sysfb_efi: guard EFI-specific code with CONFIG_EFI

PATCH In review Yu-Chun Lin 2 participants 4 messages Jan 15, 2025 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi: sysfb_efi: guard EFI-specific code with CONFIG_EFI

As reported by the kernel test robot, the following warnings occur:

Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:331:39: warning: 'efifb_fwnode_ops' defined but not used [-Wunused-const-variable=]

     331 | static const struct fwnode_operations efifb_fwnode_ops = {
         |                                       ^~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:240:35: warning: 'efifb_dmi_swap_width_height' defined but not used [-Wunused-const-variable=]

     240 | static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:190:35: warning: 'efifb_dmi_system_table' defined but not used [-Wunused-const-variable=]

     190 | static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~

Unused variables, functions, and macro are conditionally compiled under CONFIG_EFI. This includes 'efifb_fwnode_ops', 'efifb_dmi_swap_width_height[]', 'efifb_dmi_system_table[]', 'efifb_add_links', 'find_pci_overlap_node','efifb_set_system', 'efifb_overlaps_pci_range', and the 'EFIFB_DMI_SYSTEM_ID' macro.

Suppress unused symbol warnings and ensure inclusion only in relevant configurations.

---
 drivers/firmware/efi/sysfb_efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/sysfb_efi.c +1 -1
index cc807ed35aed..4efe383cc470 100644
@@ -174,6 +174,7 @@ static int __init efifb_set_system(const struct dmi_system_id *id)
 	return 1;
 }
 
+#ifdef CONFIG_EFI
 #define EFIFB_DMI_SYSTEM_ID(vendor, name, enumid)		\
 	{							\
 		efifb_set_system,				\
@@ -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)
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 22 lines · Yu-Chun Lin

As reported by the kernel test robot, the following warnings occur:

Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:331:39: warning: 'efifb_fwnode_ops' defined but not used [-Wunused-const-variable=]

     331 | static const struct fwnode_operations efifb_fwnode_ops = {
         |                                       ^~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:240:35: warning: 'efifb_dmi_swap_width_height' defined but not used [-Wunused-const-variable=]

     240 | static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:190:35: warning: 'efifb_dmi_system_table' defined but not used [-Wunused-const-variable=]

     190 | static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~

Unused variables, functions, and macro are conditionally compiled under CONFIG_EFI. This includes 'efifb_fwnode_ops', 'efifb_dmi_swap_width_height[]', 'efifb_dmi_system_table[]', 'efifb_add_links', 'find_pci_overlap_node','efifb_set_system', 'efifb_overlaps_pci_range', and the 'EFIFB_DMI_SYSTEM_ID' macro.

Suppress unused symbol warnings and ensure inclusion only in relevant configurations.

Quoted 7 lines
---
 drivers/firmware/efi/sysfb_efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Is your patch better than the one already in linux-next?

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=19fdc68aa7b90b1

Quoted 23 lines
drivers/firmware/efi/sysfb_efi.c +1 -2
index cc807ed35aed..4efe383cc470 100644
@@ -174,6 +174,7 @@ static int __init efifb_set_system(const struct dmi_system_id *id)
        return 1;
 }
 
+#ifdef CONFIG_EFI
 #define EFIFB_DMI_SYSTEM_ID(vendor, name, enumid)              \
        {                                                       \
                efifb_set_system,                               \
@@ -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.43.0

#2 lore raw
Quoted 31 lines · Ard Biesheuvel
Quoted 22 lines · Yu-Chun Lin

As reported by the kernel test robot, the following warnings occur:

Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:331:39: warning: 'efifb_fwnode_ops' defined but not used [-Wunused-const-variable=]

     331 | static const struct fwnode_operations efifb_fwnode_ops = {
         |                                       ^~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:240:35: warning: 'efifb_dmi_swap_width_height' defined but not used [-Wunused-const-variable=]

     240 | static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:190:35: warning: 'efifb_dmi_system_table' defined but not used [-Wunused-const-variable=]

     190 | static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~

Unused variables, functions, and macro are conditionally compiled under CONFIG_EFI. This includes 'efifb_fwnode_ops', 'efifb_dmi_swap_width_height[]', 'efifb_dmi_system_table[]', 'efifb_add_links', 'find_pci_overlap_node','efifb_set_system', 'efifb_overlaps_pci_range', and the 'EFIFB_DMI_SYSTEM_ID' macro.

Suppress unused symbol warnings and ensure inclusion only in relevant configurations.

Quoted 7 lines
---
 drivers/firmware/efi/sysfb_efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines

Is your patch better than the one already in linux-next?

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=19fdc68aa7b90b1

No, Randy's patch is better because it also addresses the additional unused warning. Please ignore this patch.
Thank you.

Yu-Chun

Quoted 23 lines
Quoted 23 lines
drivers/firmware/efi/sysfb_efi.c +1 -2
index cc807ed35aed..4efe383cc470 100644
@@ -174,6 +174,7 @@ static int __init efifb_set_system(const struct dmi_system_id *id)
        return 1;
 }
 
+#ifdef CONFIG_EFI
 #define EFIFB_DMI_SYSTEM_ID(vendor, name, enumid)              \
        {                                                       \
                efifb_set_system,                               \
@@ -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.43.0

maintainer
#3 lore raw
Quoted 33 lines · Yu-Chun Lin
Quoted 31 lines · Ard Biesheuvel
Quoted 29 lines · Yu-Chun Lin

As reported by the kernel test robot, the following warnings occur:

Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:331:39: warning: 'efifb_fwnode_ops' defined but not used [-Wunused-const-variable=]

     331 | static const struct fwnode_operations efifb_fwnode_ops = {
         |                                       ^~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:240:35: warning: 'efifb_dmi_swap_width_height' defined but not used [-Wunused-const-variable=]

     240 | static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/firmware/efi/sysfb_efi.c:190:35: warning: 'efifb_dmi_system_table' defined but not used [-Wunused-const-variable=]

     190 | static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~

Unused variables, functions, and macro are conditionally compiled under CONFIG_EFI. This includes 'efifb_fwnode_ops', 'efifb_dmi_swap_width_height[]', 'efifb_dmi_system_table[]', 'efifb_add_links', 'find_pci_overlap_node','efifb_set_system', 'efifb_overlaps_pci_range', and the 'EFIFB_DMI_SYSTEM_ID' macro.

Suppress unused symbol warnings and ensure inclusion only in relevant configurations.

---
 drivers/firmware/efi/sysfb_efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines
Quoted 4 lines

Is your patch better than the one already in linux-next?

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=19fdc68aa7b90b1

No, Randy's patch is better because it also addresses the additional unused warning. Please ignore this patch.
Thank you.

OK thanks.