All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Ferruh Yigit <fery@cypress.com>,
	linux-input@vger.kernel.org, Henrik Rydberg <rydberg@bitmath.org>
Subject: Re: [PATCH] Input: cyttsp - Verbose error on soft reset
Date: Mon, 22 Mar 2021 20:57:50 -0700	[thread overview]
Message-ID: <YFlnPv3m4qfSsU/a@google.com> (raw)
In-Reply-To: <20210322221349.1116666-1-linus.walleij@linaro.org>

Hi Linus,

On Mon, Mar 22, 2021 at 11:13:49PM +0100, Linus Walleij wrote:
> The first thing the Cypress driver does when starting
> up is to try a soft reset. This is the first point where
> the driver SPI/I2C communication can fail, so put out some
> nice debug text:
> 
>   cyttsp-spi spi2.0: failed to send soft reset
> 
> Instead of just:
> 
>   cyttsp-spi: probe of spi2.0 failed with error -5
> 
> This is more helpful.
> 
> Cc: Ferruh Yigit <fery@cypress.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/input/touchscreen/cyttsp_core.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c
> index 73c854f35f33..b9772192b5ea 100644
> --- a/drivers/input/touchscreen/cyttsp_core.c
> +++ b/drivers/input/touchscreen/cyttsp_core.c
> @@ -248,12 +248,16 @@ static int cyttsp_soft_reset(struct cyttsp *ts)
>  	enable_irq(ts->irq);
>  
>  	retval = ttsp_send_command(ts, CY_SOFT_RESET_MODE);
> -	if (retval)
> +	if (retval) {
> +		dev_err(ts->dev, "failed to send soft reset\n");
>  		goto out;
> +	}
>  
>  	timeout = wait_for_completion_timeout(&ts->bl_ready,
>  			msecs_to_jiffies(CY_DELAY_DFLT * CY_DELAY_MAX));
>  	retval = timeout ? 0 : -EIO;
> +	if (retval)
> +		dev_err(ts->dev, "timeout waiting for soft reset\n");

I think if we have conditional for the error message then having ternary
above does not make sense. I changed this to:

	if (!wait_for_completion_timeout(&ts->bl_ready,
			msecs_to_jiffies(CY_DELAY_DFLT * CY_DELAY_MAX))) {
		dev_err(ts->dev, "timeout waiting for soft reset\n");
		retval = -EIO;
	}

Thanks.

-- 
Dmitry

  reply	other threads:[~2021-03-23  3:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 22:13 [PATCH] Input: cyttsp - Verbose error on soft reset Linus Walleij
2021-03-23  3:57 ` Dmitry Torokhov [this message]
2021-03-24  8:26   ` Linus Walleij

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=YFlnPv3m4qfSsU/a@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=fery@cypress.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=rydberg@bitmath.org \
    /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.