linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Zapolskiy <vz@mleia.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	jonsmirl@gmail.com, Simon <longsleep@gmail.com>,
	linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCHv8 1/2] pwm: Add Allwinner SoC support
Date: Mon, 20 Oct 2014 20:44:09 +0300	[thread overview]
Message-ID: <544549E9.7060702@mleia.com> (raw)
In-Reply-To: <20141020170603.GG10616@piout.net>

On 20.10.2014 20:06, Alexandre Belloni wrote:
> On 20/10/2014 at 16:10:31 +0300, Vladimir Zapolskiy wrote :
>> 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?
>>
> 
> Because the PWM is getting configured from either a kernel thread or a
> userspace thread accessing /sys. So you probably want the current thread
> to sleep so the other thread accessing the register can finish. Unless
> you are on smp and then, the mutex will spin for some time and your
> other cpu will be finished by then.
> 

You answer why a thread sleeps, if you use a mutex in the driver. But
you don't answer my question why do you want to put a thread to sleep.

As for me you introduce the excessive heaviness for no reason. There is
no need to sleep while waiting for completion of a register writing.

With best wishes,
Vladimir

  parent reply	other threads:[~2014-10-20 17:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-19 18:28 [PATCHv8 0/2] Add Allwinner SoCs PWM support Alexandre Belloni
2014-10-19 18:28 ` [PATCHv8 1/2] pwm: Add Allwinner SoC support Alexandre Belloni
2014-10-19 21:22   ` Vladimir Zapolskiy
2014-10-20 10:29     ` Alexandre Belloni
2014-10-20 13:10       ` Vladimir Zapolskiy
2014-10-20 17:06         ` Alexandre Belloni
2014-10-20 17:36           ` Russell King - ARM Linux
2014-10-20 17:44           ` Vladimir Zapolskiy [this message]
2014-10-19 18:28 ` [PATCHv8 2/2] pwm: sunxi: document OF bindings Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=544549E9.7060702@mleia.com \
    --to=vz@mleia.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=jonsmirl@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=longsleep@gmail.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).