linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Eddie James <eajames@linux.ibm.com>
Cc: broonie@kernel.org, linux-spi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] spi: core: Display return code when failing to transfer message
Date: Thu, 2 Jun 2022 10:22:50 +0200	[thread overview]
Message-ID: <20220602082250.s4llxsng4fecduhc@pengutronix.de> (raw)
In-Reply-To: <20220525165852.33167-3-eajames@linux.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1485 bytes --]

Hello,

On Wed, May 25, 2022 at 11:58:52AM -0500, Eddie James wrote:
> All the other calls to the controller driver display the error
> return code. The return code is helpful to understand what went
> wrong, so include it when failing to transfer one message.
> 
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
>  drivers/spi/spi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 481edea77c62..ea09d1b42bf6 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1654,7 +1654,8 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
>  	ret = ctlr->transfer_one_message(ctlr, msg);
>  	if (ret) {
>  		dev_err(&ctlr->dev,
> -			"failed to transfer one message from queue\n");
> +			"failed to transfer one message from queue: %d\n",
> +			ret);

(I know it's too late, just stumbled over this commit in mainline by
chance. So maybe just a suggestion for the next similar change...)

A tad nicer would be to use %pe instead of %d that results in

	mydev mybus: failed to transfer one message from queue: -EIO

instead of

	mydev mybus: failed to transfer one message from queue: -5

and so is more descriptive. (Note you need ERR_PTR(ret) for %pe.)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-06-02  8:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 16:58 [PATCH 0/2] spi: fsi: Fix spurious timeout Eddie James
2022-05-25 16:58 ` [PATCH 1/2] " Eddie James
2022-05-25 17:55   ` Mark Brown
2022-05-25 16:58 ` [PATCH 2/2] spi: core: Display return code when failing to transfer message Eddie James
2022-06-02  8:22   ` Uwe Kleine-König [this message]
2022-05-26 18:31 ` [PATCH 0/2] spi: fsi: Fix spurious timeout Mark Brown

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=20220602082250.s4llxsng4fecduhc@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=broonie@kernel.org \
    --cc=eajames@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.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 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).