Skip to content

Commit 43a2930

Browse files
tiwaibroonie
authored andcommitted
ASoC: rockchip: Convert to RUNTIME_PM_OPS() & co
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 to drop 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-76-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 4330d33 commit 43a2930

4 files changed

Lines changed: 17 additions & 23 deletions

File tree

sound/soc/rockchip/rockchip_i2s.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,7 @@ static void rockchip_i2s_remove(struct platform_device *pdev)
860860
}
861861

862862
static const struct dev_pm_ops rockchip_i2s_pm_ops = {
863-
SET_RUNTIME_PM_OPS(i2s_runtime_suspend, i2s_runtime_resume,
864-
NULL)
863+
RUNTIME_PM_OPS(i2s_runtime_suspend, i2s_runtime_resume, NULL)
865864
};
866865

867866
static struct platform_driver rockchip_i2s_driver = {
@@ -870,7 +869,7 @@ static struct platform_driver rockchip_i2s_driver = {
870869
.driver = {
871870
.name = DRV_NAME,
872871
.of_match_table = of_match_ptr(rockchip_i2s_match),
873-
.pm = &rockchip_i2s_pm_ops,
872+
.pm = pm_ptr(&rockchip_i2s_pm_ops),
874873
},
875874
};
876875
module_platform_driver(rockchip_i2s_driver);

sound/soc/rockchip/rockchip_i2s_tdm.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static int i2s_tdm_prepare_enable_mclk(struct rk_i2s_tdm_dev *i2s_tdm)
122122
return ret;
123123
}
124124

125-
static int __maybe_unused i2s_tdm_runtime_suspend(struct device *dev)
125+
static int i2s_tdm_runtime_suspend(struct device *dev)
126126
{
127127
struct rk_i2s_tdm_dev *i2s_tdm = dev_get_drvdata(dev);
128128

@@ -134,7 +134,7 @@ static int __maybe_unused i2s_tdm_runtime_suspend(struct device *dev)
134134
return 0;
135135
}
136136

137-
static int __maybe_unused i2s_tdm_runtime_resume(struct device *dev)
137+
static int i2s_tdm_runtime_resume(struct device *dev)
138138
{
139139
struct rk_i2s_tdm_dev *i2s_tdm = dev_get_drvdata(dev);
140140
int ret;
@@ -1390,7 +1390,7 @@ static void rockchip_i2s_tdm_remove(struct platform_device *pdev)
13901390
pm_runtime_disable(&pdev->dev);
13911391
}
13921392

1393-
static int __maybe_unused rockchip_i2s_tdm_suspend(struct device *dev)
1393+
static int rockchip_i2s_tdm_suspend(struct device *dev)
13941394
{
13951395
struct rk_i2s_tdm_dev *i2s_tdm = dev_get_drvdata(dev);
13961396

@@ -1399,7 +1399,7 @@ static int __maybe_unused rockchip_i2s_tdm_suspend(struct device *dev)
13991399
return 0;
14001400
}
14011401

1402-
static int __maybe_unused rockchip_i2s_tdm_resume(struct device *dev)
1402+
static int rockchip_i2s_tdm_resume(struct device *dev)
14031403
{
14041404
struct rk_i2s_tdm_dev *i2s_tdm = dev_get_drvdata(dev);
14051405
int ret;
@@ -1414,10 +1414,8 @@ static int __maybe_unused rockchip_i2s_tdm_resume(struct device *dev)
14141414
}
14151415

14161416
static const struct dev_pm_ops rockchip_i2s_tdm_pm_ops = {
1417-
SET_RUNTIME_PM_OPS(i2s_tdm_runtime_suspend, i2s_tdm_runtime_resume,
1418-
NULL)
1419-
SET_SYSTEM_SLEEP_PM_OPS(rockchip_i2s_tdm_suspend,
1420-
rockchip_i2s_tdm_resume)
1417+
RUNTIME_PM_OPS(i2s_tdm_runtime_suspend, i2s_tdm_runtime_resume, NULL)
1418+
SYSTEM_SLEEP_PM_OPS(rockchip_i2s_tdm_suspend, rockchip_i2s_tdm_resume)
14211419
};
14221420

