Switch from pm_runtime_enable() to devm_pm_runtime_enable() to simplify
the probe function.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
---
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 24 ++++++++--------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
index b6291b7c811e..ea611730de9c 100644
--- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
+++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
@@ -1117,11 +1117,11 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, afe);
- pm_runtime_enable(&pdev->dev);
- if (!pm_runtime_enabled(&pdev->dev)) {
+ ret = devm_pm_runtime_enable(&pdev->dev);
+ if (ret) {
ret = mt8173_afe_runtime_resume(&pdev->dev);
if (ret)
- goto err_pm_disable;
+ return ret;
}
afe->reg_back_up_list = mt8173_afe_backup_list;
@@ -1133,19 +1133,17 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
&mtk_afe_pcm_platform,
NULL, 0);
if (ret)
- goto err_pm_disable;
+ return ret;
comp_pcm = devm_kzalloc(&pdev->dev, sizeof(*comp_pcm), GFP_KERNEL);
- if (!comp_pcm) {
- ret = -ENOMEM;
- goto err_pm_disable;
- }
+ if (!comp_pcm)
+ return -ENOMEM;
ret = snd_soc_component_initialize(comp_pcm,
&mt8173_afe_pcm_dai_component,
&pdev->dev);
if (ret)
- goto err_pm_disable;
+ return ret;
#ifdef CONFIG_DEBUG_FS
comp_pcm->debugfs_prefix = "pcm";
@@ -1155,7 +1153,7 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
mt8173_afe_pcm_dais,
ARRAY_SIZE(mt8173_afe_pcm_dais));
if (ret)
- goto err_pm_disable;
+ return ret;
comp_hdmi = devm_kzalloc(&pdev->dev, sizeof(*comp_hdmi), GFP_KERNEL);
if (!comp_hdmi) {
@@ -1191,18 +1189,12 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
err_cleanup_components:
snd_soc_unregister_component(&pdev->dev);
-err_pm_disable:
- pm_runtime_disable(&pdev->dev);
return ret;
}
static void mt8173_afe_pcm_dev_remove(struct platform_device *pdev)
{
snd_soc_unregister_component(&pdev->dev);
-
- pm_runtime_disable(&pdev->dev);
- if (!pm_runtime_status_suspended(&pdev->dev))
- mt8173_afe_runtime_suspend(&pdev->dev);
}
static const struct of_device_id mt8173_afe_pcm_dt_match[] = {
--
2.43.0
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]