]> Pileus Git - ~andy/linux/commitdiff
drivers:net: Convert dma_alloc_coherent(...__GFP_ZERO) to dma_zalloc_coherent
authorJoe Perches <joe@perches.com>
Tue, 27 Aug 2013 05:45:23 +0000 (22:45 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 30 Aug 2013 01:55:23 +0000 (21:55 -0400)
__GFP_ZERO is an uncommon flag and perhaps is better
not used.  static inline dma_zalloc_coherent exists
so convert the uses of dma_alloc_coherent with __GFP_ZERO
to the more common kernel style with zalloc.

Remove memset from the static inline dma_zalloc_coherent
and add just one use of __GFP_ZERO instead.

Trivially reduces the size of the existing uses of
dma_zalloc_coherent.

Realign arguments as appropriate.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
31 files changed:
drivers/net/ethernet/aeroflex/greth.c
drivers/net/ethernet/broadcom/bcm63xx_enet.c
drivers/net/ethernet/broadcom/bnx2.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/faraday/ftgmac100.c
drivers/net/ethernet/faraday/ftmac100.c
drivers/net/ethernet/ibm/emac/mal.c
drivers/net/ethernet/intel/e1000/e1000_ethtool.c
drivers/net/ethernet/intel/ixgb/ixgb_main.c
drivers/net/ethernet/marvell/pxa168_eth.c
drivers/net/ethernet/myricom/myri10ge/myri10ge.c
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
drivers/net/ethernet/pasemi/pasemi_mac.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
drivers/net/ethernet/sfc/nic.c
drivers/net/ethernet/sgi/meth.c
drivers/net/ethernet/tundra/tsi108_eth.c
drivers/net/ethernet/xilinx/ll_temac_main.c
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
drivers/net/fddi/defxx.c
drivers/net/irda/ali-ircc.c
drivers/net/irda/nsc-ircc.c
drivers/net/irda/smsc-ircc2.c
drivers/net/irda/via-ircc.c
drivers/net/irda/w83977af_ir.c
drivers/net/wireless/b43/dma.c
drivers/net/wireless/b43legacy/dma.c
include/linux/dma-mapping.h

index 7ff4b30d55ea8bcbd5f9a1f2c18f99ffc88bcd2b..e0669455514458705fc5a321b1a82efb13891c2c 100644 (file)
@@ -1464,18 +1464,18 @@ static int greth_of_probe(struct platform_device *ofdev)
        }
 
        /* Allocate TX descriptor ring in coherent memory */
-       greth->tx_bd_base = dma_alloc_coherent(greth->dev, 1024,
-                                              &greth->tx_bd_base_phys,
-                                              GFP_KERNEL | __GFP_ZERO);
+       greth->tx_bd_base = dma_zalloc_coherent(greth->dev, 1024,
+                                               &greth->tx_bd_base_phys,
+                                               GFP_KERNEL);
        if (!greth->tx_bd_base) {
                err = -ENOMEM;
                goto error3;
        }
 
        /* Allocate RX descriptor ring in coherent memory */
-       greth->rx_bd_base = dma_alloc_coherent(greth->dev, 1024,
-                                              &greth->rx_bd_base_phys,
-                                              GFP_KERNEL | __GFP_ZERO);
+       greth->rx_bd_base = dma_zalloc_coherent(greth->dev, 1024,
+                                               &greth->rx_bd_base_phys,
+                                               GFP_KERNEL);
        if (!greth->rx_bd_base) {
                err = -ENOMEM;
                goto error4;
index 190219e0240062549973be2f8ea9191763625e47..98b68703c53d20e4aa91c518c25fd174a4ab368b 100644 (file)
@@ -948,8 +948,7 @@ static int bcm_enet_open(struct net_device *dev)
 
        /* allocate rx dma ring */
        size = priv->rx_ring_size * sizeof(struct bcm_enet_desc);
-       p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma,
-                              GFP_KERNEL | __GFP_ZERO);
+       p = dma_zalloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL);
        if (!p) {
                ret = -ENOMEM;
                goto out_freeirq_tx;
@@ -960,8 +959,7 @@ static int bcm_enet_open(struct net_device *dev)
 
        /* allocate tx dma ring */
        size = priv->tx_ring_size * sizeof(struct bcm_enet_desc);
-       p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma,
-                              GFP_KERNEL | __GFP_ZERO);
+       p = dma_zalloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL);
        if (!p) {
                ret = -ENOMEM;
                goto out_free_rx_ring;
index 4148058cef8165e374f3eb0c9c85275b036d33b8..e838a3f74b696dd208680498f3350a3349a65392 100644 (file)
@@ -853,9 +853,8 @@ bnx2_alloc_mem(struct bnx2 *bp)
        bp->status_stats_size = status_blk_size +
                                sizeof(struct statistics_block);
 
-       status_blk = dma_alloc_coherent(&bp->pdev->dev, bp->status_stats_size,
-                                       &bp->status_blk_mapping,
-                                       GFP_KERNEL | __GFP_ZERO);
+       status_blk = dma_zalloc_coherent(&bp->pdev->dev, bp->status_stats_size,
+                                        &bp->status_blk_mapping, GFP_KERNEL);
        if (status_blk == NULL)
                goto alloc_mem_err;
 
index 12202f81735cc944a7072f6d50a74580fce04eed..3e77a1b1a44a5f784910c67fdac34ec86df8c5d3 100644 (file)
@@ -2069,9 +2069,8 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,
                            bool is_pf);
 
