ASoC: max98373: Convert to RUNTIME_PM_OPS() & co
authorTakashi Iwai <tiwai@suse.de>
Mon, 17 Mar 2025 09:54:43 +0000 (10:54 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 17 Mar 2025 10:14:05 +0000 (10:14 +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 superfluous CONFIG_PM and
CONFIG_PM_SLEEP ifdefs.

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-22-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/max98373-i2c.c
sound/soc/codecs/max98373-sdw.c

index 1f7ff3dbcbbebd604ab51b8c4f8ca567387630b1..56c4ba1f37826f279df4007b0de36fa932257b8f 100644 (file)
@@ -472,7 +472,6 @@ static struct snd_soc_dai_driver max98373_dai[] = {
        }
 };
 
-#ifdef CONFIG_PM_SLEEP
 static int max98373_suspend(struct device *dev)
 {
        struct max98373_priv *max98373 = dev_get_drvdata(dev);
@@ -496,10 +495,9 @@ static int max98373_resume(struct device *dev)
        regcache_sync(max98373->regmap);
        return 0;
 }
-#endif
 
 static const struct dev_pm_ops max98373_pm = {
-       SET_SYSTEM_SLEEP_PM_OPS(max98373_suspend, max98373_resume)
+       SYSTEM_SLEEP_PM_OPS(max98373_suspend, max98373_resume)
 };
 
 static const struct regmap_config max98373_regmap = {
@@ -605,7 +603,7 @@ static struct i2c_driver max98373_i2c_driver = {
                .name = "max98373",
                .of_match_table = of_match_ptr(max98373_of_match),
                .acpi_match_table = ACPI_PTR(max98373_acpi_match),
-               .pm = &max98373_pm,
+               .pm = pm_ptr(&max98373_pm),
        },
        .probe = max98373_i2c_probe,
        .id_table = max98373_i2c_id,
index 26860882fd91aa7611588f2822b909b296dd39b5..6088278e6503dc7ea743ccc439cd6365c7475017 100644 (file)
@@ -246,7 +246,7 @@ static const struct regmap_config max98373_sdw_regmap = {
 };
 
 /* Power management functions and structure */
-static __maybe_unused int max98373_suspend(struct device *dev)
+static int max98373_suspend(struct device *dev)
 {
        struct max98373_priv *max98373 = dev_get_drvdata(dev);
        int i;
@@ -262,7 +262,7 @@ static __maybe_unused int max98373_suspend(struct device *dev)
 
 #define MAX98373_PROBE_TIMEOUT 5000
 
-static __maybe_unused int max98373_resume(struct device *dev)
+static int max98373_resume(struct device *dev)
 {
        struct sdw_slave *slave = dev_to_sdw_dev(dev);
        struct max98373_priv *max98373 = dev_get_drvdata(dev);
@@ -292,8 +292,8 @@ regmap_sync:
 }
 
 static const struct dev_pm_ops max98373_pm = {
-       SET_SYSTEM_SLEEP_PM_OPS(max98373_suspend, max98373_resume)
-       SET_RUNTIME_PM_OPS(max98373_suspend, max98373_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(max98373_suspend, max98373_resume)
+       RUNTIME_PM_OPS(max98373_suspend, max98373_resume, NULL)
 };
 
 static int max98373_read_prop(struct sdw_slave *slave)
@@ -874,7 +874,7 @@ static struct sdw_driver max98373_sdw_driver = {
                .name = "max98373",
                .of_match_table = of_match_ptr(max98373_of_match),
                .acpi_match_table = ACPI_PTR(max98373_acpi_match),
-               .pm = &max98373_pm,
+               .pm = pm_ptr(&max98373_pm),
        },
        .probe = max98373_sdw_probe,
        .remove = max98373_sdw_remove,