]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spl: Avoid #ifdef with CONFIG_SPL_PAYLOAD_ARGS_ADDR
authorSimon Glass <sjg@chromium.org>
Tue, 26 Sep 2023 14:14:21 +0000 (08:14 -0600)
committerTom Rini <trini@konsulko.com>
Fri, 6 Oct 2023 18:38:12 +0000 (14:38 -0400)
Move the condition to the header file to improve readability.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/spl/spl.c
include/system-constants.h

index 530ade556eea7b4a31c2e03090ae69baa27b2d53..8ed2eeb593010279635d48990c78e206efc5a70c 100644 (file)
@@ -806,9 +806,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
        }
 
        memset(&spl_image, '\0', sizeof(spl_image));
-#ifdef CONFIG_SPL_PAYLOAD_ARGS_ADDR
-       spl_image.arg = (void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR;
-#endif
+       if (IS_ENABLED(CONFIG_SPL_OS_BOOT))
+               spl_image.arg = (void *)SPL_PAYLOAD_ARGS_ADDR;
        spl_image.boot_device = BOOT_DEVICE_NONE;
        board_boot_order(spl_boot_list);
 
@@ -865,9 +864,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 #if CONFIG_IS_ENABLED(OS_BOOT)
        case IH_OS_LINUX:
                debug("Jumping to Linux\n");
-#if defined(CONFIG_SPL_PAYLOAD_ARGS_ADDR)
-               spl_fixup_fdt((void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR);
-#endif
+               if (IS_ENABLED(CONFIG_SPL_OS_BOOT))
+                       spl_fixup_fdt((void *)SPL_PAYLOAD_ARGS_ADDR);
                spl_board_prepare_for_linux();
                jump_to_image_linux(&spl_image);
 #endif
index dca6a86b01f5577b5c7d82dda9abe20d6343a7b2..59371568d1e7399da08f30f59d9b4d6b1eac8096 100644 (file)
 #define SPL_SYS_MALLOC_SIZE    \
        IF_ENABLED_INT(CONFIG_SPL_SYS_MALLOC, CONFIG_SPL_SYS_MALLOC_SIZE)
 
+/* deal with an optional value */
+#ifdef CONFIG_SPL_OS_BOOT
+#define SPL_PAYLOAD_ARGS_ADDR  CONFIG_SPL_PAYLOAD_ARGS_ADDR
+#else
+#define SPL_PAYLOAD_ARGS_ADDR  0
+#endif
+
 #endif