Linux SPI subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] spi: fsl-dspi: A couple of error handling improvements
@ 2024-02-04 20:29 andy.shevchenko
  2024-02-04 20:29 ` [PATCH v2 1/2] spi: fsl-dspi: Preserve error code returned by dmaengine_slave_config() andy.shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: andy.shevchenko @ 2024-02-04 20:29 UTC (permalink / raw)
  To: Mark Brown, linux-spi, linux-kernel
  Cc: Vladimir Oltean, Minjie Du, Andy Shevchenko

A couple of error handling improvements here:
- unshadowing error code from dmaengine_slave_config()
- making error messages uniform

In v2:
- split to two patches (Vladimir)
- improved commit message in the patch 2 (Vladimir)

Andy Shevchenko (2):
  spi: fsl-dspi: Preserve error code returned by
    dmaengine_slave_config()
  spi: fsl-dspi: Unify error messaging in dspi_request_dma()

 drivers/spi/spi-fsl-dspi.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

-- 
2.43.0


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

* [PATCH v2 1/2] spi: fsl-dspi: Preserve error code returned by dmaengine_slave_config()
  2024-02-04 20:29 [PATCH v2 0/2] spi: fsl-dspi: A couple of error handling improvements andy.shevchenko
@ 2024-02-04 20:29 ` andy.shevchenko
  2024-02-05 11:11   ` Vladimir Oltean
  2024-02-04 20:29 ` [PATCH v2 2/2] spi: fsl-dspi: Unify error messaging in dspi_request_dma() andy.shevchenko
  2024-02-06 12:09 ` [PATCH v2 0/2] spi: fsl-dspi: A couple of error handling improvements Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: andy.shevchenko @ 2024-02-04 20:29 UTC (permalink / raw)
  To: Mark Brown, linux-spi, linux-kernel
  Cc: Vladimir Oltean, Minjie Du, Andy Shevchenko

dmaengine_slave_config() may return different error codes based on
the circumstances. Preserve it instead of shadowing to -EINVAL.

Suggested-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/spi/spi-fsl-dspi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index c9eae046f66c..0b5ea7a7da71 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -542,7 +542,6 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
 	ret = dmaengine_slave_config(dma->chan_rx, &cfg);
 	if (ret) {
 		dev_err(dev, "can't configure rx dma channel\n");
-		ret = -EINVAL;
 		goto err_slave_config;
 	}
 
@@ -550,7 +549,6 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
 	ret = dmaengine_slave_config(dma->chan_tx, &cfg);
 	if (ret) {
 		dev_err(dev, "can't configure tx dma channel\n");
-		ret = -EINVAL;
 		goto err_slave_config;
 	}
 
-- 
2.43.0


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

* [PATCH v2 2/2] spi: fsl-dspi: Unify error messaging in dspi_request_dma()
  2024-02-04 20:29 [PATCH v2 0/2] spi: fsl-dspi: A couple of error handling improvements andy.shevchenko
  2024-02-04 20:29 ` [PATCH v2 1/2] spi: fsl-dspi: Preserve error code returned by dmaengine_slave_config() andy.shevchenko
@ 2024-02-04 20:29 ` andy.shevchenko
  2024-02-05 11:12   ` Vladimir Oltean
  2024-02-06 12:09 ` [PATCH v2 0/2] spi: fsl-dspi: A couple of error handling improvements Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: andy.shevchenko @ 2024-02-04 20:29 UTC (permalink / raw)
  To: Mark Brown, linux-spi, linux-kernel
  Cc: Vladimir Oltean, Minjie Du, Andy Shevchenko

Use dev_err_probe() for all messages in dspi_request_dma() for the sake of
making them uniform. While at it, fix indentation issue reported by Vladimir
Oltean.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/spi/spi-fsl-dspi.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 0b5ea7a7da71..38defdcf9370 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -502,15 +502,12 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
 		return -ENOMEM;
 
 	dma->chan_rx = dma_request_chan(dev, "rx");
-	if (IS_ERR(dma->chan_rx)) {
-		return dev_err_probe(dev, PTR_ERR(dma->chan_rx),
-			"rx dma channel not available\n");
-	}
+	if (IS_ERR(dma->chan_rx))
+		return dev_err_probe(dev, PTR_ERR(dma->chan_rx), "rx dma channel not available\n");
 
 	dma->chan_tx = dma_request_chan(dev, "tx");
 	if (IS_ERR(dma->chan_tx)) {
-		ret = PTR_ERR(dma->chan_tx);
-		dev_err_probe(dev, ret, "tx dma channel not available\n");
+		ret = dev_err_probe(dev, PTR_ERR(dma->chan_tx), "tx dma channel not available\n");
 		goto err_tx_channel;
 	}
 
@@ -541,14 +538,14 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
 	cfg.direction = DMA_DEV_TO_MEM;
 	ret = dmaengine_slave_config(dma->chan_rx, &cfg);
 	if (ret) {
-		dev_err(dev, "can't configure rx dma channel\n");
+		dev_err_probe(dev, ret, "can't configure rx dma channel\n");
 		goto err_slave_config;
 	}
 
 	cfg.direction = DMA_MEM_TO_DEV;
 	ret = dmaengine_slave_config(dma->chan_tx, &cfg);
 	if (ret) {
-		dev_err(dev, "can't configure tx dma channel\n");
+		dev_err_probe(dev, ret, "can't configure tx dma channel\n");
 		goto err_slave_config;
 	}
 
-- 
2.43.0


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

* Re: [PATCH v2 1/2] spi: fsl-dspi: Preserve error code returned by dmaengine_slave_config()
  2024-02-04 20:29 ` [PATCH v2 1/2] spi: fsl-dspi: Preserve error code returned by dmaengine_slave_config() andy.shevchenko
