Skip to content

Commit

Permalink
pci_intf.c: buildfix for Linux 5.18
Browse files Browse the repository at this point in the history
pci_intf.c: buildfix for Linux 5.18
  • Loading branch information
kelebek333 committed Apr 24, 2022
1 parent 276ca4a commit 34a68cb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions os_dep/linux/pci_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,9 +1112,15 @@ static struct dvobj_priv *pci_dvobj_init(struct pci_dev *pdev, const struct pci_
}

#ifdef CONFIG_64BIT_DMA
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0))
if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
RTW_INFO("RTL819xCE: Using 64bit DMA\n");
err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
#else
if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
RTW_INFO("RTL819xCE: Using 64bit DMA\n");
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
#endif
if (err != 0) {
RTW_ERR("Unable to obtain 64bit DMA for consistent allocations\n");
goto disable_picdev;
Expand All @@ -1123,8 +1129,13 @@ static struct dvobj_priv *pci_dvobj_init(struct pci_dev *pdev, const struct pci_
} else
#endif
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0))
if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
#else
if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
#endif
if (err != 0) {
RTW_ERR("Unable to obtain 32bit DMA for consistent allocations\n");
goto disable_picdev;
Expand Down

0 comments on commit 34a68cb

Please sign in to comment.