diff mbox series

[4/4] lmb: build lmb_map_update_notify() only with EFI_LOADER

Message ID 20250213131104.186663-5-sughosh.ganu@linaro.org
State New
Headers show
Series lmb: miscellaneous fixes and improvements | expand

Commit Message

Sughosh Ganu Feb. 13, 2025, 1:11 p.m. UTC
The lmb_map_update_notify() function is used to update the EFI memory
map based on corresponding changes in the LMB map. This is causing
build failure with a certain old architecture(armv5) toolchain, when
building with CONFIG_CC_OPTIMIZE_FOR_DEBUG symbol on platforms which
do not enable the EFI_LOADER code. Build the code in
lmb_map_update_notify() only when the EFI_LOADER config is enabled to
get around this issue.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Suggested-by: Tom Rini <trini@konsulko.com>
---
 lib/lmb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Tom Rini Feb. 13, 2025, 3:59 p.m. UTC | #1
On Thu, Feb 13, 2025 at 06:41:04PM +0530, Sughosh Ganu wrote:

> The lmb_map_update_notify() function is used to update the EFI memory
> map based on corresponding changes in the LMB map. This is causing
> build failure with a certain old architecture(armv5) toolchain, when
> building with CONFIG_CC_OPTIMIZE_FOR_DEBUG symbol on platforms which
> do not enable the EFI_LOADER code. Build the code in
> lmb_map_update_notify() only when the EFI_LOADER config is enabled to
> get around this issue.
> 
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> Suggested-by: Tom Rini <trini@konsulko.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox series

Patch

diff --git a/lib/lmb.c b/lib/lmb.c
index a55bfe289db..7f4b2315b15 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -428,7 +428,7 @@  long io_lmb_free(struct lmb *io_lmb, phys_addr_t base, phys_size_t size)
 
 static struct lmb lmb;
 
-static bool lmb_should_notify(u32 flags)
+static bool __maybe_unused lmb_should_notify(u32 flags)
 {
 	return !lmb.test && !(flags & LMB_NONOTIFY) &&
 		CONFIG_IS_ENABLED(EFI_LOADER);
@@ -437,6 +437,7 @@  static bool lmb_should_notify(u32 flags)
 static int lmb_map_update_notify(phys_addr_t addr, phys_size_t size, u8 op,
 				 u32 flags)
 {
+#if CONFIG_IS_ENABLED(EFI_LOADER)
 	u64 efi_addr;
 	u64 pages;
 	efi_status_t status;
@@ -464,7 +465,7 @@  static int lmb_map_update_notify(phys_addr_t addr, phys_size_t size, u8 op,
 		return -1;
 	}
 	unmap_sysmem((void *)(uintptr_t)efi_addr);
-
+#endif
 	return 0;
 }