linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Rix <trix@redhat.com>
To: Luca Ceresoli <luca@lucaceresoli.net>, linux-fpga@vger.kernel.org
Cc: Moritz Fischer <mdf@kernel.org>,
	Michal Simek <michal.simek@xilinx.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Anatolij Gustschin <agust@denx.de>
Subject: Re: [PATCH 2/3] fpga manager: xilinx-spi: provide better diagnostics on programming failure
Date: Mon, 17 Aug 2020 11:15:03 -0700	[thread overview]
Message-ID: <b1a1a9d9-d36b-40f0-24e3-f793e55db929@redhat.com> (raw)
In-Reply-To: <20200817165911.32589-2-luca@lucaceresoli.net>

The other two patches are fine.

On 8/17/20 9:59 AM, Luca Ceresoli wrote:
> When the DONE pin does not go high after programming to confirm programming
> success, the INIT_B pin provides some info on the reason. Use it if
> available to provide a more explanatory error message.
>
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> ---
>  drivers/fpga/xilinx-spi.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c
> index 502fae0d1d85..2aa942bb1114 100644
> --- a/drivers/fpga/xilinx-spi.c
> +++ b/drivers/fpga/xilinx-spi.c
> @@ -169,7 +169,16 @@ static int xilinx_spi_write_complete(struct fpga_manager *mgr,
>  			return xilinx_spi_apply_cclk_cycles(conf);
>  	}
>  
> -	dev_err(&mgr->dev, "Timeout after config data transfer.\n");
> +	if (conf->init_b) {
> +		int init_b_asserted = gpiod_get_value(conf->init_b);

gpiod_get_value can fail. So maybe need split the first statement.

init_b_asserted < 0 ? "invalid device"

As the if-else statement is getting complicated, embedding the ? : makes this hard to read.  'if,else if, else' would be better.

> +
> +		dev_err(&mgr->dev,
> +			init_b_asserted ? "CRC error or invalid device\n"
> +			: "Missing sync word or incomplete bitstream\n");
> +	} else {
> +		dev_err(&mgr->dev, "Timeout after config data transfer.\n");
patch 3 removes '.' s , and you just added one back in ?
> +	}
> +
>  	return -ETIMEDOUT;
>  }
>  

Reviewed-by: Tom Rix <trix@redhat.com>



  reply	other threads:[~2020-08-17 18:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17 16:59 [PATCH 1/3] fpga manager: xilinx-spi: remove stray comment Luca Ceresoli
2020-08-17 16:59 ` [PATCH 2/3] fpga manager: xilinx-spi: provide better diagnostics on programming failure Luca Ceresoli
2020-08-17 18:15   ` Tom Rix [this message]
2020-08-18 10:20     ` Luca Ceresoli
2020-08-18 14:21       ` Tom Rix
2020-08-19 16:32         ` Luca Ceresoli
2020-08-27 14:30           ` Luca Ceresoli
2020-08-17 16:59 ` [PATCH 3/3] fpga manager: xilinx-spi: remove final dot from dev_err() strings Luca Ceresoli
2020-08-20  4:11 ` [PATCH 1/3] fpga manager: xilinx-spi: remove stray comment Moritz Fischer
2020-08-27 14:28   ` Luca Ceresoli

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=b1a1a9d9-d36b-40f0-24e3-f793e55db929@redhat.com \
    --to=trix@redhat.com \
    --cc=agust@denx.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca@lucaceresoli.net \
    --cc=mdf@kernel.org \
    --cc=michal.simek@xilinx.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;
as well as URLs for NNTP newsgroup(s).