[PATCH v6 3/3] memory: mtk-smi: mt8188: Use devm_pm_runtime_enable
Friday Yang
friday.yang at mediatek.com
Mon Apr 7 20:31:56 PDT 2025
Replace pm_runtime_enable with the devres-enabled version which
can trigger pm_runtime_disable.
Signed-off-by: Friday Yang <friday.yang at mediatek.com>
---
drivers/memory/mtk-smi.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index f25d46d2ef33..daef6d350419 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -713,16 +713,17 @@ static int mtk_smi_larb_probe(struct platform_device *pdev)
if (ret)
goto err_link_remove;
- pm_runtime_enable(dev);
+ ret = devm_pm_runtime_enable(dev);
+ if (ret)
+ goto err_link_remove;
+
platform_set_drvdata(pdev, larb);
ret = component_add(dev, &mtk_smi_larb_component_ops);
if (ret)
- goto err_pm_disable;
+ goto err_link_remove;
return 0;
-err_pm_disable:
- pm_runtime_disable(dev);
err_link_remove:
device_link_remove(dev, larb->smi_common_dev);
return ret;
@@ -733,7 +734,6 @@ static void mtk_smi_larb_remove(struct platform_device *pdev)
struct mtk_smi_larb *larb = platform_get_drvdata(pdev);
device_link_remove(&pdev->dev, larb->smi_common_dev);
- pm_runtime_disable(&pdev->dev);
component_del(&pdev->dev, &mtk_smi_larb_component_ops);
}
@@ -954,7 +954,10 @@ static int mtk_smi_common_probe(struct platform_device *pdev)
return ret;
}
- pm_runtime_enable(dev);
+ ret = devm_pm_runtime_enable(dev);
+ if (ret)
+ return ret;
+
platform_set_drvdata(pdev, common);
return 0;
}
@@ -965,7 +968,6 @@ static void mtk_smi_common_remove(struct platform_device *pdev)
if (common->plat->type == MTK_SMI_GEN2_SUB_COMM)
device_link_remove(&pdev->dev, common->smi_common_dev);
- pm_runtime_disable(&pdev->dev);
}
static int __maybe_unused mtk_smi_common_resume(struct device *dev)
--
2.46.0
More information about the linux-arm-kernel
mailing list