[v2] linux/igb_uio: fix build with kernel 5.18+

Message ID 20221006185136.1634218-1-georgmueller@gmx.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] linux/igb_uio: fix build with kernel 5.18+ |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation warning apply issues
ci/iol-testing warning apply patch failure

Commit Message

Georg Müller Oct. 6, 2022, 6:51 p.m. UTC
  pci_set_dma_mask() and pci_set_consistent_dma_mask() were removed with
kernel 5.18. They both were just wrappers for dma_set_mask() and
dma_set_coherent_mask().

Instead, use dma_set_mask_and_coherent(), which is a combination of
dma_set_mask() and dma_set_coherent_mask().

dma_set_mask_and_coherent() exists since kernel 3.13.

Signed-off-by: Georg Müller <georgmueller@gmx.net>
---
v2: - add Signed-off-by
---
 linux/igb_uio/igb_uio.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

--
2.37.3
  

Comments

Thomas Monjalon Feb. 5, 2023, 5:59 p.m. UTC | #1
06/10/2022 20:51, Georg Müller:
> pci_set_dma_mask() and pci_set_consistent_dma_mask() were removed with
> kernel 5.18. They both were just wrappers for dma_set_mask() and
> dma_set_coherent_mask().
> 
> Instead, use dma_set_mask_and_coherent(), which is a combination of
> dma_set_mask() and dma_set_coherent_mask().
> 
> dma_set_mask_and_coherent() exists since kernel 3.13.
> 
> Signed-off-by: Georg Müller <georgmueller@gmx.net>

Applied, thanks.
  

Patch

diff --git a/linux/igb_uio/igb_uio.c b/linux/igb_uio/igb_uio.c
index 33e0e02..aea67da 100644
--- a/linux/igb_uio/igb_uio.c
+++ b/linux/igb_uio/igb_uio.c
@@ -512,18 +512,12 @@  igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 		goto fail_release_iomem;

 	/* set 64-bit DMA mask */
-	err = pci_set_dma_mask(dev,  DMA_BIT_MASK(64));
+	err = dma_set_mask_and_coherent(&dev->dev,  DMA_BIT_MASK(64));
 	if (err != 0) {
 		dev_err(&dev->dev, "Cannot set DMA mask\n");
 		goto fail_release_iomem;
 	}

-	err = pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64));
-	if (err != 0) {
-		dev_err(&dev->dev, "Cannot set consistent DMA mask\n");
-		goto fail_release_iomem;
-	}
-
 	/* fill uio infos */
 	udev->info.name = "igb_uio";
 	udev->info.version = "0.1";