linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: alexandre.belloni@free-electrons.com (Alexandre Belloni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv8 1/2] pwm: Add Allwinner SoC support
Date: Mon, 20 Oct 2014 19:06:04 +0200	[thread overview]
Message-ID: <20141020170603.GG10616@piout.net> (raw)
In-Reply-To: <544509C7.9010309@mleia.com>

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.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2014-10-20 17:06 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 [this message]
2014-10-20 17:36           ` Russell King - ARM Linux
2014-10-20 17:44           ` Vladimir Zapolskiy
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=20141020170603.GG10616@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).