diff mbox series

[v4,1/2] x86: fsp: Only compile fsp_save_s3_stack if (SPL_)DM_RTC is enabled

Message ID 20221122175452.473845-2-sean.anderson@seco.com
State Accepted
Commit 0db588caf99821b616169a7888d8a9515604940c
Delegated to: Tom Rini
Headers show
Series rtc: Add fallbacks for dm functions | expand

Commit Message

Sean Anderson Nov. 22, 2022, 5:54 p.m. UTC
This function calls rtc_write32, which has a different signature
depending on if (SPL_)DM_RTC is enabled or not. This could result in a
mismatch in SPL if DM_RTC was enabled but SPL_DM_RTC, as the non-DM
declaration would still be used in SPL even though the implementation
would be for non-DM_RTC. We are switching to the correct definitions in
the next commit, so this will become a compilation error. Since
fsp_save_s3_stack is not called from SPL, avoid compiling it if
(SPL_)DM_RTC is disabled.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

Changes in v4:
- Don't compile fsp_save_s3_stack in SPL (or TPL/VPL).

Changes in v3:
- New

 arch/x86/lib/fsp/fsp_common.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tom Rini Dec. 9, 2022, 10:54 p.m. UTC | #1
On Tue, Nov 22, 2022 at 12:54:51PM -0500, Sean Anderson wrote:

> This function calls rtc_write32, which has a different signature
> depending on if (SPL_)DM_RTC is enabled or not. This could result in a
> mismatch in SPL if DM_RTC was enabled but SPL_DM_RTC, as the non-DM
> declaration would still be used in SPL even though the implementation
> would be for non-DM_RTC. We are switching to the correct definitions in
> the next commit, so this will become a compilation error. Since
> fsp_save_s3_stack is not called from SPL, avoid compiling it if
> (SPL_)DM_RTC is disabled.
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c
index 82f7d3ab5f..8f2977a807 100644
--- a/arch/x86/lib/fsp/fsp_common.c
+++ b/arch/x86/lib/fsp/fsp_common.c
@@ -61,6 +61,7 @@  void board_final_init(void)
 		debug("OK\n");
 }
 
+#if CONFIG_IS_ENABLED(DM_RTC)
 int fsp_save_s3_stack(void)
 {
 	struct udevice *dev;
@@ -84,3 +85,4 @@  int fsp_save_s3_stack(void)
 
 	return 0;
 }
+#endif