Skip to contentSkip to conversation

platform/x86: amd-pmc: fix compilation without CONFIG_RTC_SYSTOHC_DEVICE

PATCH Superseded Mario Limonciello 1 participant 1 message Oct 25, 2021 x86 platform drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: amd-pmc: fix compilation without CONFIG_RTC_SYSTOHC_DEVICE

If the configuration hasn't specified this parameter the rest of the new RTC functionality should just be ignored.

Fixes 59348401ebed ("platform/x86: amd-pmc: Add special handling for timer based S0i3 wakeup")
---
 drivers/platform/x86/amd-pmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/amd-pmc.c +3 -1
index 678bf6874c63..95cb724918e0 100644
@@ -416,7 +416,7 @@ static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)
 
 static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
 {
-	struct rtc_device *rtc_device;
+	struct rtc_device *rtc_device = NULL;
 	time64_t then, now, duration;
 	struct rtc_wkalrm alarm;
 	struct rtc_time tm;
@@ -425,7 +425,9 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
 	if (pdev->major < 64 || (pdev->major == 64 && pdev->minor < 53))
 		return 0;
 
+#ifdef CONFIG_RTC_SYSTOHC
 	rtc_device = rtc_class_open(CONFIG_RTC_SYSTOHC_DEVICE);
+#endif
 	if (!rtc_device)
 		return 0;
 	rc = rtc_read_alarm(rtc_device, &alarm);
Signature · 1 line
2.25.1