platform/x86: amd-pmc: Fix compilation without CONFIG_SUSPEND
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.
--- drivers/platform/x86/amd-pmc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/platform/x86/amd-pmc.c +4 -0
@@ -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
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 whenCONFIG_SUSPENDis set.Check for
CONFIG_SUSPENDand only use those functions in those circumstances.Fixes commit b1f66033cd4e ("platform/x86: amd-pmc: Move to later in the suspend process")Reported-by Randy Dunlap <[email protected]>Signed-off-by Mario Limonciello <[email protected]>
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@@ -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