diff mbox series

[v2,61/88] ASoC: intel: avs: Convert to RUNTIME_PM_OPS()

Message ID 20250317095603.20073-62-tiwai@suse.de (mailing list archive)
State Accepted
Commit 72954863350eff04a4961acb49bfce11416f7856
Headers show
Series ASoC: Convert to modern PM macros | expand

Commit Message

Takashi Iwai March 17, 2025, 9:55 a.m. UTC
Use the newer RUNTIME_PM_OPS() macro instead of SET_RUNTIME_PM_OPS()
together with pm_ptr(), which allows us dropping ugly __maybe_unused
attributes.

This optimizes slightly when CONFIG_PM is disabled, too.

Cc: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/intel/avs/core.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Comments

Cezary Rojewski March 17, 2025, 10:04 a.m. UTC | #1
On 2025-03-17 10:55 AM, Takashi Iwai wrote:
> Use the newer RUNTIME_PM_OPS() macro instead of SET_RUNTIME_PM_OPS()
> together with pm_ptr(), which allows us dropping ugly __maybe_unused
> attributes.
> 
> This optimizes slightly when CONFIG_PM is disabled, too.
> 
> Cc: Cezary Rojewski <cezary.rojewski@intel.com>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Thank you for keeping me in loop. The patch looks good.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>

