i40e/i40evf: Use dma_set_mask_and_coherent
In Linux 3.13, dma_set_mask_and_coherent was introduced, and we have been encouraged to use it. It simplifies the DMA mapping code a bit as well. Change-ID: I66e340245af7d0dedfa8b40fec1f5e352754432e Signed-off-by: Mitch Williams <mitch.a.williams@intel.com> Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com> Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
9347eb771e
commit
6494294f27
@ -7970,16 +7970,12 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
/* set up for high or low dma */
|
/* set up for high or low dma */
|
||||||
if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
|
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
|
||||||
/* coherent mask for the same size will always succeed if
|
if (err)
|
||||||
* dma_set_mask does
|
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
|
||||||
*/
|
if (err) {
|
||||||
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
|
dev_err(&pdev->dev,
|
||||||
} else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
|
"DMA configuration failed: 0x%x\n", err);
|
||||||
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
|
|
||||||
} else {
|
|
||||||
dev_err(&pdev->dev, "DMA configuration failed: %d\n", err);
|
|
||||||
err = -EIO;
|
|
||||||
goto err_dma;
|
goto err_dma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2182,17 +2182,12 @@ static int i40evf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
|
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
|
||||||
/* coherent mask for the same size will always succeed if
|
if (err)
|
||||||
* dma_set_mask does
|
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
|
||||||
*/
|
if (err) {
|
||||||
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
|
dev_err(&pdev->dev,
|
||||||
} else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
|
"DMA configuration failed: 0x%x\n", err);
|
||||||
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
|
|
||||||
} else {
|
|
||||||
dev_err(&pdev->dev, "%s: DMA configuration failed: %d\n",
|
|
||||||
__func__, err);
|
|
||||||
err = -EIO;
|
|
||||||
goto err_dma;
|
goto err_dma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user