linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: linux-spi@vger.kernel.org, linux-rockchip@lists.infradead.org,
	Dragan Simic <dsimic@manjaro.org>
Cc: broonie@kernel.org, oss@helene.moe,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] spi: rockchip: Use dev_err_probe() in the probe path
Date: Thu, 26 Sep 2024 11:00:42 +0200	[thread overview]
Message-ID: <6673004.tM3a2QDmDi@phil> (raw)
In-Reply-To: <8bc905ff3c47ed458d8c65a031822ba6b9df8a07.1727337732.git.dsimic@manjaro.org>

Am Donnerstag, 26. September 2024, 10:38:15 CEST schrieb Dragan Simic:
> Use function dev_err_probe() in the probe path instead of dev_err() where
> appropriate, to make the code a bit more uniform and compact, and to improve
> error handling for the TX and RX DMA channel requests.
> 
> Previously, deferred requests for the TX and RX DMA channels produced no
> debug messages, and the final error messages didn't include the error codes,
> which are all highly useful when debugging permanently failed DMA channel
> requests, such as when the required drivers aren't enabled.
> 
> Suggested-by: Hélene Vulquin <oss@helene.moe>
> Signed-off-by: Dragan Simic <dsimic@manjaro.org>
> ---
>  drivers/spi/spi-rockchip.c | 25 ++++++++++++-------------
>  1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
> index 28879fed03f8..6b5c67a357bb 100644
> --- a/drivers/spi/spi-rockchip.c
> +++ b/drivers/spi/spi-rockchip.c
> @@ -853,22 +853,21 @@ static int rockchip_spi_probe(struct platform_device *pdev)
>  
>  	ctlr->dma_tx = dma_request_chan(rs->dev, "tx");
>  	if (IS_ERR(ctlr->dma_tx)) {
> -		/* Check tx to see if we need defer probing driver */
> -		if (PTR_ERR(ctlr->dma_tx) == -EPROBE_DEFER) {
> -			ret = -EPROBE_DEFER;
> +		/* Check tx to see if we need to defer driver probing */
> +		ret = dev_err_probe(rs->dev, PTR_ERR(ctlr->dma_tx),
> +				    "Failed to request TX DMA channel\n");

you're upgrading here from a warning to an error log level.
As it seems the controller may actually provide some level of functionality
even without dma, is this approriate?

Same for rx below.

Heiko

> +		if (ret == -EPROBE_DEFER)
>  			goto err_disable_pm_runtime;
> -		}
> -		dev_warn(rs->dev, "Failed to request TX DMA channel\n");
>  		ctlr->dma_tx = NULL;
>  	}
>  
>  	ctlr->dma_rx = dma_request_chan(rs->dev, "rx");
>  	if (IS_ERR(ctlr->dma_rx)) {
> -		if (PTR_ERR(ctlr->dma_rx) == -EPROBE_DEFER) {
> -			ret = -EPROBE_DEFER;
> +		/* Check rx to see if we need to defer driver probing */
> +		ret = dev_err_probe(rs->dev, PTR_ERR(ctlr->dma_rx),
> +				    "Failed to request RX DMA channel\n");
> +		if (ret == -EPROBE_DEFER)
>  			goto err_free_dma_tx;
> -		}
> -		dev_warn(rs->dev, "Failed to request RX DMA channel\n");
>  		ctlr->dma_rx = NULL;
>  	}
>  
> 





  reply	other threads:[~2024-09-26  9:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26  8:38 [PATCH 0/5] Improve error handling in Rockchip SPI drivers Dragan Simic
2024-09-26  8:38 ` [PATCH 1/5] spi: rockchip: Perform trivial code cleanups Dragan Simic
2024-09-26  8:52   ` Heiko Stuebner
2024-09-26  8:38 ` [PATCH 2/5] spi: rockchip-sfc: " Dragan Simic
2024-09-26  8:53   ` Heiko Stuebner
2024-09-26  8:38 ` [PATCH 3/5] spi: rockchip: Don't check for failed get_fifo_len() Dragan Simic
2024-09-26  8:55   ` Heiko Stuebner
2024-09-26  9:10     ` Dragan Simic
2024-09-26  9:17     ` Mark Brown
2024-09-26 10:14       ` Dragan Simic
2024-09-26  8:38 ` [PATCH 4/5] spi: rockchip: Use dev_err_probe() in the probe path Dragan Simic
2024-09-26  9:00   ` Heiko Stuebner [this message]
2024-09-26  9:21     ` Dragan Simic
2024-09-26  8:38 ` [PATCH 5/5] spi: rockchip-sfc: " Dragan Simic
2024-09-26  9:01   ` Heiko Stuebner
2024-09-30 23:51 ` (subset) [PATCH 0/5] Improve error handling in Rockchip SPI drivers Mark Brown
2024-10-01  0:05   ` Diederik de Haas
2024-10-01  2:30     ` Dragan Simic

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=6673004.tM3a2QDmDi@phil \
    --to=heiko@sntech.de \
    --cc=broonie@kernel.org \
    --cc=dsimic@manjaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=oss@helene.moe \
    /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).