From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2 v2] [ARM] [IMX]: Fix clock use counter from underflow on multiple clk_disable().
Date: Thu, 18 Mar 2010 09:30:04 +0100 [thread overview]
Message-ID: <20100318083004.GA1369@pengutronix.de> (raw)
In-Reply-To: <1268823811-9035-1-git-send-email-vzapolskiy@gmail.com>
Hi Vladimir,
On Wed, Mar 17, 2010 at 02:03:31PM +0300, Vladimir Zapolskiy wrote:
> If clk_disable() is called for already disabled clock clk->usecount
> value is decremented anyway. This leads to a problem that sequent
> clk_enable() call doesn't enable the clock as expected.
>
> Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
> arch/arm/plat-mxc/clock.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/plat-mxc/clock.c b/arch/arm/plat-mxc/clock.c
> index 2daec3c..3189275 100644
> --- a/arch/arm/plat-mxc/clock.c
> +++ b/arch/arm/plat-mxc/clock.c
> @@ -53,10 +53,14 @@ static void __clk_disable(struct clk *clk)
> if (clk == NULL || IS_ERR(clk))
> return;
>
> + if (!clk->usecount) {
> + WARN(1, "Trying to disable a clock with 0 usecount\n");
> + return;
> + }
> +
The advantage of just using
WARN(!clk->usecount, "Trying to disable a disabled clock\n");
is that the error isn't caught and so is more likely to be fixed :-)
I'n not a native English speaker, but I think "Trying to disable a clock
with 0 usecount" isn't a proper English sentence.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2010-03-18 8:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-17 7:11 [PATCH 1/2] [ARM] [IMX]: Removed superfluous checks for argument validity Vladimir Zapolskiy
2010-03-17 7:11 ` [PATCH 2/2] [ARM] [IMX]: Fix clock usecount counter from underflow Vladimir Zapolskiy
2010-03-17 9:20 ` Uwe Kleine-König
2010-03-17 10:15 ` javier Martin
2010-03-17 10:57 ` Vladimir Zapolskiy
2010-03-17 11:03 ` [PATCH 2/2 v2] [ARM] [IMX]: Fix clock use counter from underflow on multiple clk_disable() Vladimir Zapolskiy
2010-03-18 8:30 ` Uwe Kleine-König [this message]
2010-03-18 13:21 ` Vladimir Zapolskiy
2010-03-17 9:13 ` [PATCH 1/2] [ARM] [IMX]: Removed superfluous checks for argument validity Uwe Kleine-König
2010-03-17 10:34 ` Vladimir Zapolskiy
2010-03-18 8:37 ` Uwe Kleine-König
2010-03-18 13:07 ` Vladimir Zapolskiy
2010-03-18 13:27 ` [PATCH 1/2 v2] imx: optimize __clk_enable() and __clk_disable() functions Vladimir Zapolskiy
2010-03-18 14:23 ` Vladimir Zapolskiy
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=20100318083004.GA1369@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--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).