diff mbox series

[v4,2/2] net/mlx4: replace pci_{,un}map_sg with dma_{,un}map_sg

Message ID 20190103172324.21748-2-swarren@wwwdotorg.org
State Accepted
Delegated to: David Miller
Headers show
Series [v4,1/2] net/mlx4: Get rid of page operation after dma_alloc_coherent | expand

Commit Message

Stephen Warren Jan. 3, 2019, 5:23 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

pci_{,un}map_sg are deprecated and replaced by dma_{,un}map_sg. This is
especially relevant since the rest of the driver uses the DMA API. Fix
the driver to use the replacement APIs.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v4: New patch.
---
 drivers/net/ethernet/mellanox/mlx4/icm.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Tariq Toukan Jan. 6, 2019, 8:29 a.m. UTC | #1
On 1/3/2019 7:23 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> pci_{,un}map_sg are deprecated and replaced by dma_{,un}map_sg. This is
> especially relevant since the rest of the driver uses the DMA API. Fix
> the driver to use the replacement APIs.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> v4: New patch.
> ---
>   drivers/net/ethernet/mellanox/mlx4/icm.c | 15 +++++++--------
>   1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c
> index 76b84d08a058..d89a3da89e5a 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/icm.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/icm.c
> @@ -57,8 +57,8 @@ static void mlx4_free_icm_pages(struct mlx4_dev *dev, struct mlx4_icm_chunk *chu
>   	int i;
>   
>   	if (chunk->nsg > 0)
> -		pci_unmap_sg(dev->persist->pdev, chunk->sg, chunk->npages,
> -			     PCI_DMA_BIDIRECTIONAL);
> +		dma_unmap_sg(&dev->persist->pdev->dev, chunk->sg, chunk->npages,
> +			     DMA_BIDIRECTIONAL);
>   
>   	for (i = 0; i < chunk->npages; ++i)
>   		__free_pages(sg_page(&chunk->sg[i]),
> @@ -204,9 +204,9 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
>   		if (coherent)
>   			++chunk->nsg;
>   		else if (chunk->npages == MLX4_ICM_CHUNK_LEN) {
> -			chunk->nsg = pci_map_sg(dev->persist->pdev, chunk->sg,
> -						chunk->npages,
> -						PCI_DMA_BIDIRECTIONAL);
> +			chunk->nsg = dma_map_sg(&dev->persist->pdev->dev,
> +						chunk->sg, chunk->npages,
> +						DMA_BIDIRECTIONAL);
>   
>   			if (chunk->nsg <= 0)
>   				goto fail;
> @@ -219,9 +219,8 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
>   	}
>   
>   	if (!coherent && chunk) {
> -		chunk->nsg = pci_map_sg(dev->persist->pdev, chunk->sg,
> -					chunk->npages,
> -					PCI_DMA_BIDIRECTIONAL);
> +		chunk->nsg = dma_map_sg(&dev->persist->pdev->dev, chunk->sg,
> +					chunk->npages, DMA_BIDIRECTIONAL);
>   
>   		if (chunk->nsg <= 0)
>   			goto fail;
> 

Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Thanks.
David Miller Jan. 7, 2019, 3:10 p.m. UTC | #2
From: Stephen Warren <swarren@wwwdotorg.org>
Date: Thu,  3 Jan 2019 10:23:24 -0700

> From: Stephen Warren <swarren@nvidia.com>
> 
> pci_{,un}map_sg are deprecated and replaced by dma_{,un}map_sg. This is
> especially relevant since the rest of the driver uses the DMA API. Fix
> the driver to use the replacement APIs.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Applied.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c
index 76b84d08a058..d89a3da89e5a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/icm.c
+++ b/drivers/net/ethernet/mellanox/mlx4/icm.c
@@ -57,8 +57,8 @@  static void mlx4_free_icm_pages(struct mlx4_dev *dev, struct mlx4_icm_chunk *chu
 	int i;
 
 	if (chunk->nsg > 0)
-		pci_unmap_sg(dev->persist->pdev, chunk->sg, chunk->npages,
-			     PCI_DMA_BIDIRECTIONAL);
+		dma_unmap_sg(&dev->persist->pdev->dev, chunk->sg, chunk->npages,
+			     DMA_BIDIRECTIONAL);
 
 	for (i = 0; i < chunk->npages; ++i)
 		__free_pages(sg_page(&chunk->sg[i]),
@@ -204,9 +204,9 @@  struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
 		if (coherent)
 			++chunk->nsg;
 		else if (chunk->npages == MLX4_ICM_CHUNK_LEN) {
-			chunk->nsg = pci_map_sg(dev->persist->pdev, chunk->sg,
-						chunk->npages,
-						PCI_DMA_BIDIRECTIONAL);
+			chunk->nsg = dma_map_sg(&dev->persist->pdev->dev,
+						chunk->sg, chunk->npages,
+						DMA_BIDIRECTIONAL);
 
 			if (chunk->nsg <= 0)
 				goto fail;
@@ -219,9 +219,8 @@  struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
 	}
 
 	if (!coherent && chunk) {
-		chunk->nsg = pci_map_sg(dev->persist->pdev, chunk->sg,
-					chunk->npages,
-					PCI_DMA_BIDIRECTIONAL);
+		chunk->nsg = dma_map_sg(&dev->persist->pdev->dev, chunk->sg,
+					chunk->npages, DMA_BIDIRECTIONAL);
 
 		if (chunk->nsg <= 0)
 			goto fail;