ASoC: rt9120: Convert to RUNTIME_PM_OPS()
authorTakashi Iwai <tiwai@suse.de>
Mon, 17 Mar 2025 09:55:05 +0000 (10:55 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 17 Mar 2025 10:14:25 +0000 (10:14 +0000)
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: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250317095603.20073-44-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt9120.c

index 733a7d130a95365fe163a50309e30036e784c3ea..97f56af25577d06f0051e7f6dda770d48eefd926 100644 (file)
@@ -590,7 +590,7 @@ static void rt9120_remove(struct i2c_client *i2c)
        pm_runtime_set_suspended(&i2c->dev);
 }
 
-static int __maybe_unused rt9120_runtime_suspend(struct device *dev)
+static int rt9120_runtime_suspend(struct device *dev)
 {
        struct rt9120_data *data = dev_get_drvdata(dev);
 
@@ -603,7 +603,7 @@ static int __maybe_unused rt9120_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused rt9120_runtime_resume(struct device *dev)
+static int rt9120_runtime_resume(struct device *dev)
 {
        struct rt9120_data *data = dev_get_drvdata(dev);
 
@@ -618,7 +618,7 @@ static int __maybe_unused rt9120_runtime_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops rt9120_pm_ops = {
-       SET_RUNTIME_PM_OPS(rt9120_runtime_suspend, rt9120_runtime_resume, NULL)
+       RUNTIME_PM_OPS(rt9120_runtime_suspend, rt9120_runtime_resume, NULL)
 };
 
 static const struct of_device_id __maybe_unused rt9120_device_table[] = {
@@ -631,7 +631,7 @@ static struct i2c_driver rt9120_driver = {
        .driver = {
                .name = "rt9120",
                .of_match_table = rt9120_device_table,
-               .pm = &rt9120_pm_ops,
+               .pm = pm_ptr(&rt9120_pm_ops),
        },
        .probe = rt9120_probe,
        .remove = rt9120_remove,