Linux Input/HID development
 help / color / mirror / Atom feed
From: Andi Shyti <andi@etezian.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org,
	"Simon Budig" <simon.budig@kernelconcepts.de>,
	"Andi Shyti" <andi@etezian.org>,
	"Lothar Waßmann" <LW@KARO-electronics.de>,
	"Mylene Josserand" <mylene.josserand@free-electrons.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: edt-ft5x06 - fix error handling for factory mode on non-M06
Date: Wed, 24 Jan 2018 11:45:20 +0900	[thread overview]
Message-ID: <20180124024520.GC1925@brancaleone.zhora.eu> (raw)
In-Reply-To: <20180123185236.fxjqpnscgx42s5lf@dtor-ws>

Hi Dmitry,

On Tue, Jan 23, 2018 at 10:52:36AM -0800, Dmitry Torokhov wrote:
> When attempting enter factory mode on firmware that does not support it,
> we'd error out, but leave the device with interrupts disabled, and thus
> touch not working. Fix it by moving the check before we disable
> interrupts/allocate memory for debug buffers.
> 
> Fixes: fd335ab04b3f ("Input: edt-ft5x06 - add support for M09 firmware version")
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

makes sense!

Reviewed-by: Andi Shyti <andi@etezian.org>

Andi

> ---
>  drivers/input/touchscreen/edt-ft5x06.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> index c53a3d7239e72..1e18ca0d1b4e1 100644
> --- a/drivers/input/touchscreen/edt-ft5x06.c
> +++ b/drivers/input/touchscreen/edt-ft5x06.c
> @@ -511,6 +511,12 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)
>  	int ret;
>  	int error;
>  
> +	if (tsdata->version != EDT_M06) {
> +		dev_err(&client->dev,
> +			"No factory mode support for non-M06 devices\n");
> +		return -EINVAL;
> +	}
> +
>  	disable_irq(client->irq);
>  
>  	if (!tsdata->raw_buffer) {
> @@ -524,9 +530,6 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)
>  	}
>  
>  	/* mode register is 0x3c when in the work mode */
> -	if (tsdata->version != EDT_M06)
> -		goto m09_out;
> -
>  	error = edt_ft5x06_register_write(tsdata, WORK_REGISTER_OPMODE, 0x03);
>  	if (error) {
>  		dev_err(&client->dev,
> @@ -559,11 +562,6 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)
>  	enable_irq(client->irq);
>  
>  	return error;
> -
> -m09_out:
> -	dev_err(&client->dev, "No factory mode support for M09/M12/GENERIC_FT\n");
> -	return -EINVAL;
> -
>  }
>  
>  static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata)
> -- 
> 2.16.0.rc1.238.g530d649a79-goog
> 
> 
> -- 
> Dmitry

      reply	other threads:[~2018-01-24  2:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 18:52 [PATCH] Input: edt-ft5x06 - fix error handling for factory mode on non-M06 Dmitry Torokhov
2018-01-24  2:45 ` Andi Shyti [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=20180124024520.GC1925@brancaleone.zhora.eu \
    --to=andi@etezian.org \
    --cc=LW@KARO-electronics.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mylene.josserand@free-electrons.com \
    --cc=simon.budig@kernelconcepts.de \
    /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