linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ulf.hansson@linaro.org (Ulf Hansson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/6] amba: Convert to clk_prepare_enable and clk_disable_unprepare
Date: Tue,  3 Dec 2013 11:04:30 +0100	[thread overview]
Message-ID: <1386065071-9529-6-git-send-email-ulf.hansson@linaro.org> (raw)
In-Reply-To: <1386065071-9529-1-git-send-email-ulf.hansson@linaro.org>

To simplify code and error handling let's use clk_prepare_enable
and clk_disable_unprepare. No functional change.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/amba/bus.c |   30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index b90dc1e..0477131 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -151,36 +151,18 @@ postcore_initcall(amba_init);
 
 static int amba_get_enable_pclk(struct amba_device *pcdev)
 {
-	struct clk *pclk = clk_get(&pcdev->dev, "apb_pclk");
-	int ret;
-
-	pcdev->pclk = pclk;
-
-	if (IS_ERR(pclk))
-		return PTR_ERR(pclk);
+	pcdev->pclk = clk_get(&pcdev->dev, "apb_pclk");
 
-	ret = clk_prepare(pclk);
-	if (ret) {
-		clk_put(pclk);
-		return ret;
-	}
+	if (IS_ERR(pcdev->pclk))
+		return PTR_ERR(pcdev->pclk);
 
-	ret = clk_enable(pclk);
-	if (ret) {
-		clk_unprepare(pclk);
-		clk_put(pclk);
-	}
-
-	return ret;
+	return clk_prepare_enable(pcdev->pclk);
 }
 
 static void amba_put_disable_pclk(struct amba_device *pcdev)
 {
-	struct clk *pclk = pcdev->pclk;
-
-	clk_disable(pclk);
-	clk_unprepare(pclk);
-	clk_put(pclk);
+	clk_disable_unprepare(pcdev->pclk);
+	clk_put(pcdev->pclk);
 }
 
 /*
-- 
1.7.9.5

  parent reply	other threads:[~2013-12-03 10:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 10:04 [PATCH 0/6] amba: Drop legacy PM support and some other PM improvements Ulf Hansson
2013-12-03 10:04 ` [PATCH 1/6] ALSA: AACI: Convert to modern PM ops Ulf Hansson
2013-12-03 16:45   ` Takashi Iwai
2013-12-03 10:04 ` [PATCH 2/6] serial: pl010: " Ulf Hansson
2013-12-03 10:04 ` [PATCH 3/6] serial: pl011: " Ulf Hansson
2013-12-03 10:04 ` [PATCH 4/6] amba: Drop legacy PM support and use the pm_generic functions Ulf Hansson
2013-12-03 10:04 ` Ulf Hansson [this message]
2013-12-03 10:09   ` [PATCH 5/6] amba: Convert to clk_prepare_enable and clk_disable_unprepare Russell King - ARM Linux
2013-12-03 10:35     ` Ulf Hansson
2013-12-03 10:04 ` [PATCH 6/6] amba: Add clk_prepare|unprepare in runtime PM callbacks Ulf Hansson

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=1386065071-9529-6-git-send-email-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).