All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: hisi_sas: Remove useless DMA-32 fallback configuration
@ 2022-01-15  9:05 Christophe JAILLET
  2022-01-17  9:28 ` John Garry
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christophe JAILLET @ 2022-01-15  9:05 UTC (permalink / raw)
  To: John Garry, James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-scsi

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.

[1]: https://lore.kernel.org/linux-kernel/YL3vSPK5DXTNvgdx@infradead.org/#t

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c  | 3 ---
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 --
 2 files changed, 5 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index a05ec7aece5a..2f53a2ee024a 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -2666,9 +2666,6 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
 		goto err_out;
 
 	error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
-	if (error)
-		error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
-
 	if (error) {
 		dev_err(dev, "No usable DMA addressing method\n");
 		goto err_out;
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index a45ef9a5e12e..a01a3a7b706b 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -4695,8 +4695,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		goto err_out;
 
 	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
-	if (rc)
-		rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
 	if (rc) {
 		dev_err(dev, "No usable DMA addressing method\n");
 		rc = -ENODEV;
-- 
2.32.0


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

* Re: [PATCH] scsi: hisi_sas: Remove useless DMA-32 fallback configuration
  2022-01-15  9:05 [PATCH] scsi: hisi_sas: Remove useless DMA-32 fallback configuration Christophe JAILLET
@ 2022-01-17  9:28 ` John Garry
  2022-01-19  3:53 ` Martin K. Petersen
  2022-01-25  5:40 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: John Garry @ 2022-01-17  9:28 UTC (permalink / raw)
  To: Christophe JAILLET, James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, kernel-janitors, linux-scsi

On 15/01/2022 09:05, 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.
> 
> [1]: https://lore.kernel.org/linux-kernel/YL3vSPK5DXTNvgdx@infradead.org/#t
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Great, you got both callsites:

Acked-by: John Garry <john.garry@huawei.com>

> ---
>   drivers/scsi/hisi_sas/hisi_sas_main.c  | 3 ---
>   drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 --
>   2 files changed, 5 deletions(-)
> 
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
> index a05ec7aece5a..2f53a2ee024a 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_main.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
> @@ -2666,9 +2666,6 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
>   		goto err_out;
>   
>   	error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
> -	if (error)
> -		error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
> -
>   	if (error) {
>   		dev_err(dev, "No usable DMA addressing method\n");
>   		goto err_out;
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> index a45ef9a5e12e..a01a3a7b706b 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> @@ -4695,8 +4695,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>   		goto err_out;
>   
>   	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> -	if (rc)
> -		rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
>   	if (rc) {
>   		dev_err(dev, "No usable DMA addressing method\n");
>   		rc = -ENODEV;
> 


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

* Re: [PATCH] scsi: hisi_sas: Remove useless DMA-32 fallback configuration
  2022-01-15  9:05 [PATCH] scsi: hisi_sas: Remove useless DMA-32 fallback configuration Christophe JAILLET
  2022-01-17  9:28 ` John Garry
@ 2022-01-19  3:53 ` Martin K. Petersen
  2022-01-25  5:40 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-01-19  3:53 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: John Garry, James E.J. Bottomley, Martin K. Petersen,
	linux-kernel, kernel-janitors, linux-scsi


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: hisi_sas: Remove useless DMA-32 fallback configuration
  2022-01-15  9:05 [PATCH] scsi: hisi_sas: Remove useless DMA-32 fallback configuration Christophe JAILLET
  2022-01-17  9:28 ` John Garry
  2022-01-19  3:53 ` Martin K. Petersen
@ 2022-01-25  5:40 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-01-25  5:40 UTC (permalink / raw)
  To: James E.J. Bottomley, Christophe JAILLET, John Garry
  Cc: Martin K . Petersen, linux-scsi, linux-kernel, kernel-janitors

On Sat, 15 Jan 2022 10:05:22 +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.
> 
> [1]: https://lore.kernel.org/linux-kernel/YL3vSPK5DXTNvgdx@infradead.org/#t
> 
> [...]

Applied to 5.17/scsi-fixes, thanks!

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

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2022-01-25  5:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-15  9:05 [PATCH] scsi: hisi_sas: Remove useless DMA-32 fallback configuration Christophe JAILLET
2022-01-17  9:28 ` John Garry
2022-01-19  3:53 ` Martin K. Petersen
2022-01-25  5:40 ` 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.