Skip to content

Commit

Permalink
clk: Fix CLK_SET_RATE_GATE flag validation in clk_set_rate().
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Richard Zhao <richard.zhao@freescale.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
  • Loading branch information
Saravana Kannan authored and Mike Turquette committed May 16, 2012
1 parent 1df5c93 commit 7e0fa1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/clk/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
ret = -EBUSY;
goto out;
}
Expand Down

0 comments on commit 7e0fa1b

Please sign in to comment.