Skip to contentSkip to conversation

platform/x86: amd-pmc: Fix compilation without CONFIG_SUSPEND

PATCH Superseded Mario Limonciello 2 participants 2 messages Apr 1, 2022 – Apr 2, 2022 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_SUSPEND

Since commit b1f66033cd4e ("platform/x86: amd-pmc: Move to later in the suspend process") amd-pmc doesn't use traditional suspend resume callback anymore but relies on functions only created declared when CONFIG_SUSPEND is set.

Check for CONFIG_SUSPEND and only use those functions in those circumstances.

Fixes commit b1f66033cd4e ("platform/x86: amd-pmc: Move to later in the suspend process")
---
 drivers/platform/x86/amd-pmc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/platform/x86/amd-pmc.c +4 -0
index e9d0dbbb2887..b121686407ff 100644
@@ -859,9 +859,11 @@ static int amd_pmc_probe(struct platform_device *pdev)
 
 	amd_pmc_get_smu_version(dev);
 	platform_set_drvdata(pdev, dev);
+#ifdef CONFIG_SUSPEND
 	err = acpi_register_lps0_dev(&amd_pmc_s2idle_dev_ops);
 	if (err)
 		dev_warn(dev->dev, "failed to register LPS0 sleep handler, expect increased power consumption\n");
+#endif
 
 	amd_pmc_dbgfs_register(dev);
 	return 0;
@@ -875,7 +877,9 @@ static int amd_pmc_remove(struct platform_device *pdev)
 {
 	struct amd_pmc_dev *dev = platform_get_drvdata(pdev);
 
+#ifdef CONFIG_SUSPEND
 	acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops);
+#endif
 	amd_pmc_dbgfs_unregister(dev);
 	pci_dev_put(dev->rdev);
 	mutex_destroy(&dev->lock);
Signature · 1 line
2.34.1
#1 lore raw
Quoted 11 lines · Mario Limonciello

Since commit b1f66033cd4e ("platform/x86: amd-pmc: Move to later in the suspend process") amd-pmc doesn't use traditional suspend resume callback anymore but relies on functions only created declared when CONFIG_SUSPEND is set.

Check for CONFIG_SUSPEND and only use those functions in those circumstances.

Fixes commit b1f66033cd4e ("platform/x86: amd-pmc: Move to later in the suspend process")

Yeah, that works except for this part:

../drivers/platform/x86/amd-pmc.c:693:35: error: ‘amd_pmc_s2idle_dev_ops’ defined but not used [-Werror=unused-variable]

 static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = {
                                   ^~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

Quoted 21 lines
---
 drivers/platform/x86/amd-pmc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/platform/x86/amd-pmc.c +2 -0
index e9d0dbbb2887..b121686407ff 100644
@@ -859,9 +859,11 @@ static int amd_pmc_probe(struct platform_device *pdev)
 
 	amd_pmc_get_smu_version(dev);
 	platform_set_drvdata(pdev, dev);
+#ifdef CONFIG_SUSPEND
 	err = acpi_register_lps0_dev(&amd_pmc_s2idle_dev_ops);
 	if (err)
 		dev_warn(dev->dev, "failed to register LPS0 sleep handler, expect increased power consumption\n");
+#endif
 
 	amd_pmc_dbgfs_register(dev);
 	return 0;

drivers/platform/x86/amd-pmc.c static int amd_pmc_remove(struct platform_device *pdev) · line 885

Quoted 9 lines
drivers/platform/x86/amd-pmc.c +2 -0
@@ -875,7 +877,9 @@ static int amd_pmc_remove(struct platform_device *pdev)
 {
 	struct amd_pmc_dev *dev = platform_get_drvdata(pdev);
 
+#ifdef CONFIG_SUSPEND
 	acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops);
+#endif
 	amd_pmc_dbgfs_unregister(dev);
 	pci_dev_put(dev->rdev);
 	mutex_destroy(&dev->lock);

thanks.

Signature · 1 line
~Randy