[PATCH 10/34] efi: sysfb: don't build when EFI is disabled

From: Arnd Bergmann
Date: Wed Apr 03 2024 - 04:18:23 EST


From: Arnd Bergmann <arnd@xxxxxxxx>

With 'make W=1', there is a warning when EFI is turned off but sysfb_efi
still gets built:

drivers/firmware/efi/sysfb_efi.c:188:35: error: unused variable 'efifb_dmi_system_table' [-Werror,-Wunused-const-variable]
static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
^
drivers/firmware/efi/sysfb_efi.c:238:35: error: unused variable 'efifb_dmi_swap_width_height' [-Werror,-Wunused-const-variable]
static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
^
drivers/firmware/efi/sysfb_efi.c:297:28: error: unused function 'find_pci_overlap_node' [-Werror,-Wunused-function]
static struct device_node *find_pci_overlap_node(void)

There was an earlier patch to address the duplicate function definitions, but
that missed how we should not be building this file in the first place.

Fixes: 15d27b15de96 ("efi: sysfb_efi: fix build when EFI is not set")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
drivers/firmware/efi/Makefile | 3 ++-
drivers/firmware/efi/sysfb_efi.c | 2 --
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
index a2d0009560d0..3baf80d8cf81 100644
--- a/drivers/firmware/efi/Makefile
+++ b/drivers/firmware/efi/Makefile
@@ -30,7 +30,8 @@ obj-$(CONFIG_EFI_RCI2_TABLE) += rci2-table.o
obj-$(CONFIG_EFI_EMBEDDED_FIRMWARE) += embedded-firmware.o
obj-$(CONFIG_LOAD_UEFI_KEYS) += mokvar-table.o

-obj-$(CONFIG_SYSFB) += sysfb_efi.o
+sysfb-$(CONFIG_SYSFB) += sysfb_efi.o
+obj-$(CONFIG_EFI) += $(sysfb-y)

arm-obj-$(CONFIG_EFI) := efi-init.o arm-runtime.o
obj-$(CONFIG_ARM) += $(arm-obj-y)
diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c
index cc807ed35aed..a8c982475f6b 100644
--- a/drivers/firmware/efi/sysfb_efi.c
+++ b/drivers/firmware/efi/sysfb_efi.c
@@ -346,7 +346,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)
@@ -372,4 +371,3 @@ __init void sysfb_set_efifb_fwnode(struct platform_device *pd)
pd->dev.fwnode = &efifb_fwnode;
}
}
-#endif
--
2.39.2