Re: [PATCH] clk: Fix CLK_SET_RATE_GATE flag validation in clk_set_rate().

From: Richard Zhao
Date: Tue May 15 2012 - 18:31:39 EST

Saravana Kannan <skannan@xxxxxxxxxxxxxx> 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
>the validation. Similar to clk_set_parent(), it should instead check
>prepare count. The prepare count should go to zero only when the end
>expects the clock to not be enabled in the future. Since the code
>grabs the prepare count before validation, it's not possible for
>count to change after validation and by association not possible for a
>behaving end user to enable the clock while the set rate is in
>Signed-off-by: Saravana Kannan <skannan@xxxxxxxxxxxxxx>
>Please let me know if you don't want me to directly email or CC you in
>clock related patches. I don't want to spam anyone. Also, let me know
>you want me add you to my standard list of people to cc in my clock
> 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
> 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;
> }
>Sent by an employee of the Qualcomm Innovation Center, Inc.
>The Qualcomm Innovation Center, Inc. is a member of the Code Aurora

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at