-#define BNX2X_ILT_ZALLOC(x, y, size)                           \
-       x = dma_alloc_coherent(&bp->pdev->dev, size, y,         \
-                              GFP_KERNEL | __GFP_ZERO)
+#define BNX2X_ILT_ZALLOC(x, y, size)                                   \
+       x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL)
 
 #define BNX2X_ILT_FREE(x, y, size) \
        do { \
index 38be494ffa6eb65f6013127832c87d3b07491323..affb7646241e89aca418e8f407ab10ff3b765ad1 100644 (file)
@@ -51,8 +51,7 @@ extern int int_mode;
 
 #define BNX2X_PCI_ALLOC(x, y, size) \
        do { \
-               x = dma_alloc_coherent(&bp->pdev->dev, size, y, \
-                                      GFP_KERNEL | __GFP_ZERO); \
+               x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
                if (x == NULL) \
                        goto alloc_mem_err; \
                DP(NETIF_MSG_HW, "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n", \
index 95b8995187d73958d048f9da89c8658c3b97ea39..2e55ee29cf13cc3e71c863d64f6a6f1571ad00df 100644 (file)
@@ -8591,10 +8591,10 @@ static int tg3_mem_rx_acquire(struct tg3 *tp)
                if (!i && tg3_flag(tp, ENABLE_RSS))
                        continue;
 
-               tnapi->rx_rcb = dma_alloc_coherent(&tp->pdev->dev,
-                                                  TG3_RX_RCB_RING_BYTES(tp),
-                                                  &tnapi->rx_rcb_mapping,
-                                                  GFP_KERNEL | __GFP_ZERO);
+               tnapi->rx_rcb = dma_zalloc_coherent(&tp->pdev->dev,
+                                                   TG3_RX_RCB_RING_BYTES(tp),
+                                                   &tnapi->rx_rcb_mapping,
+                                                   GFP_KERNEL);
                if (!tnapi->rx_rcb)
                        goto err_out;
        }
@@ -8643,10 +8643,9 @@ static int tg3_alloc_consistent(struct tg3 *tp)
 {
        int i;
 
-       tp->hw_stats = dma_alloc_coherent(&tp->pdev->dev,
-                                         sizeof(struct tg3_hw_stats),
-                                         &tp->stats_mapping,
-                                         GFP_KERNEL | __GFP_ZERO);
+       tp->hw_stats = dma_zalloc_coherent(&tp->pdev->dev,
+                                          sizeof(struct tg3_hw_stats),
+                                          &tp->stats_mapping, GFP_KERNEL);
        if (!tp->hw_stats)
                goto err_out;
 
@@ -8654,10 +8653,10 @@ static int tg3_alloc_consistent(struct tg3 *tp)
                struct tg3_napi *tnapi = &tp->napi[i];
                struct tg3_hw_status *sblk;
 
-               tnapi->hw_status = dma_alloc_coherent(&tp->pdev->dev,
-                                                     TG3_HW_STATUS_SIZE,
-                                                     &tnapi->status_mapping,
-                                                     GFP_KERNEL | __GFP_ZERO);
+               tnapi->hw_status = dma_zalloc_coherent(&tp->pdev->dev,
+                                                      TG3_HW_STATUS_SIZE,
+                                                      &tnapi->status_mapping,
+                                                      GFP_KERNEL);
                if (!tnapi->hw_status)
                        goto err_out;
 
index 50116f8ed576c0ae76d051e63d0d767c2df2fb49..39e0a7697a813ca092509218dce31e541a36edf9 100644 (file)
@@ -145,8 +145,8 @@ static int be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q,
        q->len = len;
        q->entry_size = entry_size;
        mem->size = len * entry_size;
-       mem->va = dma_alloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma,
-                                    GFP_KERNEL | __GFP_ZERO);
+       mem->va = dma_zalloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma,
+                                     GFP_KERNEL);
        if (!mem->va)
                return -ENOMEM;
        return 0;
@@ -2642,8 +2642,8 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable)
        memset(mac, 0, ETH_ALEN);
 
        cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config);
