public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: Friday Yang <friday.yang@mediatek.com>
To: Yong Wu <yong.wu@mediatek.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Philipp Zabel <p.zabel@pengutronix.de>
Cc: Friday Yang <friday.yang@mediatek.com>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: [PATCH v6 3/3] memory: mtk-smi: mt8188: Use devm_pm_runtime_enable
Date: Tue, 8 Apr 2025 11:31:56 +0800	[thread overview]
Message-ID: <20250408033206.12176-4-friday.yang@mediatek.com> (raw)
In-Reply-To: <20250408033206.12176-1-friday.yang@mediatek.com>

Replace pm_runtime_enable with the devres-enabled version which
can trigger pm_runtime_disable.

Signed-off-by: Friday Yang <friday.yang@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



  parent reply	other threads:[~2025-04-08  3:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08  3:31 [PATCH v6 0/3] Add SMI reset and clamp for MediaTek MT8188 SoC Friday Yang
2025-04-08  3:31 ` [PATCH v6 1/3] dt-bindings: memory: mediatek: Add SMI reset and clamp for MT8188 Friday Yang
2025-04-08  6:27   ` Krzysztof Kozlowski
2025-04-08  3:31 ` [PATCH v6 2/3] memory: mtk-smi: mt8188: " Friday Yang
2025-04-08  3:31 ` Friday Yang [this message]
2025-04-08  6:29   ` [PATCH v6 3/3] memory: mtk-smi: mt8188: Use devm_pm_runtime_enable Krzysztof Kozlowski
2025-04-09  8:26     ` AngeloGioacchino Del Regno
2025-04-09  9:56       ` Krzysztof Kozlowski
2025-04-09 15:50         ` AngeloGioacchino Del Regno
2025-04-09 16:13           ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250408033206.12176-4-friday.yang@mediatek.com \
    --to=friday.yang@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=yong.wu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox