refactor(core): gate the power manager's RTC dependency on USE_RTC
What changed, and why it matters
This is a straightforward code cleanup: a header file now only includes real-time-clock (RTC) definitions when the feature is actually enabled. The commit explicitly states there is no functional change, and the diff shows only conditional compilation guards being added. There is no security issue here.
No security action required. Treat as normal refactoring/build fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change wraps the RTC scheduler include, the autohibernate_event_id field of pm_driver_t, and the pm_schedule_rtc_wakeup() declaration in #ifdef USE_RTC. This prevents pulling in the RTC scheduler interface for builds that do not use it, enabling the managed power policy to compile on non-stm32u5 targets. The commit message asserts the preprocessed output is identical when USE_RTC is set and no RTC references remain when it is unset.
Changed components
core/embed/io/power_manager/managed/power_manager_internal.hInspect captured patch +7 / −0
### core/embed/io/power_manager/managed/power_manager_internal.h
@@ -23,7 +23,10 @@
#include <io/pmic.h>
#include <io/power_manager.h>
+#ifdef USE_RTC
+// Only for rtc_event_id_t below; every RTC user in this module is USE_RTC-only.
#include <sys/rtc_scheduler.h>
+#endif
#include <sys/systimer.h>
#include "../wireless/stwlc38/stwlc38.h"
@@ -148,7 +151,9 @@ typedef struct {
uint32_t suspend_timestamp;
uint32_t last_active_timestamp;
uint32_t time_in_suspend_s;
+#ifdef USE_RTC
rtc_event_id_t autohibernate_event_id;
+#endif
} pm_driver_t;
@@ -181,7 +186,9 @@ void pm_charging_controller(pm_driver_t* drv);
// Store power manager data to backup RAM
pm_status_t pm_store_data_to_backup_ram(void);
+#ifdef USE_RTC
// Schedule the RTC wakeup when going into suspend mode.
// Return false if the driver was not initialized or the RTC timestamp is
// not available.
bool pm_schedule_rtc_wakeup(void);
+#endifWhy this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.