-       cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
-                                   GFP_KERNEL | __GFP_ZERO);
+       cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
+                                    GFP_KERNEL);
        if (cmd.va == NULL)
                return -1;
 
@@ -3946,9 +3946,9 @@ static int be_ctrl_init(struct be_adapter *adapter)
        memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox));
 
        rx_filter->size = sizeof(struct be_cmd_req_rx_filter);
-       rx_filter->va = dma_alloc_coherent(&adapter->pdev->dev, rx_filter->size,
-                                          &rx_filter->dma,
-                                          GFP_KERNEL | __GFP_ZERO);
+       rx_filter->va = dma_zalloc_coherent(&adapter->pdev->dev,
+                                           rx_filter->size, &rx_filter->dma,
+                                           GFP_KERNEL);
        if (rx_filter->va == NULL) {
                status = -ENOMEM;
                goto free_mbox;
@@ -3994,8 +3994,8 @@ static int be_stats_init(struct be_adapter *adapter)
                /* BE3 and Skyhawk */
                cmd->size = sizeof(struct be_cmd_req_get_stats_v1);
 
-       cmd->va = dma_alloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma,
-                                    GFP_KERNEL | __GFP_ZERO);
+       cmd->va = dma_zalloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma,
+                                     GFP_KERNEL);
        if (cmd->va == NULL)
                return -1;
        return 0;
index 934e1ae279f01ac85ce0ddb221470a9aeebab7d5..212f44b3a773d2bc072cbb9d6411df45f55e0fe8 100644 (file)
@@ -778,10 +778,9 @@ static int ftgmac100_alloc_buffers(struct ftgmac100 *priv)
 {
        int i;
 
-       priv->descs = dma_alloc_coherent(priv->dev,
-                                        sizeof(struct ftgmac100_descs),
-                                        &priv->descs_dma_addr,
-                                        GFP_KERNEL | __GFP_ZERO);
+       priv->descs = dma_zalloc_coherent(priv->dev,
+                                         sizeof(struct ftgmac100_descs),
+                                         &priv->descs_dma_addr, GFP_KERNEL);
        if (!priv->descs)
                return -ENOMEM;
 
index 4658f4cc196933226f0488ab15d0a956e40354e4..8be5b40c0a121331f1d1bbc0712499eb4bec8160 100644 (file)
@@ -732,10 +732,10 @@ static int ftmac100_alloc_buffers(struct ftmac100 *priv)
 {
        int i;
 
-       priv->descs = dma_alloc_coherent(priv->dev,
-                                        sizeof(struct ftmac100_descs),
-                                        &priv->descs_dma_addr,
-                                        GFP_KERNEL | __GFP_ZERO);
+       priv->descs = dma_zalloc_coherent(priv->dev,
+                                         sizeof(struct ftmac100_descs),
+                                         &priv->descs_dma_addr,
+                                         GFP_KERNEL);
        if (!priv->descs)
                return -ENOMEM;
 
index 856ea66c9223536bfd33cd46813d49b260bb49b0..dac564c25440cbb5c222a02a8488f8ad6c676e16 100644 (file)
@@ -637,8 +637,8 @@ static int mal_probe(struct platform_device *ofdev)
        bd_size = sizeof(struct mal_descriptor) *
                (NUM_TX_BUFF * mal->num_tx_chans +
                 NUM_RX_BUFF * mal->num_rx_chans);
-       mal->bd_virt = dma_alloc_coherent(&ofdev->dev, bd_size, &mal->bd_dma,
-                                         GFP_KERNEL | __GFP_ZERO);
+       mal->bd_virt = dma_zalloc_coherent(&ofdev->dev, bd_size, &mal->bd_dma,
+                                          GFP_KERNEL);
        if (mal->bd_virt == NULL) {
                err = -ENOMEM;
                goto fail_unmap;
index 82a967c955982c62f2f8d6faba024ce59d9d882a..73a8aeefb92a46d13a4c73be6cade2c5d694e00f 100644 (file)
@@ -1019,8 +1019,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
 
        txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
        txdr->size = ALIGN(txdr->size, 4096);
-       txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
-                                       GFP_KERNEL | __GFP_ZERO);
+       txdr->desc = dma_zalloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
+                                        GFP_KERNEL);
        if (!txdr->desc) {
                ret_val = 2;
                goto err_nomem;
@@ -1077,8 +1077,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
        }
 
        rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc);
-       rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
-                                       GFP_KERNEL | __GFP_ZERO);
+       rxdr->desc = dma_zalloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
+                                        GFP_KERNEL);
        if (!rxdr->desc) {
                ret_val = 6;
                goto err_nomem;
index fce3e92f9d11cf249b9574d3687947f3242dd81e..9f6b236828e6a2d6e5342c0acfd5ba6222a4d531 100644 (file)
@@ -718,8 +718,8 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
        txdr->size = txdr->count * sizeof(struct ixgb_tx_desc);
        txdr->size = ALIGN(txdr->size, 4096);
 
-       txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
-                                       GFP_KERNEL | __GFP_ZERO);
+       txdr->desc = dma_zalloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
+                                        GFP_KERNEL);
        if (!txdr->desc) {
                vfree(txdr->buffer_info);
                return -ENOMEM;
index db481477bcc51833e08be364bd7f54eee06640af..3e69febe377efa0abda12823f9747d1d56a6ba7f 100644 (file)
@@ -583,10 +583,9 @@ static int init_hash_table(struct pxa168_eth_private *pep)
         * table is full.
         */
        if (pep->htpr == NULL) {
-               pep->htpr = dma_alloc_coherent(pep->dev->dev.parent,
-                                              HASH_ADDR_TABLE_SIZE,
-                                              &pep->htpr_dma,
-                                              GFP_KERNEL | __GFP_ZERO);
+               pep->htpr = dma_zalloc_coherent(pep->dev->dev.parent,
+                                               HASH_ADDR_TABLE_SIZE,
+                                               &pep->htpr_dma, GFP_KERNEL);
                if (pep->htpr == NULL)
                        return -ENOMEM;
        } else {
@@ -1024,9 +1023,9 @@ static int rxq_init(struct net_device *dev)
        pep->rx_desc_count = 0;
        size = pep->rx_ring_size * sizeof(struct rx_desc);
        pep->rx_desc_area_size = size;
-       pep->p_rx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size,
-                                                &pep->rx_desc_dma,
-                                                GFP_KERNEL | __GFP_ZERO);
+       pep->p_rx_desc_area = dma_zalloc_coherent(pep->dev->dev.parent, size,
+                                                 &pep->rx_desc_dma,
+                                                 GFP_KERNEL);
        if (!pep->p_rx_desc_area)
                goto out;
 
@@ -1085,9 +1084,9 @@ static int txq_init(struct net_device *dev)
        pep->tx_desc_count = 0;
        size = pep->tx_ring_size * sizeof(struct tx_desc);
        pep->tx_desc_area_size = size;
-       pep->p_tx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size,
-                                                &pep->tx_desc_dma,
-                                                GFP_KERNEL | __GFP_ZERO);
+       pep->p_tx_desc_area = dma_zalloc_coherent(pep->dev->dev.parent, size,
+                                                 &pep->tx_desc_dma,
+                                                 GFP_KERNEL);
        if (!pep->p_tx_desc_area)
                goto out;
        /* Initialize the next_desc_ptr links in the Tx descriptors ring */
