]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: tegra210: Convert to RUNTIME_PM_OPS() & co
authorTakashi Iwai <tiwai@suse.de>
Mon, 17 Mar 2025 09:55:45 +0000 (10:55 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 17 Mar 2025 10:15:00 +0000 (10:15 +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.

Cc: linux-tegra@vger.kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250317095603.20073-84-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/tegra/tegra210_admaif.c
sound/soc/tegra/tegra210_adx.c
sound/soc/tegra/tegra210_ahub.c
sound/soc/tegra/tegra210_amx.c
sound/soc/tegra/tegra210_dmic.c
sound/soc/tegra/tegra210_i2s.c
sound/soc/tegra/tegra210_mixer.c
sound/soc/tegra/tegra210_mvc.c
sound/soc/tegra/tegra210_ope.c
sound/soc/tegra/tegra210_sfc.c

index f56d1e03239dfd90e9b407a09d6700e2a81a0618..76ff4fe40f65c8204d1513da643afe72a36df67f 100644 (file)
@@ -220,7 +220,7 @@ static const struct regmap_config tegra186_admaif_regmap_config = {
        .cache_type             = REGCACHE_FLAT,
 };
 
-static int __maybe_unused tegra_admaif_runtime_suspend(struct device *dev)
+static int tegra_admaif_runtime_suspend(struct device *dev)
 {
        struct tegra_admaif *admaif = dev_get_drvdata(dev);
 
@@ -230,7 +230,7 @@ static int __maybe_unused tegra_admaif_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused tegra_admaif_runtime_resume(struct device *dev)
+static int tegra_admaif_runtime_resume(struct device *dev)
 {
        struct tegra_admaif *admaif = dev_get_drvdata(dev);
 
@@ -877,10 +877,9 @@ static void tegra_admaif_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops tegra_admaif_pm_ops = {
-       SET_RUNTIME_PM_OPS(tegra_admaif_runtime_suspend,
-                          tegra_admaif_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(tegra_admaif_runtime_suspend,
+                      tegra_admaif_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static struct platform_driver tegra_admaif_driver = {
@@ -889,7 +888,7 @@ static struct platform_driver tegra_admaif_driver = {
        .driver = {
                .name = "tegra210-admaif",
                .of_match_table = tegra_admaif_of_match,
-               .pm = &tegra_admaif_pm_ops,
+               .pm = pm_ptr(&tegra_admaif_pm_ops),
        },
 };
 module_platform_driver(tegra_admaif_driver);
index 0aa93b948378f384fdf068d7ea72cb9ecfe51f77..ff34682ebb15ebbe0427e531a1de76db344fee9c 100644 (file)
@@ -84,7 +84,7 @@ static int tegra210_adx_startup(struct snd_pcm_substream *substream,
        return 0;
 }
 
-static int __maybe_unused tegra210_adx_runtime_suspend(struct device *dev)
+static int tegra210_adx_runtime_suspend(struct device *dev)
 {
        struct tegra210_adx *adx = dev_get_drvdata(dev);
 
@@ -94,7 +94,7 @@ static int __maybe_unused tegra210_adx_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused tegra210_adx_runtime_resume(struct device *dev)
+static int tegra210_adx_runtime_resume(struct device *dev)
 {
        struct tegra210_adx *adx = dev_get_drvdata(dev);
 
@@ -524,17 +524,16 @@ static void tegra210_adx_platform_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops tegra210_adx_pm_ops = {
-       SET_RUNTIME_PM_OPS(tegra210_adx_runtime_suspend,
-                          tegra210_adx_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(tegra210_adx_runtime_suspend,
+                      tegra210_adx_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static struct platform_driver tegra210_adx_driver = {
        .driver = {
                .name = "tegra210-adx",
                .of_match_table = tegra210_adx_of_match,
-               .pm = &tegra210_adx_pm_ops,
+               .pm = pm_ptr(&tegra210_adx_pm_ops),
        },
        .probe = tegra210_adx_platform_probe,
        .remove = tegra210_adx_platform_remove,
index 1920b996e9aad3960de98b41fa8596a1532587d8..99683f292b5d849f51985e9f5c8b2b8cb47d5c49 100644 (file)
@@ -1319,7 +1319,7 @@ static const struct of_device_id tegra_ahub_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, tegra_ahub_of_match);
 
-static int __maybe_unused tegra_ahub_runtime_suspend(struct device *dev)
+static int tegra_ahub_runtime_suspend(struct device *dev)
 {
        struct tegra_ahub *ahub = dev_get_drvdata(dev);
 
@@ -1331,7 +1331,7 @@ static int __maybe_unused tegra_ahub_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused tegra_ahub_runtime_resume(struct device *dev)
+static int tegra_ahub_runtime_resume(struct device *dev)
 {
        struct tegra_ahub *ahub = dev_get_drvdata(dev);
        int err;
@@ -1408,10 +1408,9 @@ static void tegra_ahub_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops tegra_ahub_pm_ops = {
-       SET_RUNTIME_PM_OPS(tegra_ahub_runtime_suspend,
-                          tegra_ahub_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(tegra_ahub_runtime_suspend,
+                      tegra_ahub_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static struct platform_driver tegra_ahub_driver = {
@@ -1420,7 +1419,7 @@ static struct platform_driver tegra_ahub_driver = {
        .driver = {
                .name = "tegra210-ahub",
                .of_match_table = tegra_ahub_of_match,
-               .pm = &tegra_ahub_pm_ops,
+               .pm = pm_ptr(&tegra_ahub_pm_ops),
        },
 };
 module_platform_driver(tegra_ahub_driver);
index a9ef22c19e814e7a87ddc94f03140dd81ae1e84f..1981b94009cff6d38038dad8ca8fffd7b7a3d94a 100644 (file)
@@ -98,7 +98,7 @@ static int tegra210_amx_startup(struct snd_pcm_substream *substream,
        return 0;
 }
 
-static int __maybe_unused tegra210_amx_runtime_suspend(struct device *dev)
+static int tegra210_amx_runtime_suspend(struct device *dev)
 {
        struct tegra210_amx *amx = dev_get_drvdata(dev);
 
@@ -108,7 +108,7 @@ static int __maybe_unused tegra210_amx_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused tegra210_amx_runtime_resume(struct device *dev)
+static int tegra210_amx_runtime_resume(struct device *dev)
 {
        struct tegra210_amx *amx = dev_get_drvdata(dev);
 
@@ -581,17 +581,16 @@ static void tegra210_amx_platform_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops tegra210_amx_pm_ops = {
-       SET_RUNTIME_PM_OPS(tegra210_amx_runtime_suspend,
-                          tegra210_amx_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(tegra210_amx_runtime_suspend,
+                      tegra210_amx_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static struct platform_driver tegra210_amx_driver = {
        .driver = {
                .name = "tegra210-amx",
                .of_match_table = tegra210_amx_of_match,
-               .pm = &tegra210_amx_pm_ops,
+               .pm = pm_ptr(&tegra210_amx_pm_ops),
        },
        .probe = tegra210_amx_platform_probe,
        .remove = tegra210_amx_platform_remove,
index 7986be71f43d6d983bb2b495193323ba48f739b8..e4a1445712659e97c0b13c7ee6749bb320cffe06 100644 (file)
@@ -40,7 +40,7 @@ static const struct reg_default tegra210_dmic_reg_defaults[] = {
        { TEGRA210_DMIC_LP_BIQUAD_1_COEF_4, 0x0 },
 };
 
-static int __maybe_unused tegra210_dmic_runtime_suspend(struct device *dev)
+static int tegra210_dmic_runtime_suspend(struct device *dev)
 {
        struct tegra210_dmic *dmic = dev_get_drvdata(dev);
 
@@ -52,7 +52,7 @@ static int __maybe_unused tegra210_dmic_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused tegra210_dmic_runtime_resume(struct device *dev)
+static int tegra210_dmic_runtime_resume(struct device *dev)
 {
        struct tegra210_dmic *dmic = dev_get_drvdata(dev);
        int err;
@@ -543,10 +543,9 @@ static void tegra210_dmic_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops tegra210_dmic_pm_ops = {
-       SET_RUNTIME_PM_OPS(tegra210_dmic_runtime_suspend,
-                          tegra210_dmic_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(tegra210_dmic_runtime_suspend,
+                      tegra210_dmic_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static const struct of_device_id tegra210_dmic_of_match[] = {
@@ -559,7 +558,7 @@ static struct platform_driver tegra210_dmic_driver = {
        .driver = {
                .name = "tegra210-dmic",
                .of_match_table = tegra210_dmic_of_match,
-               .pm = &tegra210_dmic_pm_ops,
+               .pm = pm_ptr(&tegra210_dmic_pm_ops),
        },
        .probe = tegra210_dmic_probe,
        .remove = tegra210_dmic_remove,
index 07ce2dbe6c00a883471a468beca653c1a4895d83..766cddebd5f618068acaba8e5e4cd48b5f9294b2 100644 (file)
@@ -166,7 +166,7 @@ static int tegra210_i2s_init(struct snd_soc_dapm_widget *w,
        return tegra210_i2s_sw_reset(compnt, stream);
 }
 
-static int __maybe_unused tegra210_i2s_runtime_suspend(struct device *dev)
+static int tegra210_i2s_runtime_suspend(struct device *dev)
 {
        struct tegra210_i2s *i2s = dev_get_drvdata(dev);
 
@@ -178,7 +178,7 @@ static int __maybe_unused tegra210_i2s_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused tegra210_i2s_runtime_resume(struct device *dev)
+static int tegra210_i2s_runtime_resume(struct device *dev)
 {
        struct tegra210_i2s *i2s = dev_get_drvdata(dev);
        int err;
@@ -1010,10 +1010,9 @@ static void tegra210_i2s_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops tegra210_i2s_pm_ops = {
-       SET_RUNTIME_PM_OPS(tegra210_i2s_runtime_suspend,
-                          tegra210_i2s_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(tegra210_i2s_runtime_suspend,
+                      tegra210_i2s_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static const struct of_device_id tegra210_i2s_of_match[] = {
@@ -1026,7 +1025,7 @@ static struct platform_driver tegra210_i2s_driver = {
        .driver = {
                .name = "tegra210-i2s",
                .of_match_table = tegra210_i2s_of_match,
-               .pm = &tegra210_i2s_pm_ops,
+               .pm = pm_ptr(&tegra210_i2s_pm_ops),
        },
        .probe = tegra210_i2s_probe,
        .remove = tegra210_i2s_remove,
index 410259d98dfb30875af899ed8735080e71fba888..95d69a7e027f54637f48f3bd021b354b4411ccb5 100644 (file)
@@ -73,7 +73,7 @@ static const struct tegra210_mixer_gain_params gain_params = {
        { 0, 0, 0x400, 0x8000000 },
 };
 
-static int __maybe_unused tegra210_mixer_runtime_suspend(struct device *dev)
+static int tegra210_mixer_runtime_suspend(struct device *dev)
 {
        struct tegra210_mixer *mixer = dev_get_drvdata(dev);
 
@@ -83,7 +83,7 @@ static int __maybe_unused tegra210_mixer_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused tegra210_mixer_runtime_resume(struct device *dev)
+static int tegra210_mixer_runtime_resume(struct device *dev)
 {
        struct tegra210_mixer *mixer = dev_get_drvdata(dev);
 
@@ -666,17 +666,16 @@ static void tegra210_mixer_platform_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops tegra210_mixer_pm_ops = {
-       SET_RUNTIME_PM_OPS(tegra210_mixer_runtime_suspend,
-                          tegra210_mixer_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(tegra210_mixer_runtime_suspend,
+                      tegra210_mixer_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static struct platform_driver tegra210_mixer_driver = {
        .driver = {
                .name = "tegra210_mixer",
                .of_match_table = tegra210_mixer_of_match,
-               .pm = &tegra210_mixer_pm_ops,
+               .pm = pm_ptr(&tegra210_mixer_pm_ops),
        },
        .probe = tegra210_mixer_platform_probe,
        .remove = tegra210_mixer_platform_remove,
index 119f1750147864275366104b20a61ab65932532e..35b14c8396f4387194ed20f66fdf65b8d2d488e7 100644 (file)
@@ -47,7 +47,7 @@ static const struct tegra210_mvc_gain_params gain_params = {
        .duration_inv = 14316558,
 };
 
-static int __maybe_unused tegra210_mvc_runtime_suspend(struct device *dev)
+static int tegra210_mvc_runtime_suspend(struct device *dev)
 {
        struct tegra210_mvc *mvc = dev_get_drvdata(dev);
 
@@ -59,7 +59,7 @@ static int __maybe_unused tegra210_mvc_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused tegra210_mvc_runtime_resume(struct device *dev)
+static int tegra210_mvc_runtime_resume(struct device *dev)
 {
        struct tegra210_mvc *mvc = dev_get_drvdata(dev);
 
@@ -758,17 +758,16 @@ static void tegra210_mvc_platform_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops tegra210_mvc_pm_ops = {
-       SET_RUNTIME_PM_OPS(tegra210_mvc_runtime_suspend,
-                          tegra210_mvc_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(tegra210_mvc_runtime_suspend,
+                      tegra210_mvc_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static struct platform_driver tegra210_mvc_driver = {
        .driver = {
                .name = "tegra210-mvc",
                .of_match_table = tegra210_mvc_of_match,
-               .pm = &tegra210_mvc_pm_ops,
+               .pm = pm_ptr(&tegra210_mvc_pm_ops),
        },
        .probe = tegra210_mvc_platform_probe,
        .remove = tegra210_mvc_platform_remove,
index c595cec9baaba8d71df127328d2cb8080a9dd793..5036bcfe082892951429c219a9ffb113e6ba53ff 100644 (file)
@@ -356,7 +356,7 @@ static void tegra210_ope_remove(struct platform_device *pdev)
        pm_runtime_disable(&pdev->dev);
 }
 
-static int __maybe_unused tegra210_ope_runtime_suspend(struct device *dev)
+static int tegra210_ope_runtime_suspend(struct device *dev)
 {
        struct tegra210_ope *ope = dev_get_drvdata(dev);
 
@@ -374,7 +374,7 @@ static int __maybe_unused tegra210_ope_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused tegra210_ope_runtime_resume(struct device *dev)
+static int tegra210_ope_runtime_resume(struct device *dev)
 {
        struct tegra210_ope *ope = dev_get_drvdata(dev);
 
@@ -393,10 +393,9 @@ static int __maybe_unused tegra210_ope_runtime_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops tegra210_ope_pm_ops = {
-       SET_RUNTIME_PM_OPS(tegra210_ope_runtime_suspend,
-                          tegra210_ope_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(tegra210_ope_runtime_suspend,
+                      tegra210_ope_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static const struct of_device_id tegra210_ope_of_match[] = {
@@ -409,7 +408,7 @@ static struct platform_driver tegra210_ope_driver = {
        .driver = {
                .name = "tegra210-ope",
                .of_match_table = tegra210_ope_of_match,
-               .pm = &tegra210_ope_pm_ops,
+               .pm = pm_ptr(&tegra210_ope_pm_ops),
        },
        .probe = tegra210_ope_probe,
        .remove = tegra210_ope_remove,
index df88708c733ceff9e43f4308a34faca7ab08c36d..a0bd36f12c68fe48985499ced696ad28bb59d18d 100644 (file)
@@ -3056,7 +3056,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
        },
 };
 
-static int __maybe_unused tegra210_sfc_runtime_suspend(struct device *dev)
+static int tegra210_sfc_runtime_suspend(struct device *dev)
 {
        struct tegra210_sfc *sfc = dev_get_drvdata(dev);
 
@@ -3066,7 +3066,7 @@ static int __maybe_unused tegra210_sfc_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused tegra210_sfc_runtime_resume(struct device *dev)
+static int tegra210_sfc_runtime_resume(struct device *dev)
 {
        struct tegra210_sfc *sfc = dev_get_drvdata(dev);
 
@@ -3623,17 +3623,16 @@ static void tegra210_sfc_platform_remove(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops tegra210_sfc_pm_ops = {
-       SET_RUNTIME_PM_OPS(tegra210_sfc_runtime_suspend,
-                          tegra210_sfc_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-                               pm_runtime_force_resume)
+       RUNTIME_PM_OPS(tegra210_sfc_runtime_suspend,
+                      tegra210_sfc_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static struct platform_driver tegra210_sfc_driver = {
        .driver = {
                .name = "tegra210-sfc",
                .of_match_table = tegra210_sfc_of_match,
-               .pm = &tegra210_sfc_pm_ops,
+               .pm = pm_ptr(&tegra210_sfc_pm_ops),
        },
        .probe = tegra210_sfc_platform_probe,
        .remove = tegra210_sfc_platform_remove,