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

Arnd Bergmann posted 34 patches 1 year, 10 months ago
[PATCH 10/34] efi: sysfb: don't build when EFI is disabled
Posted by Arnd Bergmann 1 year, 10 months ago
From: Arnd Bergmann <arnd@arndb.de>

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@arndb.de>
---
 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
Re: [PATCH 10/34] efi: sysfb: don't build when EFI is disabled
Posted by Ard Biesheuvel 1 year, 10 months ago
On Wed, 3 Apr 2024 at 11:09, Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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@arndb.de>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

or I can take it via the EFI tree if you prefer.


> ---
>  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
>
Re: [PATCH 10/34] efi: sysfb: don't build when EFI is disabled
Posted by Javier Martinez Canillas 1 year, 10 months ago
Ard Biesheuvel <ardb@kernel.org> writes:

> On Wed, 3 Apr 2024 at 11:09, Arnd Bergmann <arnd@kernel.org> wrote:
>>
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> 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@arndb.de>
>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
>

Looks good to me too.

Acked-by: Javier Martinez Canillas <javierm@redhat.com>

> or I can take it via the EFI tree if you prefer.
>

I think that could be merged through your EFI tree. Thanks!

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat