All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: efct: Remove useless DMA-32 fallback configuration
@ 2022-01-09 18:57 Christophe JAILLET
  2022-01-10  7:41 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christophe JAILLET @ 2022-01-09 18:57 UTC (permalink / raw)
  To: James Smart, Ram Vegesna, James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-scsi,
	target-devel

As stated in [1], dma_set_mask() with a 64-bit mask never fails if
dev->dma_mask is non-NULL.
So, if it fails, the 32 bits case will also fail for the same reason.

Simplify code and remove some dead code accordingly.

While at it, return the error code returned by dma_set_mask_and_coherent()
instead of -1.

[1]: https://lkml.org/lkml/2021/6/7/398

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch was not part of the 1st serie I've sent. So there is no
Reviewed-by tag.
---
 drivers/scsi/elx/efct/efct_driver.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/elx/efct/efct_driver.c b/drivers/scsi/elx/efct/efct_driver.c
index ae62fc3c9ee3..b08fc8839808 100644
--- a/drivers/scsi/elx/efct/efct_driver.c
+++ b/drivers/scsi/elx/efct/efct_driver.c
@@ -541,13 +541,10 @@ efct_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	pci_set_drvdata(pdev, efct);
 
-	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0) {
-		dev_warn(&pdev->dev, "trying DMA_BIT_MASK(32)\n");
-		if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) {
-			dev_err(&pdev->dev, "setting DMA_BIT_MASK failed\n");
-			rc = -1;
-			goto dma_mask_out;
-		}
+	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+	if (rc) {
+		dev_err(&pdev->dev, "setting DMA_BIT_MASK failed\n");
+		goto dma_mask_out;
 	}
 
 	num_interrupts = efct_device_interrupts_required(efct);
-- 
2.32.0


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

* Re: [PATCH] scsi: efct: Remove useless DMA-32 fallback configuration
  2022-01-09 18:57 [PATCH] scsi: efct: Remove useless DMA-32 fallback configuration Christophe JAILLET
@ 2022-01-10  7:41 ` Christoph Hellwig
  2022-01-10 15:37 ` Martin K. Petersen
  2022-01-19  4:06 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2022-01-10  7:41 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: James Smart, Ram Vegesna, James E.J. Bottomley,
	Martin K. Petersen, linux-kernel, kernel-janitors, linux-scsi,
	target-devel

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH] scsi: efct: Remove useless DMA-32 fallback configuration
  2022-01-09 18:57 [PATCH] scsi: efct: Remove useless DMA-32 fallback configuration Christophe JAILLET
  2022-01-10  7:41 ` Christoph Hellwig
@ 2022-01-10 15:37 ` Martin K. Petersen
  2022-01-19  4:06 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-01-10 15:37 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: James Smart, Ram Vegesna, James E.J. Bottomley,
	Martin K. Petersen, linux-kernel, kernel-janitors, linux-scsi,
	target-devel


Christophe,

> As stated in [1], dma_set_mask() with a 64-bit mask never fails if
> dev->dma_mask is non-NULL.  So, if it fails, the 32 bits case will
> also fail for the same reason.

Applied to 5.17/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: efct: Remove useless DMA-32 fallback configuration
  2022-01-09 18:57 [PATCH] scsi: efct: Remove useless DMA-32 fallback configuration Christophe JAILLET
  2022-01-10  7:41 ` Christoph Hellwig
  2022-01-10 15:37 ` Martin K. Petersen
@ 2022-01-19  4:06 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-01-19  4:06 UTC (permalink / raw)
  To: James Smart, Ram Vegesna, Christophe JAILLET, James E.J. Bottomley
  Cc: Martin K . Petersen, kernel-janitors, linux-kernel, target-devel,
	linux-scsi

On Sun, 9 Jan 2022 19:57:04 +0100, Christophe JAILLET wrote:

> As stated in [1], dma_set_mask() with a 64-bit mask never fails if
> dev->dma_mask is non-NULL.
> So, if it fails, the 32 bits case will also fail for the same reason.
> 
> Simplify code and remove some dead code accordingly.
> 
> While at it, return the error code returned by dma_set_mask_and_coherent()
> instead of -1.
> 
> [...]

Applied to 5.17/scsi-queue, thanks!

[1/1] scsi: efct: Remove useless DMA-32 fallback configuration
      https://git.kernel.org/mkp/scsi/c/1aa7d9799e85

-- 
Martin K. Petersen	Oracle Linux Engineering

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-09 18:57 [PATCH] scsi: efct: Remove useless DMA-32 fallback configuration Christophe JAILLET
2022-01-10  7:41 ` Christoph Hellwig
2022-01-10 15:37 ` Martin K. Petersen
2022-01-19  4:06 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.