[PATCH 7/8] power: reset: reboot-mode: fix link error without globalvar

Ahmad Fatoum a.fatoum at pengutronix.de
Fri May 17 06:26:55 PDT 2024


The reboot_mode_add_globalvar initcall would run even without
CONFIG_GLOBALVAR if it didn't fail at link time, because it references
the global_device. Fix this by only registering the initcall if global
variable support is enabled.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/power/reset/reboot-mode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index 7f940a2d8843..b52e7ec0dc27 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -71,7 +71,7 @@ static int of_reboot_mode_fixup(struct device_node *root, void *ctx)
 	return 0;
 }
 
-static int reboot_mode_add_globalvar(void)
+static __maybe_unused int reboot_mode_add_globalvar(void)
 {
 	struct reboot_mode_driver *reboot = __boot_mode;
 
@@ -83,8 +83,9 @@ static int reboot_mode_add_globalvar(void)
 
 	return reboot_mode_add_param(&global_device, "system.reboot_mode.", reboot);
 }
+#ifdef CONFIG_GLOBALVAR
 late_initcall(reboot_mode_add_globalvar);
-
+#endif
 
 static void reboot_mode_print(struct reboot_mode_driver *reboot,
 			      const char *prefix, const u32 *arr)
-- 
2.39.2




More information about the barebox mailing list