From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Manfred Schlaegl <manfred.schlaegl@gmx.at>
Cc: Manfred Schlaegl <manfred.schlaegl@ginzinger.com>,
Luis de Bethencourt <luis@debethencourt.com>,
Olivier Sobrie <olivier@sobrie.be>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] Input: pwm-beeper - defer pwm config if pwm can sleep
Date: Mon, 22 Feb 2016 11:46:39 -0800 [thread overview]
Message-ID: <20160222194639.GD26177@dtor-ws> (raw)
In-Reply-To: <56C4735E.6020300@gmx.at>
On Wed, Feb 17, 2016 at 02:19:26PM +0100, Manfred Schlaegl wrote:
> If the pwm can sleep defer actions to it using a worker.
> A similar approach was used in leds-pwm (c971ff185)
>
> Trigger:
> On a Freescale i.MX53 based board we ran into "BUG: scheduling while
> atomic" because input_inject_event locks interrupts, but
> imx_pwm_config_v2 sleeps.
>
> Tested on Freescale i.MX53 SoC with 4.5-rc1 and 4.1.
>
> Unmodified applicable to
> * 4.5-rc4
> * 4.4.1 (stable)
> * 4.3.5 (stable)
> * 4.1.18 (longterm)
>
> Modified applicable to
> * 3.18.27 (longterm)
>
> Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
> ---
> drivers/input/misc/pwm-beeper.c | 62 +++++++++++++++++++++++++++++------------
> 1 file changed, 44 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
> index f2261ab..c160b5e 100644
> --- a/drivers/input/misc/pwm-beeper.c
> +++ b/drivers/input/misc/pwm-beeper.c
> @@ -20,21 +20,42 @@
> #include <linux/platform_device.h>
> #include <linux/pwm.h>
> #include <linux/slab.h>
> +#include <linux/workqueue.h>
>
> struct pwm_beeper {
> struct input_dev *input;
> struct pwm_device *pwm;
> + struct work_struct work;
> unsigned long period;
> + bool can_sleep;
I wonder if it is not better to always schedule work, regardless of
whether PWM may sleep or not.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2016-02-22 19:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 13:19 [PATCH] Input: pwm-beeper - defer pwm config if pwm can sleep Manfred Schlaegl
2016-02-22 19:46 ` Dmitry Torokhov [this message]
2016-02-23 8:46 ` Manfred Schlaegl
2016-03-30 14:57 ` Manfred Schlaegl
2016-05-12 12:18 ` Thierry Reding
2016-05-13 15:38 ` Manfred Schlaegl
2016-05-18 15:16 ` [PATCH] Input: pwm-beeper - fix: scheduling while atomic Manfred Schlaegl
2016-05-18 16:06 ` Greg Kroah-Hartman
2016-05-19 7:52 ` Manfred Schlaegl
2016-05-20 16:59 ` Dmitry Torokhov
2016-05-24 8:32 ` Manfred Schlaegl
2016-05-24 8:37 ` Manfred Schlaegl
2016-05-26 0:36 ` Dmitry Torokhov
2016-05-27 8:54 ` Manfred Schlaegl
2016-05-27 9:11 ` Manfred Schlaegl
2016-05-27 9:14 ` Manfred Schlaegl
2016-05-27 23:38 ` Dmitry Torokhov
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=20160222194639.GD26177@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luis@debethencourt.com \
--cc=manfred.schlaegl@ginzinger.com \
--cc=manfred.schlaegl@gmx.at \
--cc=olivier@sobrie.be \
/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).