index 50a1d4a04eb010259ca5f33d34d92e877cc25e1b..149355b52ad0c8f2d4aac4f6cfe83041bc59f45b 100644 (file)
@@ -3783,9 +3783,9 @@ static int myri10ge_alloc_slices(struct myri10ge_priv *mgp)
        for (i = 0; i < mgp->num_slices; i++) {
                ss = &mgp->ss[i];
                bytes = mgp->max_intr_slots * sizeof(*ss->rx_done.entry);
-               ss->rx_done.entry = dma_alloc_coherent(&pdev->dev, bytes,
-                                                      &ss->rx_done.bus,
-                                                      GFP_KERNEL | __GFP_ZERO);
+               ss->rx_done.entry = dma_zalloc_coherent(&pdev->dev, bytes,
+                                                       &ss->rx_done.bus,
+                                                       GFP_KERNEL);
                if (ss->rx_done.entry == NULL)
                        goto abort;
                bytes = sizeof(*ss->fw_stats);
index e19f1be60d5e40fc8428a766825f6815f9ce7e29..5a0f04c2c813661991047174c7a2643e74d694bd 100644 (file)
@@ -1491,9 +1491,9 @@ pch_gbe_alloc_rx_buffers_pool(struct pch_gbe_adapter *adapter,
        bufsz = adapter->rx_buffer_len;
 
        size = rx_ring->count * bufsz + PCH_GBE_RESERVE_MEMORY;
-       rx_ring->rx_buff_pool = dma_alloc_coherent(&pdev->dev, size,
-                                                  &rx_ring->rx_buff_pool_logic,
-                                                  GFP_KERNEL | __GFP_ZERO);
+       rx_ring->rx_buff_pool =
+               dma_zalloc_coherent(&pdev->dev, size,
+                                   &rx_ring->rx_buff_pool_logic, GFP_KERNEL);
        if (!rx_ring->rx_buff_pool)
                return -ENOMEM;
 
@@ -1807,9 +1807,8 @@ int pch_gbe_setup_tx_resources(struct pch_gbe_adapter *adapter,
 
        tx_ring->size = tx_ring->count * (int)sizeof(struct pch_gbe_tx_desc);
 
-       tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size,
-                                          &tx_ring->dma,
-                                          GFP_KERNEL | __GFP_ZERO);
+       tx_ring->desc = dma_zalloc_coherent(&pdev->dev, tx_ring->size,
+                                           &tx_ring->dma, GFP_KERNEL);
        if (!tx_ring->desc) {
                vfree(tx_ring->buffer_info);
                return -ENOMEM;
@@ -1852,9 +1851,8 @@ int pch_gbe_setup_rx_resources(struct pch_gbe_adapter *adapter,
                return -ENOMEM;
 
        rx_ring->size = rx_ring->count * (int)sizeof(struct pch_gbe_rx_desc);
-       rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size,
-                                          &rx_ring->dma,
-                                          GFP_KERNEL | __GFP_ZERO);
+       rx_ring->desc = dma_zalloc_coherent(&pdev->dev, rx_ring->size,
+                                           &rx_ring->dma, GFP_KERNEL);
        if (!rx_ring->desc) {
                vfree(rx_ring->buffer_info);
                return -ENOMEM;
index f21ae7b6c766c3353e33faeab6fd32a14270e0cf..c498181a9aa823e18e9e120821254c3721bbdad3 100644 (file)
@@ -440,10 +440,9 @@ static int pasemi_mac_setup_rx_resources(const struct net_device *dev)
        if (pasemi_dma_alloc_ring(&ring->chan, RX_RING_SIZE))
                goto out_ring_desc;
 
-       ring->buffers = dma_alloc_coherent(&mac->dma_pdev->dev,
-                                          RX_RING_SIZE * sizeof(u64),
-                                          &ring->buf_dma,
-                                          GFP_KERNEL | __GFP_ZERO);
+       ring->buffers = dma_zalloc_coherent(&mac->dma_pdev->dev,
+                                           RX_RING_SIZE * sizeof(u64),
+                                           &ring->buf_dma, GFP_KERNEL);
        if (!ring->buffers)
                goto out_ring_desc;
 
index bf3b17eaf8b884031911544ac482f5e2d65eb04e..86850dd633a17169e51141287ff8b69462bbe412 100644 (file)
@@ -448,14 +448,14 @@ int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter,
        *(tx_ring->hw_consumer) = 0;
 
        rq_size = SIZEOF_HOSTRQ_TX(struct qlcnic_hostrq_tx_ctx);
-       rq_addr = dma_alloc_coherent(&adapter->pdev->dev, rq_size,
-                                    &rq_phys_addr, GFP_KERNEL | __GFP_ZERO);
+       rq_addr = dma_zalloc_coherent(&adapter->pdev->dev, rq_size,
+                                     &rq_phys_addr, GFP_KERNEL);
        if (!rq_addr)
                return -ENOMEM;
 
        rsp_size = SIZEOF_CARDRSP_TX(struct qlcnic_cardrsp_tx_ctx);
-       rsp_addr = dma_alloc_coherent(&adapter->pdev->dev, rsp_size,
-                                     &rsp_phys_addr, GFP_KERNEL | __GFP_ZERO);
+       rsp_addr = dma_zalloc_coherent(&adapter->pdev->dev, rsp_size,
+                                      &rsp_phys_addr, GFP_KERNEL);
        if (!rsp_addr) {
                err = -ENOMEM;
                goto out_free_rq;
@@ -865,8 +865,8 @@ int qlcnic_82xx_get_nic_info(struct qlcnic_adapter *adapter,
        struct qlcnic_cmd_args cmd;
        size_t  nic_size = sizeof(struct qlcnic_info_le);
 
-       nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size,
-                                          &nic_dma_t, GFP_KERNEL | __GFP_ZERO);
+       nic_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, nic_size,
+                                           &nic_dma_t, GFP_KERNEL);
        if (!nic_info_addr)
                return -ENOMEM;
 
@@ -919,8 +919,8 @@ int qlcnic_82xx_set_nic_info(struct qlcnic_adapter *adapter,
        if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
                return err;
 
-       nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size,
-                                          &nic_dma_t, GFP_KERNEL | __GFP_ZERO);
+       nic_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, nic_size,
+                                           &nic_dma_t, GFP_KERNEL);
        if (!nic_info_addr)
                return -ENOMEM;
 
@@ -972,9 +972,8 @@ int qlcnic_82xx_get_pci_info(struct qlcnic_adapter *adapter,
        size_t npar_size = sizeof(struct qlcnic_pci_info_le);
        size_t pci_size = npar_size * QLCNIC_MAX_PCI_FUNC;
 
-       pci_info_addr = dma_alloc_coherent(&adapter->pdev->dev, pci_size,
-                                          &pci_info_dma_t,
-                                          GFP_KERNEL | __GFP_ZERO);
+       pci_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, pci_size,
+                                           &pci_info_dma_t, GFP_KERNEL);
        if (!pci_info_addr)
                return -ENOMEM;
 
@@ -1074,8 +1073,8 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func,
                return -EIO;
        }
 
-       stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size,
-                                       &stats_dma_t, GFP_KERNEL | __GFP_ZERO);
+       stats_addr = dma_zalloc_coherent(&adapter->pdev->dev, stats_size,
+                                        &stats_dma_t, GFP_KERNEL);
        if (!stats_addr)
                return -ENOMEM;
 
@@ -1130,8 +1129,8 @@ int qlcnic_get_mac_stats(struct qlcnic_adapter *adapter,
        if (mac_stats == NULL)
                return -ENOMEM;
 
-       stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size,
-                                       &stats_dma_t, GFP_KERNEL | __GFP_ZERO);
+       stats_addr = dma_zalloc_coherent(&adapter->pdev->dev, stats_size,
+                                        &stats_dma_t, GFP_KERNEL);
        if (!stats_addr)
                return -ENOMEM;
 
index b9b127743a077d6e725cb9042e2d0a0b470ac1ca..78d41331205261c2e9afe85c98b8ce39eb99e478 100644 (file)
@@ -33,9 +33,8 @@
 int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer,
                         unsigned int len, gfp_t gfp_flags)
 {
-       buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len,
-                                         &buffer->dma_addr,
-                                         gfp_flags | __GFP_ZERO);
+       buffer->addr = dma_zalloc_coherent(&efx->pci_dev->dev, len,
+                                          &buffer->dma_addr, gfp_flags);
        if (!buffer->addr)
                return -ENOMEM;
        buffer->len = len;