@ 2024-02-05 11:11   ` Vladimir Oltean
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Oltean @ 2024-02-05 11:11 UTC (permalink / raw)
  To: andy.shevchenko; +Cc: Mark Brown, linux-spi, linux-kernel, Minjie Du

On Sun, Feb 04, 2024 at 10:29:18PM +0200, andy.shevchenko@gmail.com wrote:
> dmaengine_slave_config() may return different error codes based on
> the circumstances. Preserve it instead of shadowing to -EINVAL.
> 
> Suggested-by: Vladimir Oltean <olteanv@gmail.com>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

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

* Re: [PATCH v2 2/2] spi: fsl-dspi: Unify error messaging in dspi_request_dma()
  2024-02-04 20:29 ` [PATCH v2 2/2] spi: fsl-dspi: Unify error messaging in dspi_request_dma() andy.shevchenko
@ 2024-02-05 11:12   ` Vladimir Oltean
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Oltean @ 2024-02-05 11:12 UTC (permalink / raw)
  To: andy.shevchenko; +Cc: Mark Brown, linux-spi, linux-kernel, Minjie Du

On Sun, Feb 04, 2024 at 10:29:19PM +0200, andy.shevchenko@gmail.com wrote:
> Use dev_err_probe() for all messages in dspi_request_dma() for the sake of
> making them uniform. While at it, fix indentation issue reported by Vladimir
> Oltean.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

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

* Re: [PATCH v2 0/2] spi: fsl-dspi: A couple of error handling improvements
  2024-02-04 20:29 [PATCH v2 0/2] spi: fsl-dspi: A couple of error handling improvements andy.shevchenko
  2024-02-04 20:29 ` [PATCH v2 1/2] spi: fsl-dspi: Preserve error code returned by dmaengine_slave_config() andy.shevchenko
  2024-02-04 20:29 ` [PATCH v2 2/2] spi: fsl-dspi: Unify error messaging in dspi_request_dma() andy.shevchenko
@ 2024-02-06 12:09 ` Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2024-02-06 12:09 UTC (permalink / raw)
  To: linux-spi, linux-kernel, andy.shevchenko; +Cc: Vladimir Oltean, Minjie Du

On Sun, 04 Feb 2024 22:29:17 +0200, andy.shevchenko@gmail.com wrote:
> A couple of error handling improvements here:
> - unshadowing error code from dmaengine_slave_config()
> - making error messages uniform
> 
> In v2:
> - split to two patches (Vladimir)
> - improved commit message in the patch 2 (Vladimir)
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/2] spi: fsl-dspi: Preserve error code returned by dmaengine_slave_config()
      commit: f156743c526281ddcc19511e9073f8c987506913
[2/2] spi: fsl-dspi: Unify error messaging in dspi_request_dma()
      commit: 51b8e79c45d5a42891c6196dcd3f73cbb599940a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

end of thread, other threads:[~2024-02-06 12:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-04 20:29 [PATCH v2 0/2] spi: fsl-dspi: A couple of error handling improvements andy.shevchenko
2024-02-04 20:29 ` [PATCH v2 1/2] spi: fsl-dspi: Preserve error code returned by dmaengine_slave_config() andy.shevchenko
2024-02-05 11:11   ` Vladimir Oltean
2024-02-04 20:29 ` [PATCH v2 2/2] spi: fsl-dspi: Unify error messaging in dspi_request_dma() andy.shevchenko
2024-02-05 11:12   ` Vladimir Oltean
2024-02-06 12:09 ` [PATCH v2 0/2] spi: fsl-dspi: A couple of error handling improvements Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox