[PATCH] rapidio/tsi721: Use dma_set_mask_and_coherent to simplify code

From: Christophe JAILLET
Date: Sun Jan 17 2021 - 08:47:55 EST


'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@xxxxxxxxxx>
---
drivers/rapidio/devices/tsi721.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index 4dd31dd9feea..1e296b4d7bf2 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -2836,19 +2836,12 @@ static int tsi721_probe(struct pci_dev *pdev,
}

/* Configure DMA attributes. */
- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+ if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (err) {
tsi_err(&pdev->dev, "Unable to set DMA mask");
goto err_unmap_bars;
}
-
- if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))
- tsi_info(&pdev->dev, "Unable to set consistent DMA mask");
- } else {
- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
- if (err)
- tsi_info(&pdev->dev, "Unable to set consistent DMA mask");
}

BUG_ON(!pci_is_pcie(pdev));
--
2.27.0