All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Shawn Guo <shawn.guo@freescale.com>
Cc: Stefan Wahren <stefan.wahren@i2se.com>,
	Fabio Estevam <fabio.estevam@freescale.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
	Sascha Hauer <kernel@pengutronix.de>,
	linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org,
	linux-leds@vger.kernel.org
Subject: Re: MX28: leds/pwm: Using pwm driven led as heartbeat leads to kernel warning
Date: Tue, 8 Apr 2014 09:59:16 +0200	[thread overview]
Message-ID: <20140408075916.GA30127@piout.net> (raw)
In-Reply-To: <20140408073402.GC2438@dragon>

On 08/04/2014 at 15:34:04 +0800, Shawn Guo wrote :
> On Fri, Apr 04, 2014 at 06:44:47PM +0200, Alexandre Belloni wrote:
> > On 04/04/2014 at 22:26:58 +0800, Shawn Guo wrote :
> > > On Fri, Apr 04, 2014 at 03:54:52PM +0200, Stefan Wahren wrote:
> > > > the problem is still reproducable in Mainline 3.14.0 and gives the same
> > > > warning message.
> > > > Also i add linux-leds in CC.
> > > > 
> > > > Are there any advices to narrow down the problem?
> > > > 
> > > > Is this problem specific to i.MX28 PWM (i don't have other kind of
> > > > hardware)?
> > > 
> > > I don't think it's specific to i.MX28 PWM.  Since the .config hook of
> > > pwm_ops will be called from interrupt context in this case, any pwm
> > > drivers that do sleeping calls in the hook will have this problem, e.g.
> > > the clk APIs that hold mutex like clk_prepare() and clk_get_rate() etc.
> > > 
> > 
> > Yeah, I'm wondering whether we should set pwm->chip->can_sleep then.
> 
> Right, per kerneldoc of struct pwm_chip, we should set can_sleep.
> 
> /**
>  * struct pwm_chip - abstract a PWM controller
>  * ...
>  * @can_sleep: must be true if the .config(), .enable() or .disable()
>  *             operations may sleep
>  */
> 
> But how does setting the flag make a difference there?  I see pwm core
> does nothing about the flag, or am I missing something?
> 

The driver using the PWM should test the flag, have a look at:
http://lxr.free-electrons.com/source/drivers/leds/leds-pwm.c#L183


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

WARNING: multiple messages have this Message-ID (diff)
From: alexandre.belloni@free-electrons.com (Alexandre Belloni)
To: linux-arm-kernel@lists.infradead.org
Subject: MX28: leds/pwm: Using pwm driven led as heartbeat leads to kernel warning
Date: Tue, 8 Apr 2014 09:59:16 +0200	[thread overview]
Message-ID: <20140408075916.GA30127@piout.net> (raw)
In-Reply-To: <20140408073402.GC2438@dragon>

On 08/04/2014 at 15:34:04 +0800, Shawn Guo wrote :
> On Fri, Apr 04, 2014 at 06:44:47PM +0200, Alexandre Belloni wrote:
> > On 04/04/2014 at 22:26:58 +0800, Shawn Guo wrote :
> > > On Fri, Apr 04, 2014 at 03:54:52PM +0200, Stefan Wahren wrote:
> > > > the problem is still reproducable in Mainline 3.14.0 and gives the same
> > > > warning message.
> > > > Also i add linux-leds in CC.
> > > > 
> > > > Are there any advices to narrow down the problem?
> > > > 
> > > > Is this problem specific to i.MX28 PWM (i don't have other kind of
> > > > hardware)?
> > > 
> > > I don't think it's specific to i.MX28 PWM.  Since the .config hook of
> > > pwm_ops will be called from interrupt context in this case, any pwm
> > > drivers that do sleeping calls in the hook will have this problem, e.g.
> > > the clk APIs that hold mutex like clk_prepare() and clk_get_rate() etc.
> > > 
> > 
> > Yeah, I'm wondering whether we should set pwm->chip->can_sleep then.
> 
> Right, per kerneldoc of struct pwm_chip, we should set can_sleep.
> 
> /**
>  * struct pwm_chip - abstract a PWM controller
>  * ...
>  * @can_sleep: must be true if the .config(), .enable() or .disable()
>  *             operations may sleep
>  */
> 
> But how does setting the flag make a difference there?  I see pwm core
> does nothing about the flag, or am I missing something?
> 

The driver using the PWM should test the flag, have a look at:
http://lxr.free-electrons.com/source/drivers/leds/leds-pwm.c#L183


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

  reply	other threads:[~2014-04-08  7:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 17:14 MX28: leds/pwm: Using pwm driven led as heartbeat leads to kernel warning Stefan Wahren
2014-03-27 17:14 ` Stefan Wahren
2014-04-04 13:54 ` Stefan Wahren
2014-04-04 13:54   ` Stefan Wahren
2014-04-04 14:26   ` Shawn Guo
2014-04-04 14:26     ` Shawn Guo
2014-04-04 15:25     ` Stefan Wahren
2014-04-04 15:25       ` Stefan Wahren
2014-04-04 16:44     ` Alexandre Belloni
2014-04-04 16:44       ` Alexandre Belloni
2014-04-08  7:34       ` Shawn Guo
2014-04-08  7:34         ` Shawn Guo
2014-04-08  7:59         ` Alexandre Belloni [this message]
2014-04-08  7:59           ` Alexandre Belloni
2014-04-08  8:18           ` Shawn Guo
2014-04-08  8:18             ` Shawn Guo
2014-04-08  8:41             ` Alexandre Belloni
2014-04-08  8:41               ` Alexandre Belloni
2014-04-08  8:49               ` Shawn Guo
2014-04-08  8:49                 ` Shawn Guo
2014-04-08  9:04                 ` Alexandre Belloni
2014-04-08  9:04                   ` 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=20140408075916.GA30127@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=cooloney@gmail.com \
    --cc=fabio.estevam@freescale.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=shawn.guo@freescale.com \
    --cc=stefan.wahren@i2se.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.