Skip to contentSkip to conversation

rtc: x86: amd-pmc: fix build failure with CONFIG_RTC_SYSTOHC=n

PATCH In review Arnd Bergmann 2 participants 2 messages Oct 26, 2021

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

PATCH 1/1 rtc: x86: amd-pmc: fix build failure with CONFIG_RTC_SYSTOHC=n

From: Arnd Bergmann <[email protected]>

The newly added logic to set the RTC during suspend from platform specific code fails with a link error here:

drivers/platform/x86/amd-pmc.c:428:30: error: use of undeclared identifier 'CONFIG_RTC_SYSTOHC_DEVICE'

Add an #ifdef so this is only done if the functionality is enabled.

Fixes 59348401ebed ("platform/x86: amd-pmc: Add special handling for timer based S0i3 wakeup")
---
 drivers/platform/x86/amd-pmc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/platform/x86/amd-pmc.c +4 -0
index 678bf6874c63..8bd5de4d9d3a 100644
@@ -414,6 +414,7 @@ static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)
 	return -EINVAL;
 }
 
+#ifdef CONFIG_RTC_SYSTOHC
 static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
 {
 	struct rtc_device *rtc_device;
@@ -461,6 +462,7 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
 
 	return rc;
 }
+#endif
 
 static int __maybe_unused amd_pmc_suspend(struct device *dev)
 {
@@ -473,12 +475,14 @@ static int __maybe_unused amd_pmc_suspend(struct device *dev)
 	amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_RESET, 0);
 	amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_START, 0);
 
+#ifdef CONFIG_RTC_SYSTOHC
 	/* Activate CZN specific RTC functionality */
 	if (pdev->cpu_id == AMD_CPU_ID_CZN) {
 		rc = amd_pmc_verify_czn_rtc(pdev, &arg);
 		if (rc < 0)
 			return rc;
 	}
+#endif
 
 	/* Dump the IdleMask before we send hint to SMU */
 	amd_pmc_idlemask_read(pdev, dev, NULL);
Signature · 1 line
2.29.2
#1 lore raw

[Public]

Quoted 21 lines

-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Tuesday, October 26, 2021 09:12
To: [email protected]; Alexandre Belloni <[email protected]>; S-k, Shyam-sundar <Shyam-sundar.S- [email protected]>; Hans de Goede <[email protected]>; Mark Gross <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Goswami, Sanket <[email protected]>; Sachi King <[email protected]>; platform- [email protected]; [email protected]
Subject: [PATCH] rtc: x86: amd-pmc: fix build failure with CONFIG_RTC_SYSTOHC=n

From: Arnd Bergmann <[email protected]>

The newly added logic to set the RTC during suspend from platform specific code fails with a link error here:

drivers/platform/x86/amd-pmc.c:428:30: error: use of undeclared identifier 'CONFIG_RTC_SYSTOHC_DEVICE'

Quoted 6 lines

Add an #ifdef so this is only done if the functionality is enabled.

Fixes 59348401ebed ("platform/x86: amd-pmc: Add special handling for timer

based S0i3 wakeup")

Hey Arnd,

Thanks for the patch. We had discussed this a bit already and there are 2 other ideas out on the list already that also solve it.

Quoted 44 lines
---
 drivers/platform/x86/amd-pmc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/platform/x86/amd-pmc.c +1 -0
index 678bf6874c63..8bd5de4d9d3a 100644
@@ -414,6 +414,7 @@ static int amd_pmc_get_os_hint(struct amd_pmc_dev
 *dev)
 	return -EINVAL;
 }
 
+#ifdef CONFIG_RTC_SYSTOHC
 static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
 {
drivers/platform/x86/amd-pmc.c +1 -0
 	struct rtc_device *rtc_device;
@@ -461,6 +462,7 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev
 *pdev, u32 *arg)
 
 	return rc;
 }
+#endif
 
 static int __maybe_unused amd_pmc_suspend(struct device *dev)

{

drivers/platform/x86/amd-pmc.c +2 -0
@@ -473,12 +475,14 @@ static int __maybe_unused amd_pmc_suspend(struct
 device *dev)
 	amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_RESET, 0);
 	amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_START, 0);
 
+#ifdef CONFIG_RTC_SYSTOHC
 	/* Activate CZN specific RTC functionality */
 	if (pdev->cpu_id == AMD_CPU_ID_CZN) {
 		rc = amd_pmc_verify_czn_rtc(pdev, &arg);
 		if (rc < 0)
 			return rc;
 	}
+#endif
 
 	/* Dump the IdleMask before we send hint to SMU */

amd_pmc_idlemask_read(pdev, dev, NULL);
--
2.29.2