Re: [PATCH] ARM: SAMSUNG: Bug fix spin_lock recursion in clk_enable() and clk_disable()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 19, 2010 at 8:09 AM, Ben Dooks <ben-linux@xxxxxxxxx> wrote:
> On 12/10/10 01:39, Jaecheol Lee wrote:
>> From: Minho Ban <mhban@xxxxxxxxxxx>
>>
>> The clk_enable() and clk_disable() can be used process and ISR either.
>> So spin_lock_irqsave should be used instead.
>>
>> Signed-off-by: Minho Ban <mhban@xxxxxxxxxxx>
>> Signed-off-by: Jaecheol Lee <jc.lee@xxxxxxxxxxx>
>> ---
>> Âarch/arm/plat-samsung/clock.c | Â 12 ++++++++----
>> Â1 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
>> index e8d20b0..2a991a5 100644
>> --- a/arch/arm/plat-samsung/clock.c
>> +++ b/arch/arm/plat-samsung/clock.c
>> @@ -138,31 +138,35 @@ void clk_put(struct clk *clk)
>>
>> Âint clk_enable(struct clk *clk)
>> Â{
>> + Â Â unsigned long flags;
>> +
>> Â Â Â if (IS_ERR(clk) || clk == NULL)
>> Â Â Â Â Â Â Â return -EINVAL;
>>
>> Â Â Â clk_enable(clk->parent);
>>
>> - Â Â spin_lock(&clocks_lock);
>> + Â Â spin_lock_irqsave(&clocks_lock, flags);
>>
>> Â Â Â if ((clk->usage++) == 0)
>> Â Â Â Â Â Â Â (clk->enable)(clk, 1);
>>
>> - Â Â spin_unlock(&clocks_lock);
>> + Â Â spin_unlock_irqrestore(&clocks_lock, flags);
>> Â Â Â return 0;
>> Â}
>>
>> Âvoid clk_disable(struct clk *clk)
>> Â{
>> + Â Â unsigned long flags;
>> +
>> Â Â Â if (IS_ERR(clk) || clk == NULL)
>> Â Â Â Â Â Â Â return;
>>
>> - Â Â spin_lock(&clocks_lock);
>> + Â Â spin_lock_irqsave(&clocks_lock, flags);
>>
>> Â Â Â if ((--clk->usage) == 0)
>> Â Â Â Â Â Â Â (clk->enable)(clk, 0);
>>
>> - Â Â spin_unlock(&clocks_lock);
>> + Â Â spin_unlock_irqrestore(&clocks_lock, flags);
>> Â Â Â clk_disable(clk->parent);
>
> I'm not sure, but I don't belive that the clk_ api has
> ever been callable from non-sleepable contexts such as
> interrupt handlers.
>
> I would welcome RMK's response (or any other response)
> about this issue?
>
> Personally, given that some clk_ calls may sleep esp.
> for pll enables, I would prefer to see this patch
> dropped in favour of fixing the users.

I tend to agree.
I would like to know any such case where enabling/disabling of some
clock is so urgent as to require doing from ISR and not from a tasklet
scheduled from ISR.
Also let us not make it impossible in future to switch to common clock api
by Jeremy Kerr, that doesn't allow calls from IRQ context.
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux