X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH] platform/x86: amd-pmc: Fix compilation without CONFIG_SUSPEND
@ 2022-04-01 15:53 Mario Limonciello
  2022-04-02  6:04 ` Randy Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Limonciello @ 2022-04-01 15:53 UTC (permalink / raw)
  To: Hans de Goede, Mark Gross, open list:X86 PLATFORM DRIVERS
  Cc: Shyam Sundar S K, Goswami Sanket, Mario Limonciello, Randy Dunlap

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")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/platform/x86/amd-pmc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
index e9d0dbbb2887..b121686407ff 100644
--- a/drivers/platform/x86/amd-pmc.c
+++ b/drivers/platform/x86/amd-pmc.c
@@ -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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/x86: amd-pmc: Fix compilation without CONFIG_SUSPEND
  2022-04-01 15:53 [PATCH] platform/x86: amd-pmc: Fix compilation without CONFIG_SUSPEND Mario Limonciello
@ 2022-04-02  6:04 ` Randy Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy Dunlap @ 2022-04-02  6:04 UTC (permalink / raw)
  To: Mario Limonciello, Hans de Goede, Mark Gross,
	open list:X86 PLATFORM DRIVERS
  Cc: Shyam Sundar S K, Goswami Sanket



On 4/1/22 08:53, Mario Limonciello wrote:
> 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")
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

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


> ---
>  drivers/platform/x86/amd-pmc.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
> index e9d0dbbb2887..b121686407ff 100644
> --- a/drivers/platform/x86/amd-pmc.c
> +++ b/drivers/platform/x86/amd-pmc.c
> @@ -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);

thanks.
-- 
~Randy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-02  6:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-01 15:53 [PATCH] platform/x86: amd-pmc: Fix compilation without CONFIG_SUSPEND Mario Limonciello
2022-04-02  6:04 ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox