ASoC: ak5558: Convert to RUNTIME_PM_OPS() & co
authorTakashi Iwai <tiwai@suse.de>
Mon, 17 Mar 2025 09:54:26 +0000 (10:54 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 17 Mar 2025 10:13:50 +0000 (10:13 +0000)
Use the newer RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() macros
instead of SET_RUNTIME_PM_OPS() and SET_SYSTEM_SLEEP_PM_OPS() together
with pm_ptr(), which allows us dropping ugly __maybe_unused
attributes.

This optimizes slightly when CONFIG_PM is disabled, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250317095603.20073-5-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/ak5558.c

index 6c767609f95df139369f0f4f4e69e12bd52ef6c0..683f3e472f5000d18910282f33ca2a1daa5dcbc8 100644 (file)
@@ -342,7 +342,7 @@ static void ak5558_remove(struct snd_soc_component *component)
        ak5558_reset(ak5558, true);
 }
 
-static int __maybe_unused ak5558_runtime_suspend(struct device *dev)
+static int ak5558_runtime_suspend(struct device *dev)
 {
        struct ak5558_priv *ak5558 = dev_get_drvdata(dev);
 
@@ -354,7 +354,7 @@ static int __maybe_unused ak5558_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused ak5558_runtime_resume(struct device *dev)
+static int ak5558_runtime_resume(struct device *dev)
 {
        struct ak5558_priv *ak5558 = dev_get_drvdata(dev);
        int ret;
@@ -376,9 +376,8 @@ static int __maybe_unused ak5558_runtime_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops ak5558_pm = {
-       SET_RUNTIME_PM_OPS(ak5558_runtime_suspend, ak5558_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(ak5558_runtime_suspend, ak5558_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static const struct snd_soc_component_driver soc_codec_dev_ak5558 = {
@@ -495,7 +494,7 @@ static struct i2c_driver ak5558_i2c_driver = {
        .driver = {
                .name = "ak5558",
                .of_match_table = of_match_ptr(ak5558_i2c_dt_ids),
-               .pm = &ak5558_pm,
+               .pm = pm_ptr(&ak5558_pm),
        },
        .probe = ak5558_i2c_probe,
        .remove = ak5558_i2c_remove,