linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: dfl: pci: Remove useless DMA-32 fallback configuration
@ 2022-03-18  0:59 cgel.zte
  2022-03-18 10:34 ` Xu Yilun
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-03-18  0:59 UTC (permalink / raw)
  To: hao.wu; +Cc: trix, linux-fpga, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

As stated in [1], dma_set_mask() with a 64-bit mask will never fail 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://lkml.org/lkml/2021/6/7/398

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/fpga/dfl-pci.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
index 717ac9715970..42fdfa7a28d6 100644
--- a/drivers/fpga/dfl-pci.c
+++ b/drivers/fpga/dfl-pci.c
@@ -356,8 +356,6 @@ int cci_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *pcidevid)
 	pci_set_master(pcidev);
 
 	ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64));
-	if (ret)
-		ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
 	if (ret) {
 		dev_err(&pcidev->dev, "No suitable DMA support available.\n");
 		goto disable_error_report_exit;
-- 
2.25.1


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

* Re: [PATCH] fpga: dfl: pci: Remove useless DMA-32 fallback configuration
  2022-03-18  0:59 [PATCH] fpga: dfl: pci: Remove useless DMA-32 fallback configuration cgel.zte
@ 2022-03-18 10:34 ` Xu Yilun
  0 siblings, 0 replies; 2+ messages in thread
From: Xu Yilun @ 2022-03-18 10:34 UTC (permalink / raw)
  To: cgel.zte; +Cc: hao.wu, trix, linux-fpga, linux-kernel, Minghao Chi, Zeal Robot

On Fri, Mar 18, 2022 at 12:59:38AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> As stated in [1], dma_set_mask() with a 64-bit mask will never fail if
> dev->dma_mask is non-NULL.
> So, if it fails, the 32 bits case will also fail for the same reason.

The code change is good to me, but maybe the commit message could be
improved. The reference [1] is not the best to make things clear, maybe
[2] could be better undstood. It is even better if there is a brief
introduction of the DMA API change in the commit message. It saves a lot
of time for reviewers.

I see there are plenty of similar places to change, could you make a
patchset and change them in a batch?

[2]: https://lists.linuxfoundation.org/pipermail/iommu/2019-February/033674.html

Thanks,
Yilun

> 
> Simplify code and remove some dead code accordingly.
> 
> [1]: https://lkml.org/lkml/2021/6/7/398
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>  drivers/fpga/dfl-pci.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
> index 717ac9715970..42fdfa7a28d6 100644
> --- a/drivers/fpga/dfl-pci.c
> +++ b/drivers/fpga/dfl-pci.c
> @@ -356,8 +356,6 @@ int cci_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *pcidevid)
>  	pci_set_master(pcidev);
>  
>  	ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64));
> -	if (ret)
> -		ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
>  	if (ret) {
>  		dev_err(&pcidev->dev, "No suitable DMA support available.\n");
>  		goto disable_error_report_exit;
> -- 
> 2.25.1

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

end of thread, other threads:[~2022-03-18 10:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18  0:59 [PATCH] fpga: dfl: pci: Remove useless DMA-32 fallback configuration cgel.zte
2022-03-18 10:34 ` Xu Yilun

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