Added compatibility with Linux Kernel 5.18+. Author: Karlson2k (Evgeny Grin) Gentoo bug: https://bugs.gentoo.org/852311 diff --git a/src/r8125_n.c b/src/r8125_n.c --- a/src/r8125_n.c +++ b/src/r8125_n.c @@ -11852,11 +11852,20 @@ rtl8125_init_board(struct pci_dev *pdev, if ((sizeof(dma_addr_t) > 4) && use_dac && +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { +#else // LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0) + !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) && + !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { +#endif // LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0) dev->features |= NETIF_F_HIGHDMA; } else { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); +#else // LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0) + rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); +#endif // LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0) if (rc < 0) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) if (netif_msg_probe(tp))