index 9f5f35e041ac599681576aa06b9ee24033cfbd12..770036bc2d87c9fde8335241a43b52a5df581a6f 100644 (file)
@@ -212,9 +212,8 @@ static void meth_check_link(struct net_device *dev)
 static int meth_init_tx_ring(struct meth_private *priv)
 {
        /* Init TX ring */
-       priv->tx_ring = dma_alloc_coherent(NULL, TX_RING_BUFFER_SIZE,
-                                          &priv->tx_ring_dma,
-                                          GFP_ATOMIC | __GFP_ZERO);
+       priv->tx_ring = dma_zalloc_coherent(NULL, TX_RING_BUFFER_SIZE,
+                                           &priv->tx_ring_dma, GFP_ATOMIC);
        if (!priv->tx_ring)
                return -ENOMEM;
 
index 01bdc6ca0755feff940d8bede196ba83d85c2f06..f2e76c9d736cfe32e3b365bbb405f1d284aae6e8 100644 (file)
@@ -1308,13 +1308,13 @@ static int tsi108_open(struct net_device *dev)
                       data->id, dev->irq, dev->name);
        }
 
-       data->rxring = dma_alloc_coherent(NULL, rxring_size, &data->rxdma,
-                                         GFP_KERNEL | __GFP_ZERO);
+       data->rxring = dma_zalloc_coherent(NULL, rxring_size, &data->rxdma,
+                                          GFP_KERNEL);
        if (!data->rxring)
                return -ENOMEM;
 
-       data->txring = dma_alloc_coherent(NULL, txring_size, &data->txdma,
-                                         GFP_KERNEL | __GFP_ZERO);
+       data->txring = dma_zalloc_coherent(NULL, txring_size, &data->txdma,
+                                          GFP_KERNEL);
        if (!data->txring) {
                pci_free_consistent(0, rxring_size, data->rxring, data->rxdma);
                return -ENOMEM;
index 58eb4488beff13201c411f5374f803cc730c7c8c..b88121f240ca609ea26f911508b829c8fbbdbdd1 100644 (file)
@@ -243,15 +243,15 @@ static int temac_dma_bd_init(struct net_device *ndev)
 
        /* allocate the tx and rx ring buffer descriptors. */
        /* returns a virtual address and a physical address. */
-       lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent,
-                                        sizeof(*lp->tx_bd_v) * TX_BD_NUM,
-                                        &lp->tx_bd_p, GFP_KERNEL | __GFP_ZERO);
+       lp->tx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
+                                         sizeof(*lp->tx_bd_v) * TX_BD_NUM,
+                                         &lp->tx_bd_p, GFP_KERNEL);
        if (!lp->tx_bd_v)
                goto out;
 
-       lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent,
-                                        sizeof(*lp->rx_bd_v) * RX_BD_NUM,
-                                        &lp->rx_bd_p, GFP_KERNEL | __GFP_ZERO);
+       lp->rx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
+                                         sizeof(*lp->rx_bd_v) * RX_BD_NUM,
+                                         &lp->rx_bd_p, GFP_KERNEL);
        if (!lp->rx_bd_v)
                goto out;
 
index fb7d1c28a2ea345326c2b225915ca2676295a308..b2ff038d6d200abc5dbcd9315806e6791cec3335 100644 (file)
@@ -201,17 +201,15 @@ static int axienet_dma_bd_init(struct net_device *ndev)
        /*
         * Allocate the Tx and Rx buffer descriptors.
         */
-       lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent,
-                                        sizeof(*lp->tx_bd_v) * TX_BD_NUM,
-                                        &lp->tx_bd_p,
-                                        GFP_KERNEL | __GFP_ZERO);
+       lp->tx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
+                                         sizeof(*lp->tx_bd_v) * TX_BD_NUM,
+                                         &lp->tx_bd_p, GFP_KERNEL);
        if (!lp->tx_bd_v)
                goto out;
 
-       lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent,
-                                        sizeof(*lp->rx_bd_v) * RX_BD_NUM,
-                                        &lp->rx_bd_p,
-                                        GFP_KERNEL | __GFP_ZERO);
+       lp->rx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
+                                         sizeof(*lp->rx_bd_v) * RX_BD_NUM,
+                                         &lp->rx_bd_p, GFP_KERNEL);
        if (!lp->rx_bd_v)
                goto out;
 
index 4c8ddc944d51f5d412b85bdbd8a29413512b9878..0b40e1c46f07a15a32ab4ba17c54e610e1ccd64e 100644 (file)
@@ -1068,9 +1068,9 @@ static int dfx_driver_init(struct net_device *dev, const char *print_name,
 #endif
                                        sizeof(PI_CONSUMER_BLOCK) +
                                        (PI_ALIGN_K_DESC_BLK - 1);
-       bp->kmalloced = top_v = dma_alloc_coherent(bp->bus_dev, alloc_size,
-                                                  &bp->kmalloced_dma,
-                                                  GFP_ATOMIC | __GFP_ZERO);
+       bp->kmalloced = top_v = dma_zalloc_coherent(bp->bus_dev, alloc_size,
+                                                   &bp->kmalloced_dma,
+                                                   GFP_ATOMIC);
        if (top_v == NULL)
                return DFX_K_FAILURE;
 
index 3adb43ce138fa1b8d3bda8a31d25f14f3aa1c696..7bbd318bc93e0bb062ed378b4aa6e3bd3b2f2a44 100644 (file)
@@ -351,16 +351,16 @@ static int ali_ircc_open(int i, chipio_t *info)
 
        /* Allocate memory if needed */
        self->rx_buff.head =
-               dma_alloc_coherent(NULL, self->rx_buff.truesize,
-                                  &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO);
+               dma_zalloc_coherent(NULL, self->rx_buff.truesize,
+                                   &self->rx_buff_dma, GFP_KERNEL);
        if (self->rx_buff.head == NULL) {
                err = -ENOMEM;
                goto err_out2;
        }
        
        self->tx_buff.head =
-               dma_alloc_coherent(NULL, self->tx_buff.truesize,
-                                  &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO);
+               dma_zalloc_coherent(NULL, self->tx_buff.truesize,
+                                   &self->tx_buff_dma, GFP_KERNEL);
        if (self->tx_buff.head == NULL) {
                err = -ENOMEM;
                goto err_out3;
index 9cf836b57c4920c40a1455514b0158ecb584f509..ceeb53737f86ba195b13b69933234313e8dcb506 100644 (file)
@@ -430,8 +430,8 @@ static int __init nsc_ircc_open(chipio_t *info)
 
        /* Allocate memory if needed */
        self->rx_buff.head =
-               dma_alloc_coherent(NULL, self->rx_buff.truesize,
-                                  &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO);
+               dma_zalloc_coherent(NULL, self->rx_buff.truesize,
+                                   &self->rx_buff_dma, GFP_KERNEL);
        if (self->rx_buff.head == NULL) {
                err = -ENOMEM;
                goto out2;
@@ -439,8 +439,8 @@ static int __init nsc_ircc_open(chipio_t *info)
        }
        
        self->tx_buff.head =
-               dma_alloc_coherent(NULL, self->tx_buff.truesize,
-                                  &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO);
+               dma_zalloc_coherent(NULL, self->tx_buff.truesize,
+                                   &self->tx_buff_dma, GFP_KERNEL);
        if (self->tx_buff.head == NULL) {
                err = -ENOMEM;
                goto out3;
index aa05dad75335f4cbbd986758a4230ad5050d49c4..0dcdf1592f6b2ee516d2d57c34cf78a5dd425441 100644 (file)
@@ -562,14 +562,14 @@ static int smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u8 dma,
        self->tx_buff.truesize = SMSC_IRCC2_TX_BUFF_TRUESIZE;
 
        self->rx_buff.head =
-               dma_alloc_coherent(NULL, self->rx_buff.truesize,
-                                  &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO);
+               dma_zalloc_coherent(NULL, self->rx_buff.truesize,
+                                   &self->rx_buff_dma, GFP_KERNEL);
        if (self->rx_buff.head == NULL)
                goto err_out2;
 
        self->tx_buff.head =
-               dma_alloc_coherent(NULL, self->tx_buff.truesize,
-                                  &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO);
+               dma_zalloc_coherent(NULL, self->tx_buff.truesize,
+                                   &self->tx_buff_dma, GFP_KERNEL);
        if (self->tx_buff.head == NULL)
                goto err_out3;
 
index 2dcc60fb37f1dee50beea82b878e98248c1688a0..9abaec27f96259c5c3360d12f7ffb3dfc3699832 100644 (file)
@@ -361,16 +361,16 @@ static int via_ircc_open(struct pci_dev *pdev, chipio_t *info, unsigned int id)
 
        /* Allocate memory if needed */
        self->rx_buff.head =
-               dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize,
-                                  &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO);
+               dma_zalloc_coherent(&pdev->dev, self->rx_buff.truesize,
+                                   &self->rx_buff_dma, GFP_KERNEL);
        if (self->rx_buff.head == NULL) {
                err = -ENOMEM;
                goto err_out2;
        }
 
        self->tx_buff.head =
-               dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize,
-                                  &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO);
+               dma_zalloc_coherent(&pdev->dev, self->tx_buff.truesize,
+                                   &self->tx_buff_dma, GFP_KERNEL);
        if (self->tx_buff.head == NULL) {
                err = -ENOMEM;
                goto err_out3;
index bb8857a158a61efb8f5db3e0473899cf52855448..e641bb2403624fdd91fb565ea646d70d03c2c5fd 100644 (file)
@@ -215,16 +215,16 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
        
        /* Allocate memory if needed */
        self->rx_buff.head =
-               dma_alloc_coherent(NULL, self->rx_buff.truesize,
-                                  &self->rx_buff_dma, GFP_KERNEL | __GFP_ZERO);
+               dma_zalloc_coherent(NULL, self->rx_buff.truesize,
+                                   &self->rx_buff_dma, GFP_KERNEL);
        if (self->rx_buff.head == NULL) {
                err = -ENOMEM;
                goto err_out1;
        }
 
        self->tx_buff.head =
-               dma_alloc_coherent(NULL, self->tx_buff.truesize,
-                                  &self->tx_buff_dma, GFP_KERNEL | __GFP_ZERO);
+               dma_zalloc_coherent(NULL, self->tx_buff.truesize,
+                                   &self->tx_buff_dma, GFP_KERNEL);
        if (self->tx_buff.head == NULL) {
                err = -ENOMEM;
                goto err_out2;
index f7c70b3a6ea978883f67f1abe0983cf51a476ada..c51d2dc489e45bd3a9b2aac36bf9fa2130453e72 100644 (file)
@@ -431,9 +431,9 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
        u16 ring_mem_size = (ring->type == B43_DMA_64BIT) ?
                                B43_DMA64_RINGMEMSIZE : B43_DMA32_RINGMEMSIZE;
 
-       ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev,
-                                           ring_mem_size, &(ring->dmabase),
-                                           GFP_KERNEL | __GFP_ZERO);
+       ring->descbase = dma_zalloc_coherent(ring->dev->dev->dma_dev,
+                                            ring_mem_size, &(ring->dmabase),
+                                            GFP_KERNEL);
        if (!ring->descbase)
                return -ENOMEM;
 
index faeafe219c578fbb1a3694be2e2826e69cb92691..42eb26c99e11cea54a2b063de4120ec69ae33b22 100644 (file)
@@ -331,10 +331,9 @@ void free_descriptor_buffer(struct b43legacy_dmaring *ring,
 static int alloc_ringmemory(struct b43legacy_dmaring *ring)
 {
        /* GFP flags must match the flags in free_ringmemory()! */
-       ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev,
-                                           B43legacy_DMA_RINGMEMSIZE,
-                                           &(ring->dmabase),
-                                           GFP_KERNEL | __GFP_ZERO);
+       ring->descbase = dma_zalloc_coherent(ring->dev->dev->dma_dev,
+                                            B43legacy_DMA_RINGMEMSIZE,
+                                            &(ring->dmabase), GFP_KERNEL);
        if (!ring->descbase)
                return -ENOMEM;
 
index 94af418585135a6fdaabb987e284caad4a8b1e99..3a8d0a2af6077b45acc0126f7f6c57a3661caf7f 100644 (file)
@@ -132,9 +132,8 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
 static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
                                        dma_addr_t *dma_handle, gfp_t flag)
 {
-       void *ret = dma_alloc_coherent(dev, size, dma_handle, flag);
-       if (ret)
-               memset(ret, 0, size);
+       void *ret = dma_alloc_coherent(dev, size, dma_handle,
+                                      flag | __GFP_ZERO);
        return ret;
 }