* [PATCH] dmaengine: idxd: Simplify code and axe the use of a deprecated API
@ 2021-07-08 5:08 Christophe JAILLET
2021-07-08 14:49 ` Dave Jiang
2021-07-14 4:51 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-07-08 5:08 UTC (permalink / raw)
To: dave.jiang, vkoul
Cc: dmaengine, linux-kernel, kernel-janitors, Christophe JAILLET
The wrappers in include/linux/pci-dma-compat.h should go away.
Replace 'pci_set_dma_mask/pci_set_consistent_dma_mask' by an equivalent
and less verbose 'dma_set_mask_and_coherent()' call.
Even if the code may look different, it should have exactly the same
run-time behavior.
If pci_set_dma_mask(64) fails and pci_set_dma_mask(32) succeeds, then
pci_set_consistent_dma_mask(64) will also fail.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
If needed, see post from Christoph Hellwig on the kernel-janitors ML:
https://marc.info/?l=kernel-janitors&m=158745678307186&w=4
---
drivers/dma/idxd/init.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
index c8ae41d36040..de300ba38b14 100644
--- a/drivers/dma/idxd/init.c
+++ b/drivers/dma/idxd/init.c
@@ -637,15 +637,9 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
}
dev_dbg(dev, "Set DMA masks\n");
- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (rc)
- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
- if (rc)
- goto err;
-
- rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
- if (rc)
- rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (rc)
goto err;
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] dmaengine: idxd: Simplify code and axe the use of a deprecated API
2021-07-08 5:08 [PATCH] dmaengine: idxd: Simplify code and axe the use of a deprecated API Christophe JAILLET
@ 2021-07-08 14:49 ` Dave Jiang
2021-07-14 4:51 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Dave Jiang @ 2021-07-08 14:49 UTC (permalink / raw)
To: Christophe JAILLET, vkoul; +Cc: dmaengine, linux-kernel, kernel-janitors
On 7/7/2021 10:08 PM, Christophe JAILLET wrote:
> The wrappers in include/linux/pci-dma-compat.h should go away.
>
> Replace 'pci_set_dma_mask/pci_set_consistent_dma_mask' by an equivalent
> and less verbose 'dma_set_mask_and_coherent()' call.
>
> Even if the code may look different, it should have exactly the same
> run-time behavior.
> If pci_set_dma_mask(64) fails and pci_set_dma_mask(32) succeeds, then
> pci_set_consistent_dma_mask(64) will also fail.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Dave Jiang <dave.jiang@intel.com>
thanks.
> ---
> If needed, see post from Christoph Hellwig on the kernel-janitors ML:
> https://marc.info/?l=kernel-janitors&m=158745678307186&w=4
> ---
> drivers/dma/idxd/init.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
> index c8ae41d36040..de300ba38b14 100644
> --- a/drivers/dma/idxd/init.c
> +++ b/drivers/dma/idxd/init.c
> @@ -637,15 +637,9 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> }
>
> dev_dbg(dev, "Set DMA masks\n");
> - rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> if (rc)
> - rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
> - if (rc)
> - goto err;
> -
> - rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
> - if (rc)
> - rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> if (rc)
> goto err;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dmaengine: idxd: Simplify code and axe the use of a deprecated API
2021-07-08 5:08 [PATCH] dmaengine: idxd: Simplify code and axe the use of a deprecated API Christophe JAILLET
2021-07-08 14:49 ` Dave Jiang
@ 2021-07-14 4:51 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2021-07-14 4:51 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: dave.jiang, dmaengine, linux-kernel, kernel-janitors
On 08-07-21, 07:08, Christophe JAILLET wrote:
> The wrappers in include/linux/pci-dma-compat.h should go away.
>
> Replace 'pci_set_dma_mask/pci_set_consistent_dma_mask' by an equivalent
> and less verbose 'dma_set_mask_and_coherent()' call.
>
> Even if the code may look different, it should have exactly the same
> run-time behavior.
> If pci_set_dma_mask(64) fails and pci_set_dma_mask(32) succeeds, then
> pci_set_consistent_dma_mask(64) will also fail.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-14 4:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 5:08 [PATCH] dmaengine: idxd: Simplify code and axe the use of a deprecated API Christophe JAILLET
2021-07-08 14:49 ` Dave Jiang
2021-07-14 4:51 ` Vinod Koul
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).