public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Walmsley <paul@pwsan.com>
To: linux-omap@vger.kernel.org
Cc: Paul Walmsley <paul@pwsan.com>
Subject: [PATCH 7/7] OMAP2/3 clock: add clock abort-rate-change notifications
Date: Tue, 23 Dec 2008 03:13:56 -0700	[thread overview]
Message-ID: <20081223101355.22979.12267.stgit@localhost.localdomain> (raw)
In-Reply-To: <20081223101116.22979.53805.stgit@localhost.localdomain>

Call clock notifiers with the CLK_ABORT_RATE_CHANGE message in two
conditions:

- in the PREPARE phase when another callback has denied the rate/parent
  change; or

- in the PRE phase if the set_rate() or set_parent() function fails.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/clock.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 50d8e06..1600119 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -804,6 +804,7 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)
 	if (r == NOTIFY_BAD) {
 		pr_debug("clock: %s: clk_set_rate() aborted by notifier\n",
 			 clk->name);
+		omap_clk_notify_downstream(clk, CLK_ABORT_RATE_CHANGE);
 		return -EAGAIN;
 	}
 
@@ -814,10 +815,16 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)
 
 	ret = clk->set_rate(clk, rate);
 
-	temp_rate = clk->rate;
-	clk->rate = clk->temp_rate;
-	omap_clk_notify_downstream(clk, CLK_POST_RATE_CHANGE);
-	clk->rate = temp_rate;
+	if (ret == 0) {
+		temp_rate = clk->rate;
+		clk->rate = clk->temp_rate;
+		omap_clk_notify_downstream(clk, CLK_POST_RATE_CHANGE);
+		clk->rate = temp_rate;
+	} else {
+		pr_debug("clock: %s: clk_set_rate() aborted by failed "
+			 "set_rate(): %d\n", clk->name, ret);
+		omap_clk_notify_downstream(clk, CLK_ABORT_RATE_CHANGE);
+	}
 
 	return ret;
 }
@@ -883,6 +890,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
 	if (r == NOTIFY_BAD) {
 		pr_debug("clock: %s: clk_set_parent() aborted by notifier\n",
 			 clk->name);
+		omap_clk_notify_downstream(clk, CLK_ABORT_RATE_CHANGE);
 		return -EAGAIN;
 	}
 



  parent reply	other threads:[~2008-12-23 10:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-23 10:13 [PATCH 0/7] OMAP2/3 clock: implement clock rate change notifiers Paul Walmsley
2008-12-23 10:13 ` [PATCH 1/7] OMAP2/3 clock: implement clock notifier infrastructure Paul Walmsley
2008-12-23 10:13 ` [PATCH 2/7] OMAP clock: add " Paul Walmsley
2008-12-23 10:13 ` [PATCH 3/7] OMAP2/3 clock: store planned clock rates into temporary rate storage Paul Walmsley
2008-12-23 10:13 ` [PATCH 4/7] OMAP2/3 clock: add clk post-rate-change notifiers Paul Walmsley
2008-12-23 10:13 ` [PATCH 6/7] OMAP2/3 clock: add clock prepare-rate-change notifications Paul Walmsley
2008-12-23 10:13 ` [PATCH 5/7] OMAP2/3 clock: add clock pre-rate-change notification Paul Walmsley
2008-12-23 10:13 ` Paul Walmsley [this message]
2009-01-13 17:01 ` [PATCH 0/7] OMAP2/3 clock: implement clock rate change notifiers Kevin Hilman

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=20081223101355.22979.12267.stgit@localhost.localdomain \
    --to=paul@pwsan.com \
    --cc=linux-omap@vger.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