diff mbox series

[v2,2/6] mmc: sdhci-acpi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr()

Message ID 20241101101441.3518612-3-andriy.shevchenko@linux.intel.com
State New
Headers show
Series mmc: sdhci-acpi: A few cleanups | expand

Commit Message

Andy Shevchenko Nov. 1, 2024, 10:11 a.m. UTC
SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated now
and require an ifdeffery protection against unused function warnings.
The usage of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() allows
the compiler to see the functions, thus suppressing the warning. Thus
drop the ifdeffery protection.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/sdhci-acpi.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Comments

Adrian Hunter Dec. 9, 2024, 11 a.m. UTC | #1
On 1/11/24 12:11, Andy Shevchenko wrote:
> SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated now
> and require an ifdeffery protection against unused function warnings.
> The usage of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() allows
> the compiler to see the functions, thus suppressing the warning. Thus
> drop the ifdeffery protection.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Seems to depend on patch 1

> ---
>  drivers/mmc/host/sdhci-acpi.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index d1ce9193ece9..5241c5c26891 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -1006,8 +1006,6 @@ static void __maybe_unused sdhci_acpi_reset_signal_voltage_if_needed(
>  	}
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -
>  static int sdhci_acpi_suspend(struct device *dev)
>  {
>  	struct sdhci_acpi_host *c = dev_get_drvdata(dev);
> @@ -1034,10 +1032,6 @@ static int sdhci_acpi_resume(struct device *dev)
>  	return sdhci_resume_host(c->host);
>  }
>  
> -#endif
> -
> -#ifdef CONFIG_PM
> -
>  static int sdhci_acpi_runtime_suspend(struct device *dev)
>  {
>  	struct sdhci_acpi_host *c = dev_get_drvdata(dev);
> @@ -1064,12 +1058,9 @@ static int sdhci_acpi_runtime_resume(struct device *dev)
>  	return sdhci_runtime_resume_host(c->host, 0);
>  }
>  
> -#endif
> -
>  static const struct dev_pm_ops sdhci_acpi_pm_ops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(sdhci_acpi_suspend, sdhci_acpi_resume)
> -	SET_RUNTIME_PM_OPS(sdhci_acpi_runtime_suspend,
> -			sdhci_acpi_runtime_resume, NULL)
> +	SYSTEM_SLEEP_PM_OPS(sdhci_acpi_suspend, sdhci_acpi_resume)
> +	RUNTIME_PM_OPS(sdhci_acpi_runtime_suspend, sdhci_acpi_runtime_resume, NULL)
>  };
>  
>  static struct platform_driver sdhci_acpi_driver = {
> @@ -1077,7 +1068,7 @@ static struct platform_driver sdhci_acpi_driver = {
>  		.name			= "sdhci-acpi",
>  		.probe_type		= PROBE_PREFER_ASYNCHRONOUS,
>  		.acpi_match_table	= sdhci_acpi_ids,
> -		.pm			= &sdhci_acpi_pm_ops,
> +		.pm			= pm_ptr(&sdhci_acpi_pm_ops),
>  	},
>  	.probe	= sdhci_acpi_probe,
>  	.remove = sdhci_acpi_remove,
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index d1ce9193ece9..5241c5c26891 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -1006,8 +1006,6 @@  static void __maybe_unused sdhci_acpi_reset_signal_voltage_if_needed(
 	}
 }
 
-#ifdef CONFIG_PM_SLEEP
-
 static int sdhci_acpi_suspend(struct device *dev)
 {
 	struct sdhci_acpi_host *c = dev_get_drvdata(dev);
@@ -1034,10 +1032,6 @@  static int sdhci_acpi_resume(struct device *dev)
 	return sdhci_resume_host(c->host);
 }
 
-#endif
-
-#ifdef CONFIG_PM
-
 static int sdhci_acpi_runtime_suspend(struct device *dev)
 {
 	struct sdhci_acpi_host *c = dev_get_drvdata(dev);
@@ -1064,12 +1058,9 @@  static int sdhci_acpi_runtime_resume(struct device *dev)
 	return sdhci_runtime_resume_host(c->host, 0);
 }
 
-#endif
-
 static const struct dev_pm_ops sdhci_acpi_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(sdhci_acpi_suspend, sdhci_acpi_resume)
-	SET_RUNTIME_PM_OPS(sdhci_acpi_runtime_suspend,
-			sdhci_acpi_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(sdhci_acpi_suspend, sdhci_acpi_resume)
+	RUNTIME_PM_OPS(sdhci_acpi_runtime_suspend, sdhci_acpi_runtime_resume, NULL)
 };
 
 static struct platform_driver sdhci_acpi_driver = {
@@ -1077,7 +1068,7 @@  static struct platform_driver sdhci_acpi_driver = {
 		.name			= "sdhci-acpi",
 		.probe_type		= PROBE_PREFER_ASYNCHRONOUS,
 		.acpi_match_table	= sdhci_acpi_ids,
-		.pm			= &sdhci_acpi_pm_ops,
+		.pm			= pm_ptr(&sdhci_acpi_pm_ops),
 	},
 	.probe	= sdhci_acpi_probe,
 	.remove = sdhci_acpi_remove,