14231421
static struct platform_driver rockchip_i2s_tdm_driver = {
@@ -1426,7 +1424,7 @@ static struct platform_driver rockchip_i2s_tdm_driver = {
14261424
.driver = {
14271425
.name = DRV_NAME,
14281426
.of_match_table = rockchip_i2s_tdm_match,
1429-
.pm = &rockchip_i2s_tdm_pm_ops,
1427+
.pm = pm_ptr(&rockchip_i2s_tdm_pm_ops),
14301428
},
14311429
};
14321430
module_platform_driver(rockchip_i2s_tdm_driver);

sound/soc/rockchip/rockchip_pdm.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,6 @@ static void rockchip_pdm_remove(struct platform_device *pdev)
668668
clk_disable_unprepare(pdm->hclk);
669669
}
670670

671-
#ifdef CONFIG_PM_SLEEP
672671
static int rockchip_pdm_suspend(struct device *dev)
673672
{
674673
struct rk_pdm_dev *pdm = dev_get_drvdata(dev);
@@ -693,12 +692,11 @@ static int rockchip_pdm_resume(struct device *dev)
693692

694693
return ret;
695694
}
696-
#endif
697695

698696
static const struct dev_pm_ops rockchip_pdm_pm_ops = {
699-
SET_RUNTIME_PM_OPS(rockchip_pdm_runtime_suspend,
700-
rockchip_pdm_runtime_resume, NULL)
701-
SET_SYSTEM_SLEEP_PM_OPS(rockchip_pdm_suspend, rockchip_pdm_resume)
697+
RUNTIME_PM_OPS(rockchip_pdm_runtime_suspend,
698+
rockchip_pdm_runtime_resume, NULL)
699+
SYSTEM_SLEEP_PM_OPS(rockchip_pdm_suspend, rockchip_pdm_resume)
702700
};
703701

704702
static struct platform_driver rockchip_pdm_driver = {
@@ -707,7 +705,7 @@ static struct platform_driver rockchip_pdm_driver = {
707705
.driver = {
708706
.name = "rockchip-pdm",
709707
.of_match_table = of_match_ptr(rockchip_pdm_match),
710-
.pm = &rockchip_pdm_pm_ops,
708+
.pm = pm_ptr(&rockchip_pdm_pm_ops),
711709
},
712710
};
713711

sound/soc/rockchip/rockchip_spdif.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static const struct of_device_id rk_spdif_match[] __maybe_unused = {
6363
};
6464
MODULE_DEVICE_TABLE(of, rk_spdif_match);
6565

66-
static int __maybe_unused rk_spdif_runtime_suspend(struct device *dev)
66+
static int rk_spdif_runtime_suspend(struct device *dev)
6767
{
6868
struct rk_spdif_dev *spdif = dev_get_drvdata(dev);
6969

@@ -74,7 +74,7 @@ static int __maybe_unused rk_spdif_runtime_suspend(struct device *dev)
7474
return 0;
7575
}
7676

77-
static int __maybe_unused rk_spdif_runtime_resume(struct device *dev)
77+
static int rk_spdif_runtime_resume(struct device *dev)
7878
{
7979
struct rk_spdif_dev *spdif = dev_get_drvdata(dev);
8080
int ret;
@@ -374,8 +374,7 @@ static void rk_spdif_remove(struct platform_device *pdev)
374374
}
375375

376376
static const struct dev_pm_ops rk_spdif_pm_ops = {
377-
SET_RUNTIME_PM_OPS(rk_spdif_runtime_suspend, rk_spdif_runtime_resume,
378-
NULL)
377+
RUNTIME_PM_OPS(rk_spdif_runtime_suspend, rk_spdif_runtime_resume, NULL)
379378
};
380379

381380
static struct platform_driver rk_spdif_driver = {
@@ -384,7 +383,7 @@ static struct platform_driver rk_spdif_driver = {
384383
.driver = {
385384
.name = "rockchip-spdif",
386385
.of_match_table = of_match_ptr(rk_spdif_match),
387-
.pm = &rk_spdif_pm_ops,
386+
.pm = pm_ptr(&rk_spdif_pm_ops),
388387
},
389388
};
390389
module_platform_driver(rk_spdif_driver);

0 commit comments

Comments
 (0)