linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/3] clk: qcom: lpasscc-sc7810: Use devm in probe
@ 2020-10-15  0:13 Douglas Anderson
  2020-10-15  0:13 ` [PATCH v4 2/3] clk: qcom: lpass-sc7180: Disentangle the two clock devices Douglas Anderson
  2020-10-15  0:13 ` [PATCH v4 3/3] clk: qcom: lpasscc-sc7180: Re-configure the PLL in case lost Douglas Anderson
  0 siblings, 2 replies; 7+ messages in thread
From: Douglas Anderson @ 2020-10-15  0:13 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: David Brown, Taniya Das, linux-soc, Rajendra Nayak,
	Douglas Anderson, Andy Gross, Bjorn Andersson, Michael Turquette,
	linux-arm-msm, linux-clk, linux-kernel

Let's convert the lpass clock control driver to use devm.  This is a
few more lines of code, but it will be useful in a later patch which
disentangles the two devices handled by this driver.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

Changes in v4:
- Fixed typo lapss => lpass
- Moved lpass_pm_runtime_disable() lpass_pm_clk_destroy() in file.

Changes in v3:
- ("clk: qcom: lpasscc-sc7810: Use devm in probe") new for v3.

 drivers/clk/qcom/lpasscorecc-sc7180.c | 38 +++++++++++++++------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/clk/qcom/lpasscorecc-sc7180.c b/drivers/clk/qcom/lpasscorecc-sc7180.c
index 228d08f5d26f..2d15e33ec837 100644
--- a/drivers/clk/qcom/lpasscorecc-sc7180.c
+++ b/drivers/clk/qcom/lpasscorecc-sc7180.c
@@ -356,6 +356,16 @@ static const struct qcom_cc_desc lpass_audio_hm_sc7180_desc = {
 	.num_gdscs = ARRAY_SIZE(lpass_audio_hm_sc7180_gdscs),
 };
 
+static void lpass_pm_runtime_disable(void *data)
+{
+	pm_runtime_disable(data);
+}
+
+static void lpass_pm_clk_destroy(void *data)
+{
+	pm_clk_destroy(data);
+}
+
 static int lpass_core_cc_sc7180_probe(struct platform_device *pdev)
 {
 	const struct qcom_cc_desc *desc;
@@ -418,34 +428,28 @@ static int lpass_core_sc7180_probe(struct platform_device *pdev)
 	int ret;
 
 	pm_runtime_enable(&pdev->dev);
+	ret = devm_add_action_or_reset(&pdev->dev, lpass_pm_runtime_disable, &pdev->dev);
+	if (ret)
+		return ret;
+
 	ret = pm_clk_create(&pdev->dev);
 	if (ret)
-		goto disable_pm_runtime;
+		return ret;
+	ret = devm_add_action_or_reset(&pdev->dev, lpass_pm_clk_destroy, &pdev->dev);
+	if (ret)
+		return ret;
 
 	ret = pm_clk_add(&pdev->dev, "iface");
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to acquire iface clock\n");
-		goto destroy_pm_clk;
+		return ret;
 	}
 
-	ret = -EINVAL;
 	clk_probe = of_device_get_match_data(&pdev->dev);
 	if (!clk_probe)
-		goto destroy_pm_clk;
-
-	ret = clk_probe(pdev);
-	if (ret)
-		goto destroy_pm_clk;
-
-	return 0;
-
-destroy_pm_clk:
-	pm_clk_destroy(&pdev->dev);
-
-disable_pm_runtime:
-	pm_runtime_disable(&pdev->dev);
+		return -EINVAL;
 
-	return ret;
+	return clk_probe(pdev);
 }
 
 static const struct dev_pm_ops lpass_core_cc_pm_ops = {
-- 
2.28.0.1011.ga647a8990f-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-10-19 22:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15  0:13 [PATCH v4 1/3] clk: qcom: lpasscc-sc7810: Use devm in probe Douglas Anderson
2020-10-15  0:13 ` [PATCH v4 2/3] clk: qcom: lpass-sc7180: Disentangle the two clock devices Douglas Anderson
2020-10-15  0:13 ` [PATCH v4 3/3] clk: qcom: lpasscc-sc7180: Re-configure the PLL in case lost Douglas Anderson
2020-10-16  3:16   ` Stephen Boyd
2020-10-17  2:01     ` Stephen Boyd
2020-10-17  3:17       ` Doug Anderson
2020-10-19 22:38         ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).