All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: linux-input@vger.kernel.org, support.opensource@diasemi.com,
	kernel@pengutronix.de
Subject: Re: [PATCH] da9052: ensure da9052_ts_input_open will not lock up on irq flood
Date: Fri, 11 Mar 2016 11:33:11 -0800	[thread overview]
Message-ID: <20160311193311.GD13175@dtor-ws> (raw)
In-Reply-To: <1457002322-21953-1-git-send-email-m.grzeschik@pengutronix.de>

On Thu, Mar 03, 2016 at 11:52:02AM +0100, Michael Grzeschik wrote:
> It is possible that da9052_ts_input_open is called and the touchscreen
> is triggering continuous interrupts. In this case we will never leave
> da9052_ts_input_open. The da9052_reg_update will never get the i2c bus
> as the interrupt handler will continuously lock it.
> 
> This patch switch places of da9052_reg_update and the setting of
> tsi->stopped. This way its ensured that da9052_ts_input_open will never
> lockup on interrupt flood.

I understand what you are saying about updating register, however I do
not understand why we would want to swap unmasking pendown event ans
clearing the "stopped" flag.

Thanks.

> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
>  drivers/input/touchscreen/da9052_tsi.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c
> index 5a013bb..1b136b8 100644
> --- a/drivers/input/touchscreen/da9052_tsi.c
> +++ b/drivers/input/touchscreen/da9052_tsi.c
> @@ -189,17 +189,20 @@ static int da9052_configure_tsi(struct da9052_tsi *tsi)
>  
>  static int da9052_ts_input_open(struct input_dev *input_dev)
>  {
> +	int val;
>  	struct da9052_tsi *tsi = input_get_drvdata(input_dev);
>  
> -	tsi->stopped = false;
> -	mb();
> +	val = da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG,
> +				 1 << 1, 1 << 1);
>  
>  	/* Unmask PEN_DOWN event */
>  	da9052_enable_irq(tsi->da9052, DA9052_IRQ_PENDOWN);
>  
> +	tsi->stopped = false;
> +	mb();
> +
>  	/* Enable Pen Detect Circuit */
> -	return da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG,
> -				 1 << 1, 1 << 1);
> +	return val;
>  }
>  
>  static void da9052_ts_input_close(struct input_dev *input_dev)
> -- 
> 2.7.0
> 

-- 
Dmitry

  reply	other threads:[~2016-03-11 19:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 10:52 [PATCH] da9052: ensure da9052_ts_input_open will not lock up on irq flood Michael Grzeschik
2016-03-11 19:33 ` Dmitry Torokhov [this message]
2016-03-19  9:12   ` Michael Grzeschik

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=20160311193311.GD13175@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-input@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    --cc=support.opensource@diasemi.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.