From: Guenter Roeck <linux@roeck-us.net>
To: Venkat Reddy Talla <vreddytalla@nvidia.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
linux-kernel@vger.kernel.org,
Laxman Dewangan <ldewangan@nvidia.com>
Subject: Re: [PATCH 1/1] extcon: gpio: queue work only if debounce is NZ
Date: Tue, 8 Mar 2016 06:51:21 -0800 [thread overview]
Message-ID: <20160308145121.GA13839@roeck-us.net> (raw)
In-Reply-To: <1457437553-566-1-git-send-email-vreddytalla@nvidia.com>
On Tue, Mar 08, 2016 at 05:15:53PM +0530, Venkat Reddy Talla wrote:
> Use queue_delayed_work only when debounce time is
> required to read gpio state properly, read the gpio
> state and set the extcon cable state in IRQ handler
> context if gpio settling time is not needed.
>
> Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
> ---
> drivers/extcon/extcon-gpio.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
> index 279ff8f..1beb086 100644
> --- a/drivers/extcon/extcon-gpio.c
> +++ b/drivers/extcon/extcon-gpio.c
> @@ -56,8 +56,12 @@ static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
> {
> struct gpio_extcon_data *data = dev_id;
>
> - queue_delayed_work(system_power_efficient_wq, &data->work,
> + if (data->debounce_jiffies)
> + queue_delayed_work(system_power_efficient_wq, &data->work,
> data->debounce_jiffies);
> + else
> + gpio_extcon_work(&data->work.work);
> +
The interrupt is requested with devm_request_any_context_irq(), meaning
the handler may run in hard interrupt context. gpio_extcon_work() calls
gpiod_get_value_cansleep(), which may not be a good idea in hard interrupt
context.
Guenter
> return IRQ_HANDLED;
> }
>
> --
> 2.1.4
>
>
prev parent reply other threads:[~2016-03-08 15:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-08 11:45 [PATCH 1/1] extcon: gpio: queue work only if debounce is NZ Venkat Reddy Talla
2016-03-08 14:51 ` Guenter Roeck [this message]
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=20160308145121.GA13839@roeck-us.net \
--to=linux@roeck-us.net \
--cc=cw00.choi@samsung.com \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=vreddytalla@nvidia.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