Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: pch_gbe: Use dma_set_mask_and_coherent to simplify code

'pci_set_dma_mask()' + 'pci_set_consistent_dma_mask()' can be replaced by
an equivalent 'dma_set_mask_and_coherent()' which is much less verbose.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20201121090302.1332491-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Christophe JAILLET and committed by
Jakub Kicinski
8ff39301 1119ea80

+4 -10
+4 -10
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
··· 2502 2502 if (ret) 2503 2503 return ret; 2504 2504 2505 - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) 2506 - || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { 2507 - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 2505 + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { 2506 + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 2508 2507 if (ret) { 2509 - ret = pci_set_consistent_dma_mask(pdev, 2510 - DMA_BIT_MASK(32)); 2511 - if (ret) { 2512 - dev_err(&pdev->dev, "ERR: No usable DMA " 2513 - "configuration, aborting\n"); 2514 - return ret; 2515 - } 2508 + dev_err(&pdev->dev, "ERR: No usable DMA configuration, aborting\n"); 2509 + return ret; 2516 2510 } 2517 2511 } 2518 2512