lkml.org 
[lkml]   [2013]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] clk: Fix race condition between clk_set_parent and clk_enable()
On 05/15/2013 12:24 PM, Ulf Hansson wrote:
> On 1 May 2013 06:42, Saravana Kannan <skannan@codeaurora.org> wrote:

<snip>

>> - /* migrate prepare */
>> - if (clk->prepare_count)
>> + /*
>> + * Migrate prepare state between parents and prevent race with
>> + * clk_enable().
>> + *
>> + * If the clock is not prepared, then a race with
>> + * clk_enable/disable() is impossible since we already have the
>> + * prepare lock (future calls to clk_enable() need to be preceded by
>> + * a clk_prepare()).
>> + *
>> + * If the clock is prepared, migrate the prepared state to the new
>> + * parent and also protect against a race with clk_enable() by
>> + * forcing the clock and the new parent on. This ensures that all
>> + * future calls to clk_enable() are practically NOPs with respect to
>> + * hardware and software states.
>> + */
>
> Maybe an additional note about that since CLK_SET_PARENT_GATE is a
> prerequisite for doing migration of "prepare", we also interpreted
> this flags as it is acceptable to enable the clock(s) in this context.

Done. Sent v2 patch.

<snip>

>
> Looks good! Thanks for having another round to fixup this kind of
> tricky code. :-)

Thanks :-)

> Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
>

Thanks again.

-Saravana

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation


\
 
 \ /
  Last update: 2013-05-16 07:01    [W:0.115 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site