public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
From: Aniket <aniketmaurya@google.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Jeremy Kerr <jk@codeconstruct.com.au>,
	 Joel Stanley <joel@jms.id.au>,
	Billy Tsai <billy_tsai@aspeedtech.com>,
	 Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
	 devicetree@vger.kernel.org, Aniket <aniketmaurya@google.com>
Subject: [PATCH v2 3/3] i3c: dw: Use new *_enabled clk APIs
Date: Mon, 24 Jun 2024 05:28:51 +0000	[thread overview]
Message-ID: <20240624052851.1030799-4-aniketmaurya@google.com> (raw)
In-Reply-To: <20240624052851.1030799-1-aniketmaurya@google.com>

Move to "enabled" variant of clk_get APIs. It takes care
of enable and disable calls during the probe and remove.

Signed-off-by: Aniket <aniketmaurya@google.com>
---
 drivers/i3c/master/dw-i3c-master.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 41cdfd6741e3..37092b8e964f 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1466,11 +1466,11 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 	if (IS_ERR(master->regs))
 		return PTR_ERR(master->regs);
 
-	master->core_clk = devm_clk_get(&pdev->dev, NULL);
+	master->core_clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(master->core_clk))
 		return PTR_ERR(master->core_clk);
 
-	master->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
+	master->pclk = devm_clk_get_optional_enabled(&pdev->dev, "pclk");
 	if (IS_ERR(master->pclk))
 		return PTR_ERR(master->pclk);
 
@@ -1479,14 +1479,6 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 	if (IS_ERR(master->core_rst))
 		return PTR_ERR(master->core_rst);
 
-	ret = clk_prepare_enable(master->core_clk);
-	if (ret)
-		return ret;
-
-	ret = clk_prepare_enable(master->pclk);
-	if (ret)
-		goto err_disable_core_clk;
-
 	reset_control_deassert(master->core_rst);
 
 	spin_lock_init(&master->xferqueue.lock);
@@ -1528,11 +1520,6 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,
 err_assert_rst:
 	reset_control_assert(master->core_rst);
 
-	clk_disable_unprepare(master->pclk);
-
-err_disable_core_clk:
-	clk_disable_unprepare(master->core_clk);
-
 	return ret;
 }
 EXPORT_SYMBOL_GPL(dw_i3c_common_probe);
@@ -1542,10 +1529,6 @@ void dw_i3c_common_remove(struct dw_i3c_master *master)
 	i3c_master_unregister(&master->base);
 
 	reset_control_assert(master->core_rst);
-
-	clk_disable_unprepare(master->pclk);
-
-	clk_disable_unprepare(master->core_clk);
 }
 EXPORT_SYMBOL_GPL(dw_i3c_common_remove);
 
-- 
2.45.2.741.gdbec12cfda-goog


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  parent reply	other threads:[~2024-06-24  5:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 17:15 [PATCH 0/2] i3c: dw: Add APB clk Aniket
2024-06-11 17:15 ` [PATCH 1/2] dt-bindings: i3c: dw: Add clock binding Aniket
2024-06-11 18:10   ` Conor Dooley
2024-06-11 18:33   ` Rob Herring (Arm)
2024-06-11 17:16 ` [PATCH 2/2] i3c: dw: Add optional apb clock Aniket
2024-06-18 20:05   ` Alexandre Belloni
2024-06-18 20:09     ` Alexandre Belloni
2024-06-20  6:12       ` Aniket .
2024-06-22 22:27         ` Alexandre Belloni
2024-06-24  5:28 ` [PATCH v2 0/3] i3c: dw: Add apb clk Aniket
2024-06-24  5:28   ` [PATCH v2 1/3] dt-bindings: i3c: dw: Add apb clock binding Aniket
2024-06-25  5:54     ` Krzysztof Kozlowski
2024-06-25  6:59       ` Aniket .
2024-06-24  5:28   ` [PATCH v2 2/3] i3c: dw: Add optional apb clock Aniket
2024-06-24  5:28   ` Aniket [this message]
2024-06-24  5:50   ` [PATCH v2 0/3] i3c: dw: Add apb clk Krzysztof Kozlowski
2024-06-24  8:48     ` Aniket .
2024-06-27 22:12   ` Alexandre Belloni
2024-06-28 15:01     ` Aniket .
2024-06-28 15:38   ` [PATCH v3 " Aniket
2024-07-02 15:46     ` Alexandre Belloni
2024-06-28 15:45   ` [PATCH v3 1/3] dt-bindings: i3c: dw: Add apb clock binding Aniket
2024-06-28 16:30     ` Conor Dooley
2024-07-01  3:39       ` Aniket .
2024-06-28 15:46   ` [PATCH v3 2/3] i3c: dw: Use new *_enabled clk API Aniket
2024-06-28 15:46   ` [PATCH v3 3/3] i3c: dw: Add optional apb clock Aniket

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=20240624052851.1030799-4-aniketmaurya@google.com \
    --to=aniketmaurya@google.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=billy_tsai@aspeedtech.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jk@codeconstruct.com.au \
    --cc=joel@jms.id.au \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /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