diff options
author | Luis Chamberlain <mcgrof@kernel.org> | 2019-01-04 03:23:09 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2019-01-08 07:58:37 -0500 |
commit | 750afb08ca71310fcf0c4e2cb1565c63b8235b60 (patch) | |
tree | 1dde3877eb4a1a0f0349786b66c3d9276ae94561 /drivers/net/ethernet/broadcom | |
parent | 3bd6e94bec122a951d462c239b47954cf5f36e33 (diff) |
cross-tree: phase out dma_zalloc_coherent()
We already need to zero out memory for dma_alloc_coherent(), as such
using dma_zalloc_coherent() is superflous. Phase it out.
This change was generated with the following Coccinelle SmPL patch:
@ replace_dma_zalloc_coherent @
expression dev, size, data, handle, flags;
@@
-dma_zalloc_coherent(dev, size, handle, flags)
+dma_alloc_coherent(dev, size, handle, flags)
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
[hch: re-ran the script on the latest tree]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r-- | drivers/net/ethernet/broadcom/bcm63xx_enet.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bcmsysport.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bgmac.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt.c | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 22 |
8 files changed, 37 insertions, 37 deletions
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index 6bae973d4dce..09cd188826b1 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c | |||
@@ -936,7 +936,7 @@ static int bcm_enet_open(struct net_device *dev) | |||
936 | 936 | ||
937 | /* allocate rx dma ring */ | 937 | /* allocate rx dma ring */ |
938 | size = priv->rx_ring_size * sizeof(struct bcm_enet_desc); | 938 | size = priv->rx_ring_size * sizeof(struct bcm_enet_desc); |
939 | p = dma_zalloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL); | 939 | p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL); |
940 | if (!p) { | 940 | if (!p) { |
941 | ret = -ENOMEM; | 941 | ret = -ENOMEM; |
942 | goto out_freeirq_tx; | 942 | goto out_freeirq_tx; |
@@ -947,7 +947,7 @@ static int bcm_enet_open(struct net_device *dev) | |||
947 | 947 | ||
948 | /* allocate tx dma ring */ | 948 | /* allocate tx dma ring */ |
949 | size = priv->tx_ring_size * sizeof(struct bcm_enet_desc); | 949 | size = priv->tx_ring_size * sizeof(struct bcm_enet_desc); |
950 | p = dma_zalloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL); | 950 | p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL); |
951 | if (!p) { | 951 | if (!p) { |
952 | ret = -ENOMEM; | 952 | ret = -ENOMEM; |
953 | goto out_free_rx_ring; | 953 | goto out_free_rx_ring; |
@@ -2120,7 +2120,7 @@ static int bcm_enetsw_open(struct net_device *dev) | |||
2120 | 2120 | ||
2121 | /* allocate rx dma ring */ | 2121 | /* allocate rx dma ring */ |
2122 | size = priv->rx_ring_size * sizeof(struct bcm_enet_desc); | 2122 | size = priv->rx_ring_size * sizeof(struct bcm_enet_desc); |
2123 | p = dma_zalloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL); | 2123 | p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL); |
2124 | if (!p) { | 2124 | if (!p) { |
2125 | dev_err(kdev, "cannot allocate rx ring %u\n", size); | 2125 | dev_err(kdev, "cannot allocate rx ring %u\n", size); |
2126 | ret = -ENOMEM; | 2126 | ret = -ENOMEM; |
@@ -2132,7 +2132,7 @@ static int bcm_enetsw_open(struct net_device *dev) | |||
2132 | 2132 | ||
2133 | /* allocate tx dma ring */ | 2133 | /* allocate tx dma ring */ |
2134 | size = priv->tx_ring_size * sizeof(struct bcm_enet_desc); | 2134 | size = priv->tx_ring_size * sizeof(struct bcm_enet_desc); |
2135 | p = dma_zalloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL); | 2135 | p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL); |
2136 | if (!p) { | 2136 | if (!p) { |
2137 | dev_err(kdev, "cannot allocate tx ring\n"); | 2137 | dev_err(kdev, "cannot allocate tx ring\n"); |
2138 | ret = -ENOMEM; | 2138 | ret = -ENOMEM; |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 4574275ef445..f9521d0274b7 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -1506,8 +1506,8 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv, | |||
1506 | /* We just need one DMA descriptor which is DMA-able, since writing to | 1506 | /* We just need one DMA descriptor which is DMA-able, since writing to |
1507 | * the port will allocate a new descriptor in its internal linked-list | 1507 | * the port will allocate a new descriptor in its internal linked-list |
1508 | */ | 1508 | */ |
1509 | p = dma_zalloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma, | 1509 | p = dma_alloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma, |
1510 | GFP_KERNEL); | 1510 | GFP_KERNEL); |
1511 | if (!p) { | 1511 | if (!p) { |
1512 | netif_err(priv, hw, priv->netdev, "DMA alloc failed\n"); | 1512 | netif_err(priv, hw, priv->netdev, "DMA alloc failed\n"); |
1513 | return -ENOMEM; | 1513 | return -ENOMEM; |
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index cabc8e49ad24..2d3a44c40221 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c | |||
@@ -634,9 +634,9 @@ static int bgmac_dma_alloc(struct bgmac *bgmac) | |||
634 | 634 | ||
635 | /* Alloc ring of descriptors */ | 635 | /* Alloc ring of descriptors */ |
636 | size = BGMAC_TX_RING_SLOTS * sizeof(struct bgmac_dma_desc); | 636 | size = BGMAC_TX_RING_SLOTS * sizeof(struct bgmac_dma_desc); |
637 | ring->cpu_base = dma_zalloc_coherent(dma_dev, size, | 637 | ring->cpu_base = dma_alloc_coherent(dma_dev, size, |
638 | &ring->dma_base, | 638 | &ring->dma_base, |
639 | GFP_KERNEL); | 639 | GFP_KERNEL); |
640 | if (!ring->cpu_base) { | 640 | if (!ring->cpu_base) { |
641 | dev_err(bgmac->dev, "Allocation of TX ring 0x%X failed\n", | 641 | dev_err(bgmac->dev, "Allocation of TX ring 0x%X failed\n", |
642 | ring->mmio_base); | 642 | ring->mmio_base); |
@@ -659,9 +659,9 @@ static int bgmac_dma_alloc(struct bgmac *bgmac) | |||
659 | 659 | ||
660 | /* Alloc ring of descriptors */ | 660 | /* Alloc ring of descriptors */ |
661 | size = BGMAC_RX_RING_SLOTS * sizeof(struct bgmac_dma_desc); | 661 | size = BGMAC_RX_RING_SLOTS * sizeof(struct bgmac_dma_desc); |
662 | ring->cpu_base = dma_zalloc_coherent(dma_dev, size, | 662 | ring->cpu_base = dma_alloc_coherent(dma_dev, size, |
663 | &ring->dma_base, | 663 | &ring->dma_base, |
664 | GFP_KERNEL); | 664 | GFP_KERNEL); |
665 | if (!ring->cpu_base) { | 665 | if (!ring->cpu_base) { |
666 | dev_err(bgmac->dev, "Allocation of RX ring 0x%X failed\n", | 666 | dev_err(bgmac->dev, "Allocation of RX ring 0x%X failed\n", |
667 | ring->mmio_base); | 667 | ring->mmio_base); |
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index bbb247116045..d63371d70bce 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -844,8 +844,8 @@ bnx2_alloc_stats_blk(struct net_device *dev) | |||
844 | BNX2_SBLK_MSIX_ALIGN_SIZE); | 844 | BNX2_SBLK_MSIX_ALIGN_SIZE); |
845 | bp->status_stats_size = status_blk_size + | 845 | bp->status_stats_size = status_blk_size + |
846 | sizeof(struct statistics_block); | 846 | sizeof(struct statistics_block); |
847 | status_blk = dma_zalloc_coherent(&bp->pdev->dev, bp->status_stats_size, | 847 | status_blk = dma_alloc_coherent(&bp->pdev->dev, bp->status_stats_size, |
848 | &bp->status_blk_mapping, GFP_KERNEL); | 848 | &bp->status_blk_mapping, GFP_KERNEL); |
849 | if (!status_blk) | 849 | if (!status_blk) |
850 | return -ENOMEM; | 850 | return -ENOMEM; |
851 | 851 | ||
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 3aa80da973d7..4ab6eb3baefc 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
@@ -3449,10 +3449,10 @@ alloc_ext_stats: | |||
3449 | goto alloc_tx_ext_stats; | 3449 | goto alloc_tx_ext_stats; |
3450 | 3450 | ||
3451 | bp->hw_rx_port_stats_ext = | 3451 | bp->hw_rx_port_stats_ext = |
3452 | dma_zalloc_coherent(&pdev->dev, | 3452 | dma_alloc_coherent(&pdev->dev, |
3453 | sizeof(struct rx_port_stats_ext), | 3453 | sizeof(struct rx_port_stats_ext), |
3454 | &bp->hw_rx_port_stats_ext_map, | 3454 | &bp->hw_rx_port_stats_ext_map, |
3455 | GFP_KERNEL); | 3455 | GFP_KERNEL); |
3456 | if (!bp->hw_rx_port_stats_ext) | 3456 | if (!bp->hw_rx_port_stats_ext) |
3457 | return 0; | 3457 | return 0; |
3458 | 3458 | ||
@@ -3462,10 +3462,10 @@ alloc_tx_ext_stats: | |||
3462 | 3462 | ||
3463 | if (bp->hwrm_spec_code >= 0x10902) { | 3463 | if (bp->hwrm_spec_code >= 0x10902) { |
3464 | bp->hw_tx_port_stats_ext = | 3464 | bp->hw_tx_port_stats_ext = |
3465 | dma_zalloc_coherent(&pdev->dev, | 3465 | dma_alloc_coherent(&pdev->dev, |
3466 | sizeof(struct tx_port_stats_ext), | 3466 | sizeof(struct tx_port_stats_ext), |
3467 | &bp->hw_tx_port_stats_ext_map, | 3467 | &bp->hw_tx_port_stats_ext_map, |
3468 | GFP_KERNEL); | 3468 | GFP_KERNEL); |
3469 | } | 3469 | } |
3470 | bp->flags |= BNXT_FLAG_PORT_STATS_EXT; | 3470 | bp->flags |= BNXT_FLAG_PORT_STATS_EXT; |
3471 | } | 3471 | } |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c index 15c7041e937b..70775158c8c4 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | |||
@@ -316,8 +316,8 @@ static int bnxt_hwrm_set_dcbx_app(struct bnxt *bp, struct dcb_app *app, | |||
316 | 316 | ||
317 | n = IEEE_8021QAZ_MAX_TCS; | 317 | n = IEEE_8021QAZ_MAX_TCS; |
318 | data_len = sizeof(*data) + sizeof(*fw_app) * n; | 318 | data_len = sizeof(*data) + sizeof(*fw_app) * n; |
319 | data = dma_zalloc_coherent(&bp->pdev->dev, data_len, &mapping, | 319 | data = dma_alloc_coherent(&bp->pdev->dev, data_len, &mapping, |
320 | GFP_KERNEL); | 320 | GFP_KERNEL); |
321 | if (!data) | 321 | if (!data) |
322 | return -ENOMEM; | 322 | return -ENOMEM; |
323 | 323 | ||
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index 140dbd62106d..7f56032e44ac 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | |||
@@ -85,8 +85,8 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg, | |||
85 | return -EFAULT; | 85 | return -EFAULT; |
86 | } | 86 | } |
87 | 87 | ||
88 | data_addr = dma_zalloc_coherent(&bp->pdev->dev, bytesize, | 88 | data_addr = dma_alloc_coherent(&bp->pdev->dev, bytesize, |
89 | &data_dma_addr, GFP_KERNEL); | 89 | &data_dma_addr, GFP_KERNEL); |
90 | if (!data_addr) | 90 | if (!data_addr) |
91 | return -ENOMEM; | 91 | return -ENOMEM; |
92 | 92 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 3b1397af81f7..b1627dd5f2fd 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -8712,10 +8712,10 @@ static int tg3_mem_rx_acquire(struct tg3 *tp) | |||
8712 | if (!i && tg3_flag(tp, ENABLE_RSS)) | 8712 | if (!i && tg3_flag(tp, ENABLE_RSS)) |
8713 | continue; | 8713 | continue; |
8714 | 8714 | ||
8715 | tnapi->rx_rcb = dma_zalloc_coherent(&tp->pdev->dev, | 8715 | tnapi->rx_rcb = dma_alloc_coherent(&tp->pdev->dev, |
8716 | TG3_RX_RCB_RING_BYTES(tp), | 8716 | TG3_RX_RCB_RING_BYTES(tp), |
8717 | &tnapi->rx_rcb_mapping, | 8717 | &tnapi->rx_rcb_mapping, |
8718 | GFP_KERNEL); | 8718 | GFP_KERNEL); |
8719 | if (!tnapi->rx_rcb) | 8719 | if (!tnapi->rx_rcb) |
8720 | goto err_out; | 8720 | goto err_out; |
8721 | } | 8721 | } |
@@ -8768,9 +8768,9 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
8768 | { | 8768 | { |
8769 | int i; | 8769 | int i; |
8770 | 8770 | ||
8771 | tp->hw_stats = dma_zalloc_coherent(&tp->pdev->dev, | 8771 | tp->hw_stats = dma_alloc_coherent(&tp->pdev->dev, |
8772 | sizeof(struct tg3_hw_stats), | 8772 | sizeof(struct tg3_hw_stats), |
8773 | &tp->stats_mapping, GFP_KERNEL); | 8773 | &tp->stats_mapping, GFP_KERNEL); |
8774 | if (!tp->hw_stats) | 8774 | if (!tp->hw_stats) |
8775 | goto err_out; | 8775 | goto err_out; |
8776 | 8776 | ||
@@ -8778,10 +8778,10 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
8778 | struct tg3_napi *tnapi = &tp->napi[i]; | 8778 | struct tg3_napi *tnapi = &tp->napi[i]; |
8779 | struct tg3_hw_status *sblk; | 8779 | struct tg3_hw_status *sblk; |
8780 | 8780 | ||
8781 | tnapi->hw_status = dma_zalloc_coherent(&tp->pdev->dev, | 8781 | tnapi->hw_status = dma_alloc_coherent(&tp->pdev->dev, |
8782 | TG3_HW_STATUS_SIZE, | 8782 | TG3_HW_STATUS_SIZE, |
8783 | &tnapi->status_mapping, | 8783 | &tnapi->status_mapping, |
8784 | GFP_KERNEL); | 8784 | GFP_KERNEL); |
8785 | if (!tnapi->hw_status) | 8785 | if (!tnapi->hw_status) |
8786 | goto err_out; | 8786 | goto err_out; |
8787 | 8787 | ||