> ---
>   sound/soc/intel/avs/core.c | 24 ++++++++++++------------
>   1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c
> index 0e750e9e01d9..8fbf33e30dfc 100644
> --- a/sound/soc/intel/avs/core.c
> +++ b/sound/soc/intel/avs/core.c
> @@ -612,7 +612,7 @@ static int avs_suspend_standby(struct avs_dev *adev)
>   	return 0;
>   }
>   
> -static int __maybe_unused avs_suspend_common(struct avs_dev *adev, bool low_power)
> +static int avs_suspend_common(struct avs_dev *adev, bool low_power)
>   {
>   	struct hdac_bus *bus = &adev->base.core;
>   	int ret;
> @@ -673,7 +673,7 @@ static int avs_resume_standby(struct avs_dev *adev)
>   	return 0;
>   }
>   
> -static int __maybe_unused avs_resume_common(struct avs_dev *adev, bool low_power, bool purge)
> +static int avs_resume_common(struct avs_dev *adev, bool low_power, bool purge)
>   {
>   	struct hdac_bus *bus = &adev->base.core;
>   	int ret;
> @@ -696,41 +696,41 @@ static int __maybe_unused avs_resume_common(struct avs_dev *adev, bool low_power
>   	return 0;
>   }
>   
> -static int __maybe_unused avs_suspend(struct device *dev)
> +static int avs_suspend(struct device *dev)
>   {
>   	return avs_suspend_common(to_avs_dev(dev), true);
>   }
>   
> -static int __maybe_unused avs_resume(struct device *dev)
> +static int avs_resume(struct device *dev)
>   {
>   	return avs_resume_common(to_avs_dev(dev), true, true);
>   }
>   
> -static int __maybe_unused avs_runtime_suspend(struct device *dev)
> +static int avs_runtime_suspend(struct device *dev)
>   {
>   	return avs_suspend_common(to_avs_dev(dev), true);
>   }
>   
> -static int __maybe_unused avs_runtime_resume(struct device *dev)
> +static int avs_runtime_resume(struct device *dev)
>   {
>   	return avs_resume_common(to_avs_dev(dev), true, false);
>   }
>   
> -static int __maybe_unused avs_freeze(struct device *dev)
> +static int avs_freeze(struct device *dev)
>   {
>   	return avs_suspend_common(to_avs_dev(dev), false);
>   }
> -static int __maybe_unused avs_thaw(struct device *dev)
> +static int avs_thaw(struct device *dev)
>   {
>   	return avs_resume_common(to_avs_dev(dev), false, true);
>   }
>   
> -static int __maybe_unused avs_poweroff(struct device *dev)
> +static int avs_poweroff(struct device *dev)
>   {
>   	return avs_suspend_common(to_avs_dev(dev), false);
>   }
>   
> -static int __maybe_unused avs_restore(struct device *dev)
> +static int avs_restore(struct device *dev)
>   {
>   	return avs_resume_common(to_avs_dev(dev), false, true);
>   }
> @@ -742,7 +742,7 @@ static const struct dev_pm_ops avs_dev_pm = {
>   	.thaw = avs_thaw,
>   	.poweroff = avs_poweroff,
>   	.restore = avs_restore,
> -	SET_RUNTIME_PM_OPS(avs_runtime_suspend, avs_runtime_resume, NULL)
> +	RUNTIME_PM_OPS(avs_runtime_suspend, avs_runtime_resume, NULL)
>   };
>   
>   static const struct avs_sram_spec skl_sram_spec = {
> @@ -893,7 +893,7 @@ static struct pci_driver avs_pci_driver = {
>   	.shutdown = avs_pci_shutdown,
>   	.dev_groups = avs_attr_groups,
>   	.driver = {
> -		.pm = &avs_dev_pm,
> +		.pm = pm_ptr(&avs_dev_pm),
>   	},
>   };
>   module_pci_driver(avs_pci_driver);
diff mbox series

Patch

diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c
index 0e750e9e01d9..8fbf33e30dfc 100644
--- a/sound/soc/intel/avs/core.c
+++ b/sound/soc/intel/avs/core.c
@@ -612,7 +612,7 @@  static int avs_suspend_standby(struct avs_dev *adev)
 	return 0;
 }
 
-static int __maybe_unused avs_suspend_common(struct avs_dev *adev, bool low_power)
+static int avs_suspend_common(struct avs_dev *adev, bool low_power)
 {
 	struct hdac_bus *bus = &adev->base.core;
 	int ret;
@@ -673,7 +673,7 @@  static int avs_resume_standby(struct avs_dev *adev)
 	return 0;
 }
 
-static int __maybe_unused avs_resume_common(struct avs_dev *adev, bool low_power, bool purge)
+static int avs_resume_common(struct avs_dev *adev, bool low_power, bool purge)
 {
 	struct hdac_bus *bus = &adev->base.core;
 	int ret;
@@ -696,41 +696,41 @@  static int __maybe_unused avs_resume_common(struct avs_dev *adev, bool low_power
 	return 0;
 }
 
-static int __maybe_unused avs_suspend(struct device *dev)
+static int avs_suspend(struct device *dev)
 {
 	return avs_suspend_common(to_avs_dev(dev), true);
 }
 
-static int __maybe_unused avs_resume(struct device *dev)
+static int avs_resume(struct device *dev)
 {
 	return avs_resume_common(to_avs_dev(dev), true, true);
 }
 
-static int __maybe_unused avs_runtime_suspend(struct device *dev)
+static int avs_runtime_suspend(struct device *dev)
 {
 	return avs_suspend_common(to_avs_dev(dev), true);
 }
 
-static int __maybe_unused avs_runtime_resume(struct device *dev)
+static int avs_runtime_resume(struct device *dev)
 {
 	return avs_resume_common(to_avs_dev(dev), true, false);
 }
 
-static int __maybe_unused avs_freeze(struct device *dev)
+static int avs_freeze(struct device *dev)
 {
 	return avs_suspend_common(to_avs_dev(dev), false);
 }
-static int __maybe_unused avs_thaw(struct device *dev)
+static int avs_thaw(struct device *dev)
 {
 	return avs_resume_common(to_avs_dev(dev), false, true);
 }
 
-static int __maybe_unused avs_poweroff(struct device *dev)
+static int avs_poweroff(struct device *dev)
 {
 	return avs_suspend_common(to_avs_dev(dev), false);
 }
 
-static int __maybe_unused avs_restore(struct device *dev)
+static int avs_restore(struct device *dev)
 {
 	return avs_resume_common(to_avs_dev(dev), false, true);
 }
@@ -742,7 +742,7 @@  static const struct dev_pm_ops avs_dev_pm = {
 	.thaw = avs_thaw,
 	.poweroff = avs_poweroff,
 	.restore = avs_restore,
-	SET_RUNTIME_PM_OPS(avs_runtime_suspend, avs_runtime_resume, NULL)
+	RUNTIME_PM_OPS(avs_runtime_suspend, avs_runtime_resume, NULL)
 };
 
 static const struct avs_sram_spec skl_sram_spec = {
@@ -893,7 +893,7 @@  static struct pci_driver avs_pci_driver = {
 	.shutdown = avs_pci_shutdown,
 	.dev_groups = avs_attr_groups,
 	.driver = {
-		.pm = &avs_dev_pm,
+		.pm = pm_ptr(&avs_dev_pm),
 	},
 };
 module_pci_driver(avs_pci_driver);