Re: [PATCHv8 1/2] pwm: Add Allwinner SoC support

From: Vladimir Zapolskiy
Date: Mon Oct 20 2014 - 09:10:42 EST


Hi Alexandre,

On 20.10.2014 13:29, Alexandre Belloni wrote:
> Hi,
>
> On 20/10/2014 at 00:22:57 +0300, Vladimir Zapolskiy wrote :
>>> +struct sun4i_pwm_chip {
>>> + struct pwm_chip chip;
>>> + struct clk *clk;
>>> + void __iomem *base;
>>> + struct mutex ctrl_lock;
>>
>> why do you use mutex? I haven't found any blocking subcalls under
>> protection, a spinlock seems to fit better here.
>>
>
> A mutex here will do the right thing. The lock is never taken in
> interrupt context and a mutex is spinning for a few cycles before
> putting the thread to sleep.

and why do you want to put a thread to sleep in context of the driver?

> I'm not sure why you feel a spinlock would be better here.
>

Only because a spinlock is lighter than a mutex.

With best wishes,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/