Skip to contentSkip to conversation

efi: include libfdt header only for aarch64 and riscv

PATCH In review [email protected] 2 participants 2 messages Apr 10, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi: include libfdt header only for aarch64 and riscv

From: Vasant Karasulli <[email protected]>

For x86, preprocessor fails to locate headers included by lib/libfdt.h as they are missing from the include path.

Fixes 9632ce446b8f ("arm64: efi: Improve device tree discovery")
---
 lib/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi.c +1 -1
index 44337837..f396bd71 100644
@@ -12,7 +12,6 @@
 #include <stdlib.h>
 #include <asm/setup.h>
 #include "efi.h"
-#include "libfdt/libfdt.h"
 
 /* From each arch */
 extern char *initrd;
@@ -205,6 +204,7 @@ static char *efi_convert_cmdline(struct efi_loaded_image_64 *image, int *cmd_lin
 }
 
 #if defined(__aarch64__) || defined(__riscv)
+#include "libfdt/libfdt.h"
 /*
  * Open the file and read it into a buffer.
  */

base-commit: 9f993e210064ba9f444b752f56a85bdafdb1780e --
2.34.1

#1 lore raw
Quoted 32 lines · On Wed, Apr 10, 2024 at 09:53:58AM +0200, [email protected] wrote:

From: Vasant Karasulli <[email protected]>

For x86, preprocessor fails to locate headers included by lib/libfdt.h as they are missing from the include path.

Fixes 9632ce446b8f ("arm64: efi: Improve device tree discovery")
---
 lib/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi.c +1 -1
index 44337837..f396bd71 100644
@@ -12,7 +12,6 @@
 #include <stdlib.h>
 #include <asm/setup.h>
 #include "efi.h"
-#include "libfdt/libfdt.h"
 
 /* From each arch */
 extern char *initrd;
@@ -205,6 +204,7 @@ static char *efi_convert_cmdline(struct efi_loaded_image_64 *image, int *cmd_lin
 }
 
 #if defined(__aarch64__) || defined(__riscv)
+#include "libfdt/libfdt.h"
 /*
  * Open the file and read it into a buffer.
  */
Quoted 4 lines

base-commit: 9f993e210064ba9f444b752f56a85bdafdb1780e --
2.34.1

I wasn't able to get an x86-efi compile to fail without this, but the fix looks good.

Merged.

Thanks,
drew