mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Zhao <richard.zhao@linaro.org>
To: Saravana Kannan <skannan@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	Mike Turquette <mturquette@linaro.org>,
	Paul Walmsley <paul@pwsan.com>,
	Shawn Guo <shawn.guo@freescale.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Rob Herring <rob.herring@calxeda.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Russell King <linux@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Andrew Lunn <andrew@lunn.ch>,
	Jeremy Kerr <jeremy.kerr@canonical.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Arnd Bergman <arnd.bergmann@linaro.org>,
	Jamie Iles <jamie@jamieiles.com>,
	Magnus Damm <magnus.damm@gmail.com>,
	Linus Walleij <linus.walleij@stericsson.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Amit Kucheria <amit.kucheria@linaro.org>,
	Deepak Saxena <dsaxena@linaro.org>,
	Grant Likely <grant.likely@secretlab.ca>
Subject: Re: [PATCH] clk: Fix CLK_SET_RATE_GATE flag validation in clk_set_rate().
Date: Wed, 16 May 2012 06:31:23 +0800	[thread overview]
Message-ID: <258a747f-c7d8-4f15-8446-2c18fe21ccf3@email.android.com> (raw)
In-Reply-To: <1337114622-11292-1-git-send-email-skannan@codeaurora.org>



Saravana Kannan <skannan@codeaurora.org> wrote:

>The clk_set_rate() code shouldn't check the clock's enable count when
>validating CLK_SET_RATE_GATE flag since the enable count could change
>after
>the validation. Similar to clk_set_parent(), it should instead check
>the
>prepare count. The prepare count should go to zero only when the end
>user
>expects the clock to not be enabled in the future. Since the code
>already
>grabs the prepare count before validation, it's not possible for
>prepare
>count to change after validation and by association not possible for a
>well
>behaving end user to enable the clock while the set rate is in
>progress.
>
>Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
>---
>Please let me know if you don't want me to directly email or CC you in
>my
>clock related patches. I don't want to spam anyone. Also, let me know
>if
>you want me add you to my standard list of people to cc in my clock
>patches.
>
> drivers/clk/clk.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
>index 09b9112..f5b9d3c 100644
>--- a/drivers/clk/clk.c
>+++ b/drivers/clk/clk.c
>@@ -903,7 +903,7 @@ int clk_set_rate(struct clk *clk, unsigned long
>rate)
> 	if (rate == clk->rate)
> 		goto out;
> 
>-	if ((clk->flags & CLK_SET_RATE_GATE) && __clk_is_enabled(clk)) {
>+	if ((clk->flags & CLK_SET_RATE_GATE) && clk->prepare_count) {
The condition becomes more strict. Looks good.

> 		ret = -EBUSY;
> 		goto out;
> 	}
>-- 
>1.7.8.3
>
>Sent by an employee of the Qualcomm Innovation Center, Inc.
>The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
>Forum.


  reply	other threads:[~2012-05-15 22:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-12  4:59 [PATCH] clk: Fix race conditions between clk_set_parent() and clk_enable() Saravana Kannan
2012-05-15 18:20 ` Saravana Kannan
2012-05-22 13:58   ` Peter De Schrijver
2012-05-22 18:06     ` Turquette, Mike
2012-05-23  9:16       ` Peter De Schrijver
2012-05-31  3:46         ` Saravana Kannan
2012-05-15 19:42 ` Sascha Hauer
2012-05-15 19:51   ` Saravana Kannan
2012-05-15 20:00     ` Sascha Hauer
2012-05-15 20:09       ` Saravana Kannan
2012-05-16  5:59         ` Turquette, Mike
2012-05-16  9:19           ` skannan
2012-05-15 20:43 ` [PATCH] clk: Fix CLK_SET_RATE_GATE flag validation in clk_set_rate() Saravana Kannan
2012-05-15 22:31   ` Richard Zhao [this message]
2012-05-16  0:25   ` Richard Zhao
2012-05-16  5:40     ` Turquette, Mike
2012-05-16  6:00 ` [PATCH] clk: Fix race conditions between clk_set_parent() and clk_enable() Turquette, Mike
2012-05-16  7:30   ` Linus Walleij

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=258a747f-c7d8-4f15-8446-2c18fe21ccf3@email.android.com \
    --to=richard.zhao@linaro.org \
    --cc=amit.kucheria@linaro.org \
    --cc=andrew@lunn.ch \
    --cc=arnd.bergmann@linaro.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dsaxena@linaro.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jamie@jamieiles.com \
    --cc=jeremy.kerr@canonical.com \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=magnus.damm@gmail.com \
    --cc=mturquette@linaro.org \
    --cc=paul@pwsan.com \
    --cc=rob.herring@calxeda.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@codeaurora.org \
    --cc=shawn.guo@freescale.com \
    --cc=skannan@codeaurora.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®