linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] spi: spi-imx: Use dev_err_probe for failed DMA channel requests
@ 2023-04-18  8:35 Alexander Stein
  2023-05-31  7:26 ` Alexander Stein
  2023-05-31 13:14 ` Fabio Estevam
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Stein @ 2023-04-18  8:35 UTC (permalink / raw)
  To: Mark Brown, Shawn Guo, Sascha Hauer, Fabio Estevam
  Cc: Alexander Stein, Pengutronix Kernel Team, NXP Linux Team,
	linux-spi, linux-arm-kernel

If dma_request_chan() fails, no error is shown nor any information is
shown in /sys/kernel/debug/devices_deferred if -EPROBE_DEFER is returned.
Use dev_err_probe to fix both problems.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
With this patch applied /sys/kernel/debug/devices_deferred actually
shows these lines on my platform:
30820000.spi    spi_imx: can't get the TX DMA channel!
30830000.spi    spi_imx: can't get the TX DMA channel!

 drivers/spi/spi-imx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 34e5f81ec431e..b23325a3bb667 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -1318,7 +1318,7 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx,
 	controller->dma_tx = dma_request_chan(dev, "tx");
 	if (IS_ERR(controller->dma_tx)) {
 		ret = PTR_ERR(controller->dma_tx);
-		dev_dbg(dev, "can't get the TX DMA channel, error %d!\n", ret);
+		dev_err_probe(dev, ret, "can't get the TX DMA channel!\n");
 		controller->dma_tx = NULL;
 		goto err;
 	}
@@ -1327,7 +1327,7 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx,
 	controller->dma_rx = dma_request_chan(dev, "rx");
 	if (IS_ERR(controller->dma_rx)) {
 		ret = PTR_ERR(controller->dma_rx);
-		dev_dbg(dev, "can't get the RX DMA channel, error %d\n", ret);
+		dev_err_probe(dev, ret, "can't get the RX DMA channel!\n");
 		controller->dma_rx = NULL;
 		goto err;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] spi: spi-imx: Use dev_err_probe for failed DMA channel requests
  2023-04-18  8:35 [PATCH 1/1] spi: spi-imx: Use dev_err_probe for failed DMA channel requests Alexander Stein
@ 2023-05-31  7:26 ` Alexander Stein
  2023-05-31 11:21   ` Mark Brown
  2023-05-31 13:14 ` Fabio Estevam
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Stein @ 2023-05-31  7:26 UTC (permalink / raw)
  To: Mark Brown, Shawn Guo, Sascha Hauer, Fabio Estevam
  Cc: Pengutronix Kernel Team, NXP Linux Team, linux-spi, linux-arm-kernel

Hi,

gentle ping.

Alexander

Am Dienstag, 18. April 2023, 10:35:05 CEST schrieb Alexander Stein:
> If dma_request_chan() fails, no error is shown nor any information is
> shown in /sys/kernel/debug/devices_deferred if -EPROBE_DEFER is returned.
> Use dev_err_probe to fix both problems.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> With this patch applied /sys/kernel/debug/devices_deferred actually
> shows these lines on my platform:
> 30820000.spi    spi_imx: can't get the TX DMA channel!
> 30830000.spi    spi_imx: can't get the TX DMA channel!
> 
>  drivers/spi/spi-imx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index 34e5f81ec431e..b23325a3bb667 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -1318,7 +1318,7 @@ static int spi_imx_sdma_init(struct device *dev,
> struct spi_imx_data *spi_imx, controller->dma_tx = dma_request_chan(dev,
> "tx");
>  	if (IS_ERR(controller->dma_tx)) {
>  		ret = PTR_ERR(controller->dma_tx);
> -		dev_dbg(dev, "can't get the TX DMA channel, error %d!\n", 
ret);
> +		dev_err_probe(dev, ret, "can't get the TX DMA channel!
\n");
>  		controller->dma_tx = NULL;
>  		goto err;
>  	}
> @@ -1327,7 +1327,7 @@ static int spi_imx_sdma_init(struct device *dev,
> struct spi_imx_data *spi_imx, controller->dma_rx = dma_request_chan(dev,
> "rx");
>  	if (IS_ERR(controller->dma_rx)) {
>  		ret = PTR_ERR(controller->dma_rx);
> -		dev_dbg(dev, "can't get the RX DMA channel, error %d\n", 
ret);
> +		dev_err_probe(dev, ret, "can't get the RX DMA channel!
\n");
>  		controller->dma_rx = NULL;
>  		goto err;
>  	}


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] spi: spi-imx: Use dev_err_probe for failed DMA channel requests
  2023-05-31  7:26 ` Alexander Stein
@ 2023-05-31 11:21   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2023-05-31 11:21 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, Pengutronix Kernel Team,
	NXP Linux Team, linux-spi, linux-arm-kernel

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

On Wed, May 31, 2023 at 09:26:42AM +0200, Alexander Stein wrote:
> Hi,
> 
> gentle ping.

Please don't send content free pings and please allow a reasonable time
for review.  People get busy, go on holiday, attend conferences and so 
on so unless there is some reason for urgency (like critical bug fixes)
please allow at least a couple of weeks for review.  If there have been
review comments then people may be waiting for those to be addressed.

Sending content free pings adds to the mail volume (if they are seen at
all) which is often the problem and since they can't be reviewed
directly if something has gone wrong you'll have to resend the patches
anyway, so sending again is generally a better approach though there are
some other maintainers who like them - if in doubt look at how patches
for the subsystem are normally handled.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] spi: spi-imx: Use dev_err_probe for failed DMA channel requests
  2023-04-18  8:35 [PATCH 1/1] spi: spi-imx: Use dev_err_probe for failed DMA channel requests Alexander Stein
  2023-05-31  7:26 ` Alexander Stein
@ 2023-05-31 13:14 ` Fabio Estevam
  2023-06-01 12:19   ` Alexander Stein
  1 sibling, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2023-05-31 13:14 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Mark Brown, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	NXP Linux Team, linux-spi, linux-arm-kernel

Hi Alexander,

On Tue, Apr 18, 2023 at 5:35 AM Alexander Stein
<alexander.stein@ew.tq-group.com> wrote:
>
> If dma_request_chan() fails, no error is shown nor any information is
> shown in /sys/kernel/debug/devices_deferred if -EPROBE_DEFER is returned.
> Use dev_err_probe to fix both problems.

Running spi-imx without SDMA is valid and not an error, right?

I am not sure I understood the real motivation for this patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] spi: spi-imx: Use dev_err_probe for failed DMA channel requests
  2023-05-31 13:14 ` Fabio Estevam
@ 2023-06-01 12:19   ` Alexander Stein
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Stein @ 2023-06-01 12:19 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Mark Brown, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	NXP Linux Team, linux-spi, linux-arm-kernel

Hi Fabio,

Am Mittwoch, 31. Mai 2023, 15:14:37 CEST schrieb Fabio Estevam:
> Hi Alexander,
> 
> On Tue, Apr 18, 2023 at 5:35 AM Alexander Stein
> 
> <alexander.stein@ew.tq-group.com> wrote:
> > If dma_request_chan() fails, no error is shown nor any information is
> > shown in /sys/kernel/debug/devices_deferred if -EPROBE_DEFER is returned.
> > Use dev_err_probe to fix both problems.
> 
> Running spi-imx without SDMA is valid and not an error, right?

That might be true, but this is not what this patch is about.

> I am not sure I understood the real motivation for this patch.

If the call to dma_request_chan() for either DMA channel 'rx' and 'tx' returns 
-EPROBE_DEFER, spi-imx will return that error code as well. So far so good.
You can check /sys/kernel/debug/devices_deferred to see which devices got 
deferred and not probed yet.
Without this patch spi-imx will be listed without any additional information 
about cause of the deferral. Finding the cause with no additional information 
is cumbersome, it's hidden in dev_dbg().

Using this patch additional information is provided, e.g. "can't get the TX 
DMA channel!". So you know right away spi-imx is not probing because the DMA 
channel is not available.

I hope this shows the motivation for this change.
Best regards,
Alexander

-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-01 12:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18  8:35 [PATCH 1/1] spi: spi-imx: Use dev_err_probe for failed DMA channel requests Alexander Stein
2023-05-31  7:26 ` Alexander Stein
2023-05-31 11:21   ` Mark Brown
2023-05-31 13:14 ` Fabio Estevam
2023-06-01 12:19   ` Alexander Stein

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).