remove dma_zalloc_coherent
Subsystems (118)
Christoph Hellwig
maintainerHi Linus and world,
We've always had a weird situation around dma_zalloc_coherent. To safely support mapping the allocations to userspace major architectures like x86 and arm have always zeroed allocations from dma_alloc_coherent, but a couple other architectures were missing that zeroing either always or in corner cases. Then later we grew anothe dma_zalloc_coherent interface to explicitly request zeroing, but that just added __GFP_ZERO to the allocation flags, which for some allocators that didn't end up using the page allocator ended up being a no-op and still not zeroing the allocations.
So for this merge window I fixed up all remaining architectures to zero the memory in dma_alloc_coherent, and made dma_zalloc_coherent a no-op wrapper around dma_alloc_coherent, which fixes all of the above issues.
dma_zalloc_coherent is now pointless and can go away, and Luis helped me writing a cocchinelle script and patch series to kill it, which I think we should apply now just after -rc1 to finally settle these issue.
The script that generated the first patch is included here:
@ replace_dma_zalloc_coherent @
expression dev, size, data, handle, flags;
@@
-dma_zalloc_coherent(dev, size, handle, flags)
+dma_alloc_coherent(dev, size, handle, flags)
Christoph Hellwig
maintainerPATCH 1/3 cross-tree: phase out dma_zalloc_coherent()
From: Luis Chamberlain <[email protected]>
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)
--- arch/mips/lantiq/xway/dma.c | 6 +- arch/powerpc/platforms/pasemi/dma_lib.c | 2 +- arch/powerpc/sysdev/fsl_rmu.c | 7 +- drivers/ata/sata_fsl.c | 4 +- drivers/atm/he.c | 39 ++++++----- drivers/atm/idt77252.c | 16 ++--- drivers/block/skd_main.c | 4 +- drivers/crypto/amcc/crypto4xx_core.c | 6 +- drivers/crypto/cavium/cpt/cptpf_main.c | 4 +- drivers/crypto/cavium/cpt/cptvf_main.c | 7 +- drivers/crypto/cavium/nitrox/nitrox_lib.c | 6 +- drivers/crypto/ccp/ccp-dev-v5.c | 6 +- drivers/crypto/hisilicon/sec/sec_algs.c | 4 +- drivers/crypto/hisilicon/sec/sec_drv.c | 15 ++-- drivers/crypto/ixp4xx_crypto.c | 6 +- drivers/crypto/mediatek/mtk-platform.c | 16 ++--- drivers/crypto/qat/qat_common/adf_admin.c | 12 ++-- drivers/crypto/qat/qat_common/qat_algs.c | 24 +++---- drivers/crypto/qat/qat_common/qat_asym_algs.c | 68 +++++++++---------- drivers/dma/imx-sdma.c | 8 +-- drivers/dma/mediatek/mtk-hsdma.c | 4 +- drivers/dma/mxs-dma.c | 6 +- drivers/dma/xgene-dma.c | 4 +- drivers/dma/xilinx/xilinx_dma.c | 14 ++-- drivers/dma/xilinx/zynqmp_dma.c | 6 +- drivers/gpu/drm/drm_pci.c | 5 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 4 +- drivers/infiniband/hw/bnxt_re/qplib_res.c | 8 +-- drivers/infiniband/hw/cxgb3/cxio_hal.c | 6 +- drivers/infiniband/hw/cxgb4/qp.c | 5 +- drivers/infiniband/hw/hfi1/init.c | 29 ++++---- drivers/infiniband/hw/hfi1/pio.c | 9 ++- drivers/infiniband/hw/hfi1/sdma.c | 27 +++----- drivers/infiniband/hw/hns/hns_roce_alloc.c | 11 +-- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 10 +-- drivers/infiniband/hw/i40iw/i40iw_utils.c | 4 +- drivers/infiniband/hw/mthca/mthca_memfree.c | 5 +- drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 14 ++-- drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 4 +- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 +- drivers/infiniband/hw/qedr/verbs.c | 4 +- .../infiniband/hw/vmw_pvrdma/pvrdma_main.c | 4 +- drivers/input/touchscreen/raspberrypi-ts.c | 4 +- drivers/iommu/mtk_iommu_v1.c | 5 +- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 +- .../platform/mtk-vcodec/mtk_vcodec_util.c | 2 +- drivers/misc/genwqe/card_utils.c | 4 +- drivers/mmc/host/sdhci.c | 5 +- drivers/net/ethernet/aeroflex/greth.c | 12 ++-- drivers/net/ethernet/alacritech/slicoss.c | 12 ++-- drivers/net/ethernet/amazon/ena/ena_com.c | 61 +++++++++-------- drivers/net/ethernet/apm/xgene-v2/main.c | 8 +-- drivers/net/ethernet/atheros/alx/main.c | 7 +- .../net/ethernet/atheros/atl1c/atl1c_main.c | 4 +- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 8 +-- drivers/net/ethernet/broadcom/bcmsysport.c | 4 +- drivers/net/ethernet/broadcom/bgmac.c | 12 ++-- drivers/net/ethernet/broadcom/bnx2.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 16 ++--- drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | 4 +- .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 4 +- drivers/net/ethernet/broadcom/tg3.c | 22 +++--- .../ethernet/cavium/thunder/nicvf_queues.c | 2 +- drivers/net/ethernet/chelsio/cxgb3/sge.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/sge.c | 2 +- drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 2 +- drivers/net/ethernet/emulex/benet/be_cmds.c | 68 +++++++++---------- .../net/ethernet/emulex/benet/be_ethtool.c | 18 ++--- drivers/net/ethernet/emulex/benet/be_main.c | 18 ++--- drivers/net/ethernet/faraday/ftgmac100.c | 14 ++-- drivers/net/ethernet/faraday/ftmac100.c | 7 +- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 4 +- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 5 +- .../hisilicon/hns3/hns3pf/hclge_cmd.c | 5 +- .../hisilicon/hns3/hns3vf/hclgevf_cmd.c | 5 +- .../ethernet/huawei/hinic/hinic_hw_api_cmd.c | 16 ++--- .../net/ethernet/huawei/hinic/hinic_hw_eqs.c | 8 +-- .../net/ethernet/huawei/hinic/hinic_hw_io.c | 6 +- .../net/ethernet/huawei/hinic/hinic_hw_qp.c | 10 +-- .../net/ethernet/huawei/hinic/hinic_hw_wq.c | 8 +-- drivers/net/ethernet/ibm/emac/mal.c | 4 +- .../net/ethernet/intel/e1000/e1000_ethtool.c | 8 +-- drivers/net/ethernet/intel/e1000e/netdev.c | 4 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 8 +-- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 +- drivers/net/ethernet/marvell/pxa168_eth.c | 18 ++--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 18 ++--- drivers/net/ethernet/mellanox/mlx4/alloc.c | 8 +-- .../net/ethernet/mellanox/mlx5/core/alloc.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 10 +-- .../net/ethernet/myricom/myri10ge/myri10ge.c | 6 +- .../ethernet/netronome/nfp/nfp_net_common.c | 12 ++-- drivers/net/ethernet/ni/nixge.c | 12 ++-- .../ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 12 ++-- drivers/net/ethernet/pasemi/pasemi_mac.c | 6 +- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 16 ++--- .../net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 28 ++++---- drivers/net/ethernet/qualcomm/emac/emac-mac.c | 2 +- .../net/ethernet/samsung/sxgbe/sxgbe_main.c | 12 ++-- drivers/net/ethernet/sfc/falcon/nic.c | 4 +- drivers/net/ethernet/sfc/nic.c | 4 +- drivers/net/ethernet/sgi/meth.c | 4 +- drivers/net/ethernet/socionext/netsec.c | 4 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 40 +++++------ drivers/net/ethernet/tundra/tsi108_eth.c | 8 +-- drivers/net/ethernet/xilinx/ll_temac_main.c | 12 ++-- .../net/ethernet/xilinx/xilinx_axienet_main.c | 12 ++-- drivers/net/fddi/defxx.c | 6 +- drivers/net/fddi/skfp/skfddi.c | 8 +-- drivers/net/vmxnet3/vmxnet3_drv.c | 8 +-- drivers/net/wan/fsl_ucc_hdlc.c | 7 +- drivers/net/wireless/ath/ath10k/ce.c | 7 +- drivers/net/wireless/ath/ath10k/mac.c | 8 +-- drivers/net/wireless/ath/ath10k/pci.c | 3 +- drivers/net/wireless/ath/ath10k/wmi.c | 2 +- drivers/net/wireless/ath/wcn36xx/dxe.c | 17 +++-- drivers/net/wireless/ath/wil6210/txrx_edma.c | 8 +-- drivers/net/wireless/broadcom/b43/dma.c | 6 +- drivers/net/wireless/broadcom/b43legacy/dma.c | 6 +- .../broadcom/brcm80211/brcmfmac/pcie.c | 16 ++--- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 39 ++++------- .../net/wireless/ralink/rt2x00/rt2x00mmio.c | 6 +- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 8 +-- drivers/nvme/host/pci.c | 8 +-- drivers/pci/controller/pcie-iproc-msi.c | 6 +- drivers/pci/switch/switchtec.c | 8 +-- drivers/rapidio/devices/tsi721.c | 22 +++--- drivers/rapidio/devices/tsi721_dma.c | 8 +-- drivers/s390/net/ism_drv.c | 15 ++-- drivers/scsi/3w-sas.c | 5 +- drivers/scsi/a100u2w.c | 8 +-- drivers/scsi/arcmsr/arcmsr_hba.c | 18 +++-- drivers/scsi/be2iscsi/be_main.c | 4 +- drivers/scsi/be2iscsi/be_mgmt.c | 11 ++- drivers/scsi/bfa/bfad_bsg.c | 6 +- drivers/scsi/bnx2fc/bnx2fc_hwi.c | 49 +++++++------ drivers/scsi/bnx2fc/bnx2fc_tgt.c | 44 ++++++------ drivers/scsi/bnx2i/bnx2i_hwi.c | 8 +-- drivers/scsi/csiostor/csio_wr.c | 4 +- drivers/scsi/lpfc/lpfc_bsg.c | 4 +- drivers/scsi/lpfc/lpfc_init.c | 14 ++-- drivers/scsi/lpfc/lpfc_mbox.c | 6 +- drivers/scsi/lpfc/lpfc_sli.c | 15 ++-- drivers/scsi/megaraid/megaraid_mbox.c | 15 ++-- drivers/scsi/megaraid/megaraid_sas_base.c | 26 +++---- drivers/scsi/megaraid/megaraid_sas_fusion.c | 5 +- drivers/scsi/mesh.c | 5 +- drivers/scsi/mvumi.c | 9 +-- drivers/scsi/pm8001/pm8001_sas.c | 4 +- drivers/scsi/qedf/qedf_main.c | 29 ++++---- drivers/scsi/qedi/qedi_main.c | 39 ++++++----- drivers/scsi/qla2xxx/qla_attr.c | 4 +- drivers/scsi/qla2xxx/qla_bsg.c | 4 +- drivers/scsi/qla2xxx/qla_gs.c | 14 ++-- drivers/scsi/qla2xxx/qla_init.c | 8 +-- drivers/scsi/qla4xxx/ql4_init.c | 4 +- drivers/scsi/qla4xxx/ql4_mbx.c | 18 ++--- drivers/scsi/qla4xxx/ql4_nx.c | 4 +- drivers/scsi/qla4xxx/ql4_os.c | 10 +-- drivers/scsi/smartpqi/smartpqi_init.c | 32 ++++----- drivers/soc/fsl/qbman/dpaa_sys.c | 2 +- drivers/spi/spi-pic32-sqi.c | 6 +- drivers/staging/mt7621-eth/mtk_eth_soc.c | 3 +- .../interface/vchiq_arm/vchiq_2835_arm.c | 6 +- drivers/staging/vt6655/device_main.c | 19 ++---- drivers/usb/gadget/udc/bdc/bdc_core.c | 13 ++-- drivers/usb/host/uhci-hcd.c | 6 +- drivers/usb/host/xhci-mem.c | 8 +-- drivers/video/fbdev/da8xx-fb.c | 6 +- include/linux/pci-dma-compat.h | 2 +- sound/aoa/soundbus/i2sbus/core.c | 4 +- sound/sparc/dbri.c | 4 +- 173 files changed, 915 insertions(+), 949 deletions(-)
arch/mips/lantiq/xway/dma.c +3 -3
@@ -129,9 +129,9 @@ ltq_dma_alloc(struct ltq_dma_channel *ch)unsigned long flags; ch->desc =0 ; - ch->desc_base =dma_zalloc_coherent (ch->dev, -LTQ_DESC_NUM *LTQ_DESC_SIZE , - &ch->phys,GFP_ATOMIC ); + ch->desc_base =dma_alloc_coherent (ch->dev, +LTQ_DESC_NUM *LTQ_DESC_SIZE , + &ch->phys,GFP_ATOMIC );spin_lock_irqsave (<q_dma_lock, flags);ltq_dma_w32 (ch->nr,LTQ_DMA_CS );
arch/powerpc/platforms/pasemi/dma_lib.c +1 -1
@@ -255,7 +255,7 @@ int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size) chan->ring_size = ring_size; - chan->ring_virt =dma_zalloc_coherent (&dma_pdev->dev, + chan->ring_virt =dma_alloc_coherent (&dma_pdev->dev, ring_size *sizeof (u64), &chan->ring_dma,GFP_KERNEL );
arch/powerpc/sysdev/fsl_rmu.c +4 -3
@@ -756,9 +756,10 @@ fsl_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries) }/* Initialize outbound message descriptor ring */ - rmu->msg_tx_ring.virt =dma_zalloc_coherent (priv->dev, - rmu->msg_tx_ring.size *RIO_MSG_DESC_SIZE , - &rmu->msg_tx_ring.phys,GFP_KERNEL ); + rmu->msg_tx_ring.virt =dma_alloc_coherent (priv->dev, + rmu->msg_tx_ring.size *RIO_MSG_DESC_SIZE , + &rmu->msg_tx_ring.phys, +GFP_KERNEL );if (!rmu->msg_tx_ring.virt) { rc = -ENOMEM ; goto out_dma;
drivers/ata/sata_fsl.c +2 -2
@@ -729,8 +729,8 @@ static int sata_fsl_port_start(struct ata_port *ap)if (!pp)return -ENOMEM ; - mem =dma_zalloc_coherent (dev,SATA_FSL_PORT_PRIV_DMA_SZ , &mem_dma, -GFP_KERNEL ); + mem =dma_alloc_coherent (dev,SATA_FSL_PORT_PRIV_DMA_SZ , &mem_dma, +GFP_KERNEL );if (!mem) {kfree (pp);return -ENOMEM ;
drivers/atm/he.c +19 -20
@@ -533,9 +533,10 @@ static void he_init_tx_lbfp(struct he_dev *he_dev)static int he_init_tpdrq (struct he_dev *he_dev) { - he_dev->tpdrq_base =dma_zalloc_coherent (&he_dev->pci_dev->dev, -CONFIG_TPDRQ_SIZE *sizeof (struct he_tpdrq ), - &he_dev->tpdrq_phys,GFP_KERNEL ); + he_dev->tpdrq_base =dma_alloc_coherent (&he_dev->pci_dev->dev, +CONFIG_TPDRQ_SIZE *sizeof (struct he_tpdrq ), + &he_dev->tpdrq_phys, +GFP_KERNEL );if (he_dev->tpdrq_base ==NULL ) {hprintk ("failed to alloc tpdrq\n" );return -ENOMEM ;
@@ -805,9 +806,9 @@ static int he_init_group(struct he_dev *he_dev, int group) goto out_free_rbpl_virt; } - he_dev->rbpl_base =dma_zalloc_coherent (&he_dev->pci_dev->dev, -CONFIG_RBPL_SIZE *sizeof (struct he_rbp ), - &he_dev->rbpl_phys,GFP_KERNEL ); + he_dev->rbpl_base =dma_alloc_coherent (&he_dev->pci_dev->dev, +CONFIG_RBPL_SIZE *sizeof (struct he_rbp ), + &he_dev->rbpl_phys,GFP_KERNEL );if (he_dev->rbpl_base ==NULL ) {hprintk ("failed to alloc rbpl_base\n" ); goto out_destroy_rbpl_pool;
@@ -844,9 +845,9 @@ static int he_init_group(struct he_dev *he_dev, int group)/* rx buffer ready queue */ - he_dev->rbrq_base =dma_zalloc_coherent (&he_dev->pci_dev->dev, -CONFIG_RBRQ_SIZE *sizeof (struct he_rbrq ), - &he_dev->rbrq_phys,GFP_KERNEL ); + he_dev->rbrq_base =dma_alloc_coherent (&he_dev->pci_dev->dev, +CONFIG_RBRQ_SIZE *sizeof (struct he_rbrq ), + &he_dev->rbrq_phys,GFP_KERNEL );if (he_dev->rbrq_base ==NULL ) {hprintk ("failed to allocate rbrq\n" ); goto out_free_rbpl;
@@ -868,9 +869,9 @@ static int he_init_group(struct he_dev *he_dev, int group)/* tx buffer ready queue */ - he_dev->tbrq_base =dma_zalloc_coherent (&he_dev->pci_dev->dev, -CONFIG_TBRQ_SIZE *sizeof (struct he_tbrq ), - &he_dev->tbrq_phys,GFP_KERNEL ); + he_dev->tbrq_base =dma_alloc_coherent (&he_dev->pci_dev->dev, +CONFIG_TBRQ_SIZE *sizeof (struct he_tbrq ), + &he_dev->tbrq_phys,GFP_KERNEL );if (he_dev->tbrq_base ==NULL ) {hprintk ("failed to allocate tbrq\n" ); goto out_free_rbpq_base;
@@ -913,11 +914,9 @@ static int he_init_irq(struct he_dev *he_dev)/* 2.9.3.5 tail offset for each interrupt queue is located after the end of the interrupt queue */ - he_dev->irq_base =dma_zalloc_coherent (&he_dev->pci_dev->dev, - (CONFIG_IRQ_SIZE +1 ) - *sizeof (struct he_irq ), - &he_dev->irq_phys, -GFP_KERNEL ); + he_dev->irq_base =dma_alloc_coherent (&he_dev->pci_dev->dev, + (CONFIG_IRQ_SIZE +1 ) *sizeof (struct he_irq ), + &he_dev->irq_phys,GFP_KERNEL );if (he_dev->irq_base ==NULL ) {hprintk ("failed to allocate irq\n" );return -ENOMEM ;
@@ -1464,9 +1463,9 @@ static int he_start(struct atm_dev *dev)/* host status page */ - he_dev->hsp =dma_zalloc_coherent (&he_dev->pci_dev->dev, -sizeof (struct he_hsp ), - &he_dev->hsp_phys,GFP_KERNEL ); + he_dev->hsp =dma_alloc_coherent (&he_dev->pci_dev->dev, +sizeof (struct he_hsp ), + &he_dev->hsp_phys,GFP_KERNEL );if (he_dev->hsp ==NULL ) {hprintk ("failed to allocate host status page\n" );return -ENOMEM ;
drivers/atm/idt77252.c +8 -8
@@ -641,8 +641,8 @@ alloc_scq(struct idt77252_dev *card, int class) scq =kzalloc (sizeof (struct scq_info ),GFP_KERNEL );if (!scq)return NULL ; - scq->base =dma_zalloc_coherent (&card->pcidev->dev,SCQ_SIZE , - &scq->paddr,GFP_KERNEL ); + scq->base =dma_alloc_coherent (&card->pcidev->dev,SCQ_SIZE , + &scq->paddr,GFP_KERNEL );if (scq->base ==NULL ) {kfree (scq);return NULL ;
@@ -971,8 +971,8 @@ init_rsq(struct idt77252_dev *card) {struct rsq_entry *rsqe; - card->rsq.base =dma_zalloc_coherent (&card->pcidev->dev,RSQSIZE , - &card->rsq.paddr,GFP_KERNEL ); + card->rsq.base =dma_alloc_coherent (&card->pcidev->dev,RSQSIZE , + &card->rsq.paddr,GFP_KERNEL );if (card->rsq.base ==NULL ) {printk ("%s: can't allocate RSQ.\n" , card->name);return -1 ;
@@ -3390,10 +3390,10 @@ static int init_card(struct atm_dev *dev)writel (0 ,SAR_REG_GP );/* Initialize RAW Cell Handle Register */ - card->raw_cell_hnd =dma_zalloc_coherent (&card->pcidev->dev, -2 *sizeof (u32), - &card->raw_cell_paddr, -GFP_KERNEL ); + card->raw_cell_hnd =dma_alloc_coherent (&card->pcidev->dev, +2 *sizeof (u32), + &card->raw_cell_paddr, +GFP_KERNEL );if (!card->raw_cell_hnd) {printk ("%s: memory allocation failure.\n" , card->name);deinit_card (card);
drivers/block/skd_main.c +2 -2
@@ -2641,8 +2641,8 @@ static int skd_cons_skcomp(struct skd_device *skdev)"comp pci_alloc, total bytes %zd entries %d\n" , SKD_SKCOMP_SIZE, SKD_N_COMPLETION_ENTRY); - skcomp =dma_zalloc_coherent (&skdev->pdev->dev,SKD_SKCOMP_SIZE , - &skdev->cq_dma_address,GFP_KERNEL ); + skcomp =dma_alloc_coherent (&skdev->pdev->dev,SKD_SKCOMP_SIZE , + &skdev->cq_dma_address,GFP_KERNEL );if (skcomp ==NULL ) { rc = -ENOMEM ;
drivers/crypto/amcc/crypto4xx_core.c +3 -3
@@ -283,9 +283,9 @@ static u32 crypto4xx_put_pd_to_pdr(struct crypto4xx_device *dev, u32 idx)*/ static u32 crypto4xx_build_gdr (struct crypto4xx_device *dev) { - dev->gdr =dma_zalloc_coherent (dev->core_dev->device, -sizeof (struct ce_gd ) *PPC4XX_NUM_GD , - &dev->gdr_pa,GFP_ATOMIC ); + dev->gdr =dma_alloc_coherent (dev->core_dev->device, +sizeof (struct ce_gd ) *PPC4XX_NUM_GD , + &dev->gdr_pa,GFP_ATOMIC );if (!dev->gdr)return -ENOMEM ;
drivers/crypto/cavium/cpt/cptpf_main.c +2 -2
@@ -278,8 +278,8 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) mcode->num_cores = is_ae ?6 :10 ;/* Allocate DMAable space */ - mcode->code =dma_zalloc_coherent (&cpt->pdev->dev, mcode->code_size, - &mcode->phys_base,GFP_KERNEL ); + mcode->code =dma_alloc_coherent (&cpt->pdev->dev, mcode->code_size, + &mcode->phys_base,GFP_KERNEL );if (!mcode->code) {dev_err (dev,"Unable to allocate space for microcode" ); ret = -ENOMEM ;
drivers/crypto/cavium/cpt/cptvf_main.c +4 -3
@@ -236,9 +236,10 @@ static int alloc_command_queues(struct cpt_vf *cptvf, c_size = (rem_q_size > qcsize_bytes) ? qcsize_bytes : rem_q_size; - curr->head = (u8 *)dma_zalloc_coherent (&pdev->dev, - c_size +CPT_NEXT_CHUNK_PTR_SIZE , - &curr->dma_addr,GFP_KERNEL ); + curr->head = (u8 *)dma_alloc_coherent (&pdev->dev, + c_size +CPT_NEXT_CHUNK_PTR_SIZE , + &curr->dma_addr, +GFP_KERNEL );if (!curr->head) {dev_err (&pdev->dev,"Command Q (%d) chunk (%d) allocation failed\n" , i, queue->nchunks);
drivers/crypto/cavium/nitrox/nitrox_lib.c +3 -3
@@ -25,9 +25,9 @@ static int nitrox_cmdq_init(struct nitrox_cmdq *cmdq, int align_bytes)struct nitrox_device *ndev = cmdq->ndev; cmdq->qsize = (ndev->qlen * cmdq->instr_size) + align_bytes; - cmdq->unalign_base =dma_zalloc_coherent (DEV (ndev), cmdq->qsize, - &cmdq->unalign_dma, -GFP_KERNEL ); + cmdq->unalign_base =dma_alloc_coherent (DEV (ndev), cmdq->qsize, + &cmdq->unalign_dma, +GFP_KERNEL );if (!cmdq->unalign_base)return -ENOMEM ;
drivers/crypto/ccp/ccp-dev-v5.c +3 -3
@@ -822,9 +822,9 @@ static int ccp5_init(struct ccp_device *ccp)/* Page alignment satisfies our needs for N <= 128 */ BUILD_BUG_ON (COMMANDS_PER_QUEUE >128 ); cmd_q->qsize =Q_SIZE (Q_DESC_SIZE ); - cmd_q->qbase =dma_zalloc_coherent (dev, cmd_q->qsize, - &cmd_q->qbase_dma, -GFP_KERNEL ); + cmd_q->qbase =dma_alloc_coherent (dev, cmd_q->qsize, + &cmd_q->qbase_dma, +GFP_KERNEL );if (!cmd_q->qbase) {dev_err (dev,"unable to allocate command queue\n" ); ret = -ENOMEM ;
drivers/crypto/hisilicon/sec/sec_algs.c +2 -2
@@ -241,8 +241,8 @@ static int sec_alg_skcipher_setkey(struct crypto_skcipher *tfm,memset (ctx->key,0 ,SEC_MAX_CIPHER_KEY ); }else {/* new key */ - ctx->key =dma_zalloc_coherent (dev,SEC_MAX_CIPHER_KEY , - &ctx->pkey,GFP_KERNEL ); + ctx->key =dma_alloc_coherent (dev,SEC_MAX_CIPHER_KEY , + &ctx->pkey,GFP_KERNEL );if (!ctx->key) {mutex_unlock (&ctx->lock);return -ENOMEM ;
drivers/crypto/hisilicon/sec/sec_drv.c +6 -9
@@ -1082,9 +1082,8 @@ static int sec_queue_res_cfg(struct sec_queue *queue)struct sec_queue_ring_db *ring_db = &queue->ring_db;int ret; - ring_cmd->vaddr =dma_zalloc_coherent (dev,SEC_Q_CMD_SIZE , - &ring_cmd->paddr, -GFP_KERNEL ); + ring_cmd->vaddr =dma_alloc_coherent (dev,SEC_Q_CMD_SIZE , + &ring_cmd->paddr,GFP_KERNEL );if (!ring_cmd->vaddr)return -ENOMEM ;
@@ -1092,17 +1091,15 @@ static int sec_queue_res_cfg(struct sec_queue *queue)mutex_init (&ring_cmd->lock); ring_cmd->callback = sec_alg_callback; - ring_cq->vaddr =dma_zalloc_coherent (dev,SEC_Q_CQ_SIZE , - &ring_cq->paddr, -GFP_KERNEL ); + ring_cq->vaddr =dma_alloc_coherent (dev,SEC_Q_CQ_SIZE , + &ring_cq->paddr,GFP_KERNEL );if (!ring_cq->vaddr) { ret = -ENOMEM ; goto err_free_ring_cmd; } - ring_db->vaddr =dma_zalloc_coherent (dev,SEC_Q_DB_SIZE , - &ring_db->paddr, -GFP_KERNEL ); + ring_db->vaddr =dma_alloc_coherent (dev,SEC_Q_DB_SIZE , + &ring_db->paddr,GFP_KERNEL );if (!ring_db->vaddr) { ret = -ENOMEM ; goto err_free_ring_cq;
drivers/crypto/ixp4xx_crypto.c +3 -3
@@ -260,9 +260,9 @@ static int setup_crypt_desc(void) {struct device *dev = &pdev->dev;BUILD_BUG_ON (sizeof (struct crypt_ctl ) !=64 ); - crypt_virt =dma_zalloc_coherent (dev, -NPE_QLEN *sizeof (struct crypt_ctl ), - &crypt_phys,GFP_ATOMIC ); + crypt_virt =dma_alloc_coherent (dev, +NPE_QLEN *sizeof (struct crypt_ctl ), + &crypt_phys,GFP_ATOMIC );if (!crypt_virt)return -ENOMEM ;return 0 ;
drivers/crypto/mediatek/mtk-platform.c +8 -8
@@ -453,17 +453,17 @@ static int mtk_desc_ring_alloc(struct mtk_cryp *cryp)if (!ring[i]) goto err_cleanup; - ring[i]->cmd_base =dma_zalloc_coherent (cryp->dev, -MTK_DESC_RING_SZ , - &ring[i]->cmd_dma, -GFP_KERNEL ); + ring[i]->cmd_base =dma_alloc_coherent (cryp->dev, +MTK_DESC_RING_SZ , + &ring[i]->cmd_dma, +GFP_KERNEL );if (!ring[i]->cmd_base) goto err_cleanup; - ring[i]->res_base =dma_zalloc_coherent (cryp->dev, -MTK_DESC_RING_SZ , - &ring[i]->res_dma, -GFP_KERNEL ); + ring[i]->res_base =dma_alloc_coherent (cryp->dev, +MTK_DESC_RING_SZ , + &ring[i]->res_dma, +GFP_KERNEL );if (!ring[i]->res_base) goto err_cleanup;
drivers/crypto/qat/qat_common/adf_admin.c +6 -6
@@ -244,18 +244,18 @@ int adf_init_admin_comms(struct adf_accel_dev *accel_dev) dev_to_node(&GET_DEV(accel_dev)));if (!admin)return -ENOMEM ; - admin->virt_addr =dma_zalloc_coherent (&GET_DEV (accel_dev),PAGE_SIZE , - &admin->phy_addr,GFP_KERNEL ); + admin->virt_addr =dma_alloc_coherent (&GET_DEV (accel_dev),PAGE_SIZE , + &admin->phy_addr,GFP_KERNEL );if (!admin->virt_addr) {dev_err (&GET_DEV (accel_dev),"Failed to allocate dma buff\n" );kfree (admin);return -ENOMEM ; } - admin->virt_tbl_addr =dma_zalloc_coherent (&GET_DEV (accel_dev), -PAGE_SIZE , - &admin->const_tbl_addr, -GFP_KERNEL ); + admin->virt_tbl_addr =dma_alloc_coherent (&GET_DEV (accel_dev), +PAGE_SIZE , + &admin->const_tbl_addr, +GFP_KERNEL );if (!admin->virt_tbl_addr) {dev_err (&GET_DEV (accel_dev),"Failed to allocate const_tbl\n" ); dma_free_coherent(&GET_DEV(accel_dev), PAGE_SIZE,
drivers/crypto/qat/qat_common/qat_algs.c +12 -12
@@ -601,15 +601,15 @@ static int qat_alg_aead_setkey(struct crypto_aead *tfm, const uint8_t *key, dev = &GET_DEV (inst->accel_dev); ctx->inst = inst; - ctx->enc_cd =dma_zalloc_coherent (dev,sizeof (*ctx->enc_cd), - &ctx->enc_cd_paddr, -GFP_ATOMIC ); + ctx->enc_cd =dma_alloc_coherent (dev,sizeof (*ctx->enc_cd), + &ctx->enc_cd_paddr, +GFP_ATOMIC );if (!ctx->enc_cd) {return -ENOMEM ; } - ctx->dec_cd =dma_zalloc_coherent (dev,sizeof (*ctx->dec_cd), - &ctx->dec_cd_paddr, -GFP_ATOMIC ); + ctx->dec_cd =dma_alloc_coherent (dev,sizeof (*ctx->dec_cd), + &ctx->dec_cd_paddr, +GFP_ATOMIC );if (!ctx->dec_cd) { goto out_free_enc; }
@@ -933,16 +933,16 @@ static int qat_alg_ablkcipher_setkey(struct crypto_ablkcipher *tfm, dev = &GET_DEV (inst->accel_dev); ctx->inst = inst; - ctx->enc_cd =dma_zalloc_coherent (dev,sizeof (*ctx->enc_cd), - &ctx->enc_cd_paddr, -GFP_ATOMIC ); + ctx->enc_cd =dma_alloc_coherent (dev,sizeof (*ctx->enc_cd), + &ctx->enc_cd_paddr, +GFP_ATOMIC );if (!ctx->enc_cd) {spin_unlock (&ctx->lock);return -ENOMEM ; } - ctx->dec_cd =dma_zalloc_coherent (dev,sizeof (*ctx->dec_cd), - &ctx->dec_cd_paddr, -GFP_ATOMIC ); + ctx->dec_cd =dma_alloc_coherent (dev,sizeof (*ctx->dec_cd), + &ctx->dec_cd_paddr, +GFP_ATOMIC );if (!ctx->dec_cd) {spin_unlock (&ctx->lock); goto out_free_enc;
drivers/crypto/qat/qat_common/qat_asym_algs.c +34 -34
170 lines not on this page · raw message
drivers/dma/imx-sdma.c +4 -4
@@ -1182,8 +1182,8 @@ static int sdma_request_channel0(struct sdma_engine *sdma) {int ret = -EBUSY ; - sdma->bd0 =dma_zalloc_coherent (NULL ,PAGE_SIZE , &sdma->bd0_phys, -GFP_NOWAIT ); + sdma->bd0 =dma_alloc_coherent (NULL ,PAGE_SIZE , &sdma->bd0_phys, +GFP_NOWAIT );if (!sdma->bd0) { ret = -ENOMEM ; goto out;
@@ -1205,8 +1205,8 @@ static int sdma_alloc_bd(struct sdma_desc *desc)u32 bd_size = desc->num_bd *sizeof (struct sdma_buffer_descriptor );int ret =0 ; - desc->bd =dma_zalloc_coherent (NULL , bd_size, &desc->bd_phys, -GFP_NOWAIT ); + desc->bd =dma_alloc_coherent (NULL , bd_size, &desc->bd_phys, +GFP_NOWAIT );if (!desc->bd) { ret = -ENOMEM ; goto out;
drivers/dma/mediatek/mtk-hsdma.c +2 -2
@@ -325,8 +325,8 @@ static int mtk_hsdma_alloc_pchan(struct mtk_hsdma_device *hsdma,* and [MTK_DMA_SIZE ... 2 * MTK_DMA_SIZE - 1] is for RX ring. */ pc->sz_ring =2 *MTK_DMA_SIZE *sizeof (*ring->txd); - ring->txd =dma_zalloc_coherent (hsdma2dev (hsdma), pc->sz_ring, - &ring->tphys,GFP_NOWAIT ); + ring->txd =dma_alloc_coherent (hsdma2dev (hsdma), pc->sz_ring, + &ring->tphys,GFP_NOWAIT );if (!ring->txd)return -ENOMEM ;
drivers/dma/mxs-dma.c +3 -3
@@ -416,9 +416,9 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan)struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;int ret; - mxs_chan->ccw =dma_zalloc_coherent (mxs_dma->dma_device.dev, -CCW_BLOCK_SIZE , - &mxs_chan->ccw_phys,GFP_KERNEL ); + mxs_chan->ccw =dma_alloc_coherent (mxs_dma->dma_device.dev, +CCW_BLOCK_SIZE , + &mxs_chan->ccw_phys,GFP_KERNEL );if (!mxs_chan->ccw) { ret = -ENOMEM ; goto err_alloc;
drivers/dma/xgene-dma.c +2 -2
@@ -1208,8 +1208,8 @@ static int xgene_dma_create_ring_one(struct xgene_dma_chan *chan, ring->size = ret;/* Allocate memory for DMA ring descriptor */ - ring->desc_vaddr =dma_zalloc_coherent (chan->dev, ring->size, - &ring->desc_paddr,GFP_KERNEL ); + ring->desc_vaddr =dma_alloc_coherent (chan->dev, ring->size, + &ring->desc_paddr,GFP_KERNEL );if (!ring->desc_vaddr) {chan_err (chan,"Failed to allocate ring desc\n" );return -ENOMEM ;
drivers/dma/xilinx/xilinx_dma.c +7 -7
@@ -879,10 +879,9 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)*/ if (chan->xdev->dma_config->dmatype ==XDMA_TYPE_AXIDMA ) {/* Allocate the buffer descriptors. */ - chan->seg_v =dma_zalloc_coherent (chan->dev, -sizeof (*chan->seg_v) * -XILINX_DMA_NUM_DESCS , - &chan->seg_p,GFP_KERNEL ); + chan->seg_v =dma_alloc_coherent (chan->dev, +sizeof (*chan->seg_v) *XILINX_DMA_NUM_DESCS , + &chan->seg_p,GFP_KERNEL );if (!chan->seg_v) { dev_err(chan->dev, "unable to allocate channel %d descriptors\n",
@@ -895,9 +894,10 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)* so allocating a desc segment during channel allocation for * programming tail descriptor. */ - chan->cyclic_seg_v =dma_zalloc_coherent (chan->dev, -sizeof (*chan->cyclic_seg_v), - &chan->cyclic_seg_p,GFP_KERNEL ); + chan->cyclic_seg_v =dma_alloc_coherent (chan->dev, +sizeof (*chan->cyclic_seg_v), + &chan->cyclic_seg_p, +GFP_KERNEL );if (!chan->cyclic_seg_v) {dev_err (chan->dev,"unable to allocate desc segment for cyclic DMA\n" );
drivers/dma/xilinx/zynqmp_dma.c +3 -3
@@ -490,9 +490,9 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)list_add_tail (&desc->node, &chan->free_list); } - chan->desc_pool_v =dma_zalloc_coherent (chan->dev, - (2 * chan->desc_size *ZYNQMP_DMA_NUM_DESCS ), - &chan->desc_pool_p,GFP_KERNEL ); + chan->desc_pool_v =dma_alloc_coherent (chan->dev, + (2 * chan->desc_size *ZYNQMP_DMA_NUM_DESCS ), + &chan->desc_pool_p,GFP_KERNEL );if (!chan->desc_pool_v)return -ENOMEM ;
drivers/gpu/drm/drm_pci.c +3 -2
@@ -61,8 +61,9 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t alireturn NULL ; dmah->size = size; - dmah->vaddr =dma_zalloc_coherent (&dev->pdev->dev, size, &dmah->busaddr, -GFP_KERNEL | __GFP_COMP); + dmah->vaddr =dma_alloc_coherent (&dev->pdev->dev, size, + &dmah->busaddr, +GFP_KERNEL | __GFP_COMP);if (dmah->vaddr ==NULL ) {kfree (dmah);
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +2 -2
@@ -766,8 +766,8 @@ struct bnxt_qplib_rcfw_sbuf *bnxt_qplib_rcfw_alloc_sbuf(return NULL ; sbuf->size = size; - sbuf->sb =dma_zalloc_coherent (&rcfw->pdev->dev, sbuf->size, - &sbuf->dma_addr,GFP_ATOMIC ); + sbuf->sb =dma_alloc_coherent (&rcfw->pdev->dev, sbuf->size, + &sbuf->dma_addr,GFP_ATOMIC );if (!sbuf->sb) goto bail;
drivers/infiniband/hw/bnxt_re/qplib_res.c +4 -4
@@ -105,10 +105,10 @@ static int __alloc_pbl(struct pci_dev *pdev, struct bnxt_qplib_pbl *pbl,if (!sghead) {for (i =0 ; i < pages; i++) { - pbl->pg_arr[i] =dma_zalloc_coherent (&pdev->dev, - pbl->pg_size, - &pbl->pg_map_arr[i], -GFP_KERNEL ); + pbl->pg_arr[i] =dma_alloc_coherent (&pdev->dev, + pbl->pg_size, + &pbl->pg_map_arr[i], +GFP_KERNEL );if (!pbl->pg_arr[i]) goto fail; pbl->pg_count++;
drivers/infiniband/hw/cxgb3/cxio_hal.c +3 -3
@@ -291,9 +291,9 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain,if (!wq->sq) goto err3; - wq->queue =dma_zalloc_coherent (&(rdev_p->rnic_info.pdev->dev), - depth *sizeof (union t3_wr ), - &(wq->dma_addr),GFP_KERNEL ); + wq->queue =dma_alloc_coherent (&(rdev_p->rnic_info.pdev->dev), + depth *sizeof (union t3_wr ), + &(wq->dma_addr),GFP_KERNEL );if (!wq->queue) goto err4;
drivers/infiniband/hw/cxgb4/qp.c +2 -3
@@ -2564,9 +2564,8 @@ static int alloc_srq_queue(struct c4iw_srq *srq, struct c4iw_dev_ucontext *uctx, wq->rqt_abs_idx = (wq->rqt_hwaddr - rdev->lldi.vr->rq.start) >>T4_RQT_ENTRY_SHIFT ; - wq->queue =dma_zalloc_coherent (&rdev->lldi.pdev->dev, - wq->memsize, &wq->dma_addr, -GFP_KERNEL ); + wq->queue =dma_alloc_coherent (&rdev->lldi.pdev->dev, wq->memsize, + &wq->dma_addr,GFP_KERNEL );if (!wq->queue) goto err_free_rqtpool;
drivers/infiniband/hw/hfi1/init.c +15 -14
@@ -899,10 +899,10 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) goto done;/* allocate dummy tail memory for all receive contexts */ - dd->rcvhdrtail_dummy_kvaddr =dma_zalloc_coherent ( - &dd->pcidev->dev,sizeof (u64), - &dd->rcvhdrtail_dummy_dma, -GFP_KERNEL ); + dd->rcvhdrtail_dummy_kvaddr =dma_alloc_coherent (&dd->pcidev->dev, +sizeof (u64), + &dd->rcvhdrtail_dummy_dma, +GFP_KERNEL );if (!dd->rcvhdrtail_dummy_kvaddr) {dd_dev_err (dd,"cannot allocate dummy tail memory\n" );
@@ -1863,9 +1863,9 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) gfp_flags =GFP_KERNEL ; else gfp_flags =GFP_USER ; - rcd->rcvhdrq =dma_zalloc_coherent ( - &dd->pcidev->dev, amt, &rcd->rcvhdrq_dma, - gfp_flags | __GFP_COMP); + rcd->rcvhdrq =dma_alloc_coherent (&dd->pcidev->dev, amt, + &rcd->rcvhdrq_dma, + gfp_flags | __GFP_COMP);if (!rcd->rcvhdrq) { dd_dev_err(dd,
@@ -1876,9 +1876,10 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)if (HFI1_CAP_KGET_MASK (rcd->flags,DMA_RTAIL ) ||HFI1_CAP_UGET_MASK (rcd->flags,DMA_RTAIL )) { - rcd->rcvhdrtail_kvaddr =dma_zalloc_coherent ( - &dd->pcidev->dev,PAGE_SIZE , - &rcd->rcvhdrqtailaddr_dma, gfp_flags); + rcd->rcvhdrtail_kvaddr =dma_alloc_coherent (&dd->pcidev->dev, +PAGE_SIZE , + &rcd->rcvhdrqtailaddr_dma, + gfp_flags);if (!rcd->rcvhdrtail_kvaddr) goto bail_free; }
@@ -1974,10 +1975,10 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd)while (alloced_bytes < rcd->egrbufs.size && rcd->egrbufs.alloced < rcd->egrbufs.count) { rcd->egrbufs.buffers[idx].addr = -dma_zalloc_coherent (&dd->pcidev->dev, - rcd->egrbufs.rcvtid_size, - &rcd->egrbufs.buffers[idx].dma, - gfp_flags); +dma_alloc_coherent (&dd->pcidev->dev, + rcd->egrbufs.rcvtid_size, + &rcd->egrbufs.buffers[idx].dma, + gfp_flags);if (rcd->egrbufs.buffers[idx].addr) { rcd->egrbufs.buffers[idx].len = rcd->egrbufs.rcvtid_size;
drivers/infiniband/hw/hfi1/pio.c +4 -5
@@ -2098,11 +2098,10 @@ int init_credit_return(struct hfi1_devdata *dd)int bytes =TXE_NUM_CONTEXTS *sizeof (struct credit_return );set_dev_node (&dd->pcidev->dev, i); - dd->cr_base[i].va =dma_zalloc_coherent ( - &dd->pcidev->dev, - bytes, - &dd->cr_base[i].dma, -GFP_KERNEL ); + dd->cr_base[i].va =dma_alloc_coherent (&dd->pcidev->dev, + bytes, + &dd->cr_base[i].dma, +GFP_KERNEL );if (!dd->cr_base[i].va) {set_dev_node (&dd->pcidev->dev, dd->node); dd_dev_err(dd,
drivers/infiniband/hw/hfi1/sdma.c +9 -18
@@ -1453,12 +1453,9 @@ int sdma_init(struct hfi1_devdata *dd, u8 port)timer_setup (&sde->err_progress_check_timer, sdma_err_progress_check,0 ); - sde->descq =dma_zalloc_coherent ( - &dd->pcidev->dev, - descq_cnt *sizeof (u64[2 ]), - &sde->descq_phys, -GFP_KERNEL - ); + sde->descq =dma_alloc_coherent (&dd->pcidev->dev, + descq_cnt *sizeof (u64[2 ]), + &sde->descq_phys,GFP_KERNEL );if (!sde->descq) goto bail; sde->tx_ring =
@@ -1471,24 +1468,18 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) dd->sdma_heads_size =L1_CACHE_BYTES * num_engines;/* Allocate memory for DMA of head registers to memory */ - dd->sdma_heads_dma =dma_zalloc_coherent ( - &dd->pcidev->dev, - dd->sdma_heads_size, - &dd->sdma_heads_phys, -GFP_KERNEL - ); + dd->sdma_heads_dma =dma_alloc_coherent (&dd->pcidev->dev, + dd->sdma_heads_size, + &dd->sdma_heads_phys, +GFP_KERNEL );if (!dd->sdma_heads_dma) {dd_dev_err (dd,"failed to allocate SendDMA head memory\n" ); goto bail; }/* Allocate memory for pad */ - dd->sdma_pad_dma =dma_zalloc_coherent ( - &dd->pcidev->dev, -sizeof (u32), - &dd->sdma_pad_phys, -GFP_KERNEL - ); + dd->sdma_pad_dma =dma_alloc_coherent (&dd->pcidev->dev,sizeof (u32), + &dd->sdma_pad_phys,GFP_KERNEL );if (!dd->sdma_pad_dma) {dd_dev_err (dd,"failed to allocate SendDMA pad memory\n" ); goto bail;
drivers/infiniband/hw/hns/hns_roce_alloc.c +6 -5
@@ -197,8 +197,8 @@ int hns_roce_buf_alloc(struct hns_roce_dev *hr_dev, u32 size, u32 max_direct, buf->npages =1 << order; buf->page_shift = page_shift;/* MTT PA must be recorded in 4k alignment, t is 4k aligned */ - buf->direct.buf =dma_zalloc_coherent (dev, - size, &t,GFP_KERNEL ); + buf->direct.buf =dma_alloc_coherent (dev, size, &t, +GFP_KERNEL );if (!buf->direct.buf)return -ENOMEM ;
@@ -219,9 +219,10 @@ int hns_roce_buf_alloc(struct hns_roce_dev *hr_dev, u32 size, u32 max_direct,return -ENOMEM ;for (i =0 ; i < buf->nbufs; ++i) { - buf->page_list[i].buf =dma_zalloc_coherent (dev, - page_size, &t, -GFP_KERNEL ); + buf->page_list[i].buf =dma_alloc_coherent (dev, + page_size, + &t, +GFP_KERNEL );if (!buf->page_list[i].buf) goto err_free;
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +5 -5
@@ -5091,7 +5091,7 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev, eqe_alloc = i * (buf_chk_sz / eq->eqe_size); size = (eq->entries - eqe_alloc) * eq->eqe_size; } - eq->buf[i] =dma_zalloc_coherent (dev, size, + eq->buf[i] =dma_alloc_coherent (dev, size, &(eq->buf_dma[i]),GFP_KERNEL );if (!eq->buf[i])
@@ -5126,9 +5126,9 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev, size = (eq->entries - eqe_alloc) * eq->eqe_size; } - eq->buf[idx] =dma_zalloc_coherent (dev, size, - &(eq->buf_dma[idx]), -GFP_KERNEL ); + eq->buf[idx] =dma_alloc_coherent (dev, size, + &(eq->buf_dma[idx]), +GFP_KERNEL );if (!eq->buf[idx]) goto err_dma_alloc_buf;
@@ -5241,7 +5241,7 @@ static int hns_roce_v2_create_eq(struct hns_roce_dev *hr_dev, goto free_cmd_mbox; } - eq->buf_list->buf =dma_zalloc_coherent (dev, buf_chk_sz, + eq->buf_list->buf =dma_alloc_coherent (dev, buf_chk_sz, &(eq->buf_list->map),GFP_KERNEL );if (!eq->buf_list->buf) {
drivers/infiniband/hw/i40iw/i40iw_utils.c +2 -2
@@ -745,8 +745,8 @@ enum i40iw_status_code i40iw_allocate_dma_mem(struct i40iw_hw *hw,if (!mem)return I40IW_ERR_PARAM ; mem->size =ALIGN (size, alignment); - mem->va =dma_zalloc_coherent (&pcidev->dev, mem->size, - (dma_addr_t *)&mem->pa,GFP_KERNEL ); + mem->va =dma_alloc_coherent (&pcidev->dev, mem->size, + (dma_addr_t *)&mem->pa,GFP_KERNEL );if (!mem->va)return I40IW_ERR_NO_MEMORY ;return 0 ;
drivers/infiniband/hw/mthca/mthca_memfree.c +3 -2
@@ -623,8 +623,9 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type, page = dev->db_tab->page + end; alloc: - page->db_rec =dma_zalloc_coherent (&dev->pdev->dev,MTHCA_ICM_PAGE_SIZE , - &page->mapping,GFP_KERNEL ); + page->db_rec =dma_alloc_coherent (&dev->pdev->dev, +MTHCA_ICM_PAGE_SIZE , &page->mapping, +GFP_KERNEL );if (!page->db_rec) { ret = -ENOMEM ; goto out;
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +7 -7
@@ -380,8 +380,8 @@ static int ocrdma_alloc_q(struct ocrdma_dev *dev, q->len = len; q->entry_size = entry_size; q->size = len * entry_size; - q->va =dma_zalloc_coherent (&dev->nic_info.pdev->dev, q->size, - &q->dma,GFP_KERNEL ); + q->va =dma_alloc_coherent (&dev->nic_info.pdev->dev, q->size, &q->dma, +GFP_KERNEL );if (!q->va)return -ENOMEM ;return 0 ;
@@ -1819,7 +1819,7 @@ int ocrdma_mbx_create_cq(struct ocrdma_dev *dev, struct ocrdma_cq *cq,return -ENOMEM ;ocrdma_init_mch (&cmd->cmd.req,OCRDMA_CMD_CREATE_CQ ,OCRDMA_SUBSYS_COMMON ,sizeof (*cmd)); - cq->va =dma_zalloc_coherent (&pdev->dev, cq->len, &cq->pa,GFP_KERNEL ); + cq->va =dma_alloc_coherent (&pdev->dev, cq->len, &cq->pa,GFP_KERNEL );if (!cq->va) { status = -ENOMEM ; goto mem_err;
@@ -2209,7 +2209,7 @@ static int ocrdma_set_create_qp_sq_cmd(struct ocrdma_create_qp_req *cmd, qp->sq.max_cnt = max_wqe_allocated; len = (hw_pages * hw_page_size); - qp->sq.va =dma_zalloc_coherent (&pdev->dev, len, &pa,GFP_KERNEL ); + qp->sq.va =dma_alloc_coherent (&pdev->dev, len, &pa,GFP_KERNEL );if (!qp->sq.va)return -EINVAL ; qp->sq.len = len;
@@ -2259,7 +2259,7 @@ static int ocrdma_set_create_qp_rq_cmd(struct ocrdma_create_qp_req *cmd, qp->rq.max_cnt = max_rqe_allocated; len = (hw_pages * hw_page_size); - qp->rq.va =dma_zalloc_coherent (&pdev->dev, len, &pa,GFP_KERNEL ); + qp->rq.va =dma_alloc_coherent (&pdev->dev, len, &pa,GFP_KERNEL );if (!qp->rq.va)return -ENOMEM ; qp->rq.pa = pa;
@@ -2315,8 +2315,8 @@ static int ocrdma_set_create_qp_ird_cmd(struct ocrdma_create_qp_req *cmd,if (dev->attr.ird ==0 )return 0 ; - qp->ird_q_va =dma_zalloc_coherent (&pdev->dev, ird_q_len, &pa, -GFP_KERNEL ); + qp->ird_q_va =dma_alloc_coherent (&pdev->dev, ird_q_len, &pa, +GFP_KERNEL );if (!qp->ird_q_va)return -ENOMEM ; ocrdma_build_q_pages(&cmd->ird_addr[0], dev->attr.num_ird_pages,
drivers/infiniband/hw/ocrdma/ocrdma_stats.c +2 -2
@@ -73,8 +73,8 @@ bool ocrdma_alloc_stats_resources(struct ocrdma_dev *dev) mem->size =max_t (u32,sizeof (struct ocrdma_rdma_stats_req ),sizeof (struct ocrdma_rdma_stats_resp )); - mem->va =dma_zalloc_coherent (&dev->nic_info.pdev->dev, mem->size, - &mem->pa,GFP_KERNEL ); + mem->va =dma_alloc_coherent (&dev->nic_info.pdev->dev, mem->size, + &mem->pa,GFP_KERNEL );if (!mem->va) {pr_err ("%s: stats mbox allocation failed\n" , __func__);return false;
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +3 -3
@@ -504,8 +504,8 @@ struct ib_ucontext *ocrdma_alloc_ucontext(struct ib_device *ibdev,INIT_LIST_HEAD (&ctx->mm_head);mutex_init (&ctx->mm_list_lock); - ctx->ah_tbl.va =dma_zalloc_coherent (&pdev->dev, map_len, - &ctx->ah_tbl.pa,GFP_KERNEL ); + ctx->ah_tbl.va =dma_alloc_coherent (&pdev->dev, map_len, + &ctx->ah_tbl.pa,GFP_KERNEL );if (!ctx->ah_tbl.va) {kfree (ctx);return ERR_PTR (-ENOMEM );
@@ -838,7 +838,7 @@ static int ocrdma_build_pbl_tbl(struct ocrdma_dev *dev, struct ocrdma_hw_mr *mr)return -ENOMEM ;for (i =0 ; i < mr->num_pbls; i++) { - va =dma_zalloc_coherent (&pdev->dev, dma_len, &pa,GFP_KERNEL ); + va =dma_alloc_coherent (&pdev->dev, dma_len, &pa,GFP_KERNEL );if (!va) {ocrdma_free_mr_pbl_tbl (dev, mr); status = -ENOMEM ;
drivers/infiniband/hw/qedr/verbs.c +2 -2
@@ -556,8 +556,8 @@ static struct qedr_pbl *qedr_alloc_pbl_tbl(struct qedr_dev *dev,return ERR_PTR (-ENOMEM );for (i =0 ; i < pbl_info->num_pbls; i++) { - va =dma_zalloc_coherent (&pdev->dev, pbl_info->pbl_size, - &pa, flags); + va =dma_alloc_coherent (&pdev->dev, pbl_info->pbl_size, &pa, + flags);if (!va) goto err;
drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +2 -2
@@ -890,8 +890,8 @@ static int pvrdma_pci_probe(struct pci_dev *pdev,dev_info (&pdev->dev,"device version %d, driver version %d\n" , dev->dsr_version,PVRDMA_VERSION ); - dev->dsr =dma_zalloc_coherent (&pdev->dev,sizeof (*dev->dsr), - &dev->dsrbase,GFP_KERNEL ); + dev->dsr =dma_alloc_coherent (&pdev->dev,sizeof (*dev->dsr), + &dev->dsrbase,GFP_KERNEL );if (!dev->dsr) {dev_err (&pdev->dev,"failed to allocate shared region\n" ); ret = -ENOMEM ;
drivers/input/touchscreen/raspberrypi-ts.c +2 -2
@@ -147,8 +147,8 @@ static int rpi_ts_probe(struct platform_device *pdev)return -ENOMEM ; ts->pdev = pdev; - ts->fw_regs_va =dma_zalloc_coherent (dev,PAGE_SIZE , &ts->fw_regs_phys, -GFP_KERNEL ); + ts->fw_regs_va =dma_alloc_coherent (dev,PAGE_SIZE , &ts->fw_regs_phys, +GFP_KERNEL );if (!ts->fw_regs_va) {dev_err (dev,"failed to dma_alloc_coherent\n" );return -ENOMEM ;
drivers/iommu/mtk_iommu_v1.c +2 -3
@@ -232,9 +232,8 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_data *data)spin_lock_init (&dom->pgtlock); - dom->pgt_va =dma_zalloc_coherent (data->dev, -M2701_IOMMU_PGT_SIZE , - &dom->pgt_pa,GFP_KERNEL ); + dom->pgt_va =dma_alloc_coherent (data->dev,M2701_IOMMU_PGT_SIZE , + &dom->pgt_pa,GFP_KERNEL );if (!dom->pgt_va)return -ENOMEM ;
drivers/media/pci/intel/ipu3/ipu3-cio2.c +2 -2
@@ -218,8 +218,8 @@ static int cio2_fbpt_init(struct cio2_device *cio2, struct cio2_queue *q) {struct device *dev = &cio2->pci_dev->dev; - q->fbpt =dma_zalloc_coherent (dev,CIO2_FBPT_SIZE , &q->fbpt_bus_addr, -GFP_KERNEL ); + q->fbpt =dma_alloc_coherent (dev,CIO2_FBPT_SIZE , &q->fbpt_bus_addr, +GFP_KERNEL );if (!q->fbpt)return -ENOMEM ;
drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c +1 -1
@@ -49,7 +49,7 @@ int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data,struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data;struct device *dev = &ctx->dev->plat_dev->dev; - mem->va =dma_zalloc_coherent (dev, size, &mem->dma_addr,GFP_KERNEL ); + mem->va =dma_alloc_coherent (dev, size, &mem->dma_addr,GFP_KERNEL );if (!mem->va) {mtk_v4l2_err ("%s dma_alloc size=%ld failed!" ,dev_name (dev), size);
drivers/misc/genwqe/card_utils.c +2 -2
@@ -218,8 +218,8 @@ void *__genwqe_alloc_consistent(struct genwqe_dev *cd, size_t size,if (get_order (size) >=MAX_ORDER )return NULL ; -return dma_zalloc_coherent (&cd->pci_dev->dev, size, dma_handle, -GFP_KERNEL ); +return dma_alloc_coherent (&cd->pci_dev->dev, size, dma_handle, +GFP_KERNEL ); } void __genwqe_free_consistent(struct genwqe_dev *cd, size_t size,
drivers/mmc/host/sdhci.c +3 -2
@@ -3763,8 +3763,9 @@ int sdhci_setup_host(struct sdhci_host *host)* Use zalloc to zero the reserved high 32-bits of 128-bit * descriptors so that they never need to be written. */ - buf =dma_zalloc_coherent (mmc_dev (mmc), host->align_buffer_sz + - host->adma_table_sz, &dma,GFP_KERNEL ); + buf =dma_alloc_coherent (mmc_dev (mmc), + host->align_buffer_sz + host->adma_table_sz, + &dma,GFP_KERNEL );if (!buf) {pr_warn ("%s: Unable to allocate ADMA buffers - falling back to standard DMA\n" ,mmc_hostname (mmc));
drivers/net/ethernet/aeroflex/greth.c +6 -6
@@ -1433,18 +1433,18 @@ static int greth_of_probe(struct platform_device *ofdev) }/* Allocate TX descriptor ring in coherent memory */ - greth->tx_bd_base =dma_zalloc_coherent (greth->dev,1024 , - &greth->tx_bd_base_phys, -GFP_KERNEL ); + greth->tx_bd_base =dma_alloc_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_zalloc_coherent (greth->dev,1024 , - &greth->rx_bd_base_phys, -GFP_KERNEL ); + greth->rx_bd_base =dma_alloc_coherent (greth->dev,1024 , + &greth->rx_bd_base_phys, +GFP_KERNEL );if (!greth->rx_bd_base) { err = -ENOMEM ; goto error4;
drivers/net/ethernet/alacritech/slicoss.c +6 -6
@@ -795,8 +795,8 @@ static int slic_init_stat_queue(struct slic_device *sdev) size = stq->len *sizeof (*descs) +DESC_ALIGN_MASK ;for (i =0 ; i <SLIC_NUM_STAT_DESC_ARRAYS ; i++) { - descs =dma_zalloc_coherent (&sdev->pdev->dev, size, &paddr, -GFP_KERNEL ); + descs =dma_alloc_coherent (&sdev->pdev->dev, size, &paddr, +GFP_KERNEL );if (!descs) {netdev_err (sdev->netdev,"failed to allocate status descriptors\n" );
@@ -1240,8 +1240,8 @@ static int slic_init_shmem(struct slic_device *sdev)struct slic_shmem_data *sm_data;dma_addr_t paddr; - sm_data =dma_zalloc_coherent (&sdev->pdev->dev,sizeof (*sm_data), - &paddr,GFP_KERNEL ); + sm_data =dma_alloc_coherent (&sdev->pdev->dev,sizeof (*sm_data), + &paddr,GFP_KERNEL );if (!sm_data) {dev_err (&sdev->pdev->dev,"failed to allocate shared memory\n" );return -ENOMEM ;
@@ -1621,8 +1621,8 @@ static int slic_read_eeprom(struct slic_device *sdev)int err =0 ;u8 *mac[2 ]; - eeprom =dma_zalloc_coherent (&sdev->pdev->dev,SLIC_EEPROM_SIZE , - &paddr,GFP_KERNEL ); + eeprom =dma_alloc_coherent (&sdev->pdev->dev,SLIC_EEPROM_SIZE , + &paddr,GFP_KERNEL );if (!eeprom)return -ENOMEM ;
drivers/net/ethernet/amazon/ena/ena_com.c +31 -30
133 lines not on this page · raw message
drivers/net/ethernet/apm/xgene-v2/main.c +4 -4
@@ -206,8 +206,8 @@ static netdev_tx_t xge_start_xmit(struct sk_buff *skb, struct net_device *ndev) }/* Packet buffers should be 64B aligned */ - pkt_buf =dma_zalloc_coherent (dev,XGENE_ENET_STD_MTU , &dma_addr, -GFP_ATOMIC ); + pkt_buf =dma_alloc_coherent (dev,XGENE_ENET_STD_MTU , &dma_addr, +GFP_ATOMIC );if (unlikely (!pkt_buf)) {dev_kfree_skb_any (skb);return NETDEV_TX_OK ;
@@ -428,8 +428,8 @@ static struct xge_desc_ring *xge_create_desc_ring(struct net_device *ndev) ring->ndev = ndev; size =XGENE_ENET_DESC_SIZE *XGENE_ENET_NUM_DESC ; - ring->desc_addr =dma_zalloc_coherent (dev, size, &ring->dma_addr, -GFP_KERNEL ); + ring->desc_addr =dma_alloc_coherent (dev, size, &ring->dma_addr, +GFP_KERNEL );if (!ring->desc_addr) goto err;
drivers/net/ethernet/atheros/alx/main.c +3 -4
@@ -660,10 +660,9 @@ static int alx_alloc_rings(struct alx_priv *alx) alx->num_txq +sizeof (struct alx_rrd ) * alx->rx_ringsz +sizeof (struct alx_rfd ) * alx->rx_ringsz; - alx->descmem.virt =dma_zalloc_coherent (&alx->hw.pdev->dev, - alx->descmem.size, - &alx->descmem.dma, -GFP_KERNEL ); + alx->descmem.virt =dma_alloc_coherent (&alx->hw.pdev->dev, + alx->descmem.size, + &alx->descmem.dma,GFP_KERNEL );if (!alx->descmem.virt)return -ENOMEM ;
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +2 -2
@@ -1019,8 +1019,8 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)sizeof (struct atl1c_recv_ret_status ) * rx_desc_count +8 *4 ; - ring_header->desc =dma_zalloc_coherent (&pdev->dev, ring_header->size, - &ring_header->dma,GFP_KERNEL ); + ring_header->desc =dma_alloc_coherent (&pdev->dev, ring_header->size, + &ring_header->dma,GFP_KERNEL );if (unlikely (!ring_header->desc)) {dev_err (&pdev->dev,"could not get memory for DMA buffer\n" ); goto err_nomem;
drivers/net/ethernet/broadcom/bcm63xx_enet.c +4 -4
@@ -936,7 +936,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_zalloc_coherent (kdev, size, &priv->rx_desc_dma,GFP_KERNEL ); + p =dma_alloc_coherent (kdev, size, &priv->rx_desc_dma,GFP_KERNEL );if (!p) { ret = -ENOMEM ; goto out_freeirq_tx;
@@ -947,7 +947,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_zalloc_coherent (kdev, size, &priv->tx_desc_dma,GFP_KERNEL ); + p =dma_alloc_coherent (kdev, size, &priv->tx_desc_dma,GFP_KERNEL );if (!p) { ret = -ENOMEM ; goto out_free_rx_ring;
@@ -2120,7 +2120,7 @@ static int bcm_enetsw_open(struct net_device *dev)/* allocate rx dma ring */ size = priv->rx_ring_size *sizeof (struct bcm_enet_desc ); - p =dma_zalloc_coherent (kdev, size, &priv->rx_desc_dma,GFP_KERNEL ); + p =dma_alloc_coherent (kdev, size, &priv->rx_desc_dma,GFP_KERNEL );if (!p) {dev_err (kdev,"cannot allocate rx ring %u\n" , size); ret = -ENOMEM ;
@@ -2132,7 +2132,7 @@ static int bcm_enetsw_open(struct net_device *dev)/* allocate tx dma ring */ size = priv->tx_ring_size *sizeof (struct bcm_enet_desc ); - p =dma_zalloc_coherent (kdev, size, &priv->tx_desc_dma,GFP_KERNEL ); + p =dma_alloc_coherent (kdev, size, &priv->tx_desc_dma,GFP_KERNEL );if (!p) {dev_err (kdev,"cannot allocate tx ring\n" ); ret = -ENOMEM ;
drivers/net/ethernet/broadcom/bcmsysport.c +2 -2
@@ -1506,8 +1506,8 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv,/* We just need one DMA descriptor which is DMA-able, since writing to * the port will allocate a new descriptor in its internal linked-list */ - p =dma_zalloc_coherent (kdev,sizeof (struct dma_desc ), &ring->desc_dma, -GFP_KERNEL ); + p =dma_alloc_coherent (kdev,sizeof (struct dma_desc ), &ring->desc_dma, +GFP_KERNEL );if (!p) {netif_err (priv, hw, priv->netdev,"DMA alloc failed\n" );return -ENOMEM ;
drivers/net/ethernet/broadcom/bgmac.c +6 -6
@@ -634,9 +634,9 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)/* Alloc ring of descriptors */ size =BGMAC_TX_RING_SLOTS *sizeof (struct bgmac_dma_desc ); - ring->cpu_base =dma_zalloc_coherent (dma_dev, size, - &ring->dma_base, -GFP_KERNEL ); + ring->cpu_base =dma_alloc_coherent (dma_dev, size, + &ring->dma_base, +GFP_KERNEL );if (!ring->cpu_base) {dev_err (bgmac->dev,"Allocation of TX ring 0x%X failed\n" , ring->mmio_base);
@@ -659,9 +659,9 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)/* Alloc ring of descriptors */ size =BGMAC_RX_RING_SLOTS *sizeof (struct bgmac_dma_desc ); - ring->cpu_base =dma_zalloc_coherent (dma_dev, size, - &ring->dma_base, -GFP_KERNEL ); + ring->cpu_base =dma_alloc_coherent (dma_dev, size, + &ring->dma_base, +GFP_KERNEL );if (!ring->cpu_base) {dev_err (bgmac->dev,"Allocation of RX ring 0x%X failed\n" , ring->mmio_base);
drivers/net/ethernet/broadcom/bnx2.c +2 -2
@@ -844,8 +844,8 @@ bnx2_alloc_stats_blk(struct net_device *dev) BNX2_SBLK_MSIX_ALIGN_SIZE); bp->status_stats_size = status_blk_size +sizeof (struct statistics_block ); - status_blk =dma_zalloc_coherent (&bp->pdev->dev, bp->status_stats_size, - &bp->status_blk_mapping,GFP_KERNEL ); + status_blk =dma_alloc_coherent (&bp->pdev->dev, bp->status_stats_size, + &bp->status_blk_mapping,GFP_KERNEL );if (!status_blk)return -ENOMEM ;
drivers/net/ethernet/broadcom/bnxt/bnxt.c +8 -8
@@ -3449,10 +3449,10 @@ static int bnxt_alloc_stats(struct bnxt *bp) goto alloc_tx_ext_stats; bp->hw_rx_port_stats_ext = -dma_zalloc_coherent (&pdev->dev, -sizeof (struct rx_port_stats_ext ), - &bp->hw_rx_port_stats_ext_map, -GFP_KERNEL ); +dma_alloc_coherent (&pdev->dev, +sizeof (struct rx_port_stats_ext ), + &bp->hw_rx_port_stats_ext_map, +GFP_KERNEL );if (!bp->hw_rx_port_stats_ext)return 0 ;
@@ -3462,10 +3462,10 @@ static int bnxt_alloc_stats(struct bnxt *bp)if (bp->hwrm_spec_code >=0x10902 ) { bp->hw_tx_port_stats_ext = -dma_zalloc_coherent (&pdev->dev, -sizeof (struct tx_port_stats_ext ), - &bp->hw_tx_port_stats_ext_map, -GFP_KERNEL ); +dma_alloc_coherent (&pdev->dev, +sizeof (struct tx_port_stats_ext ), + &bp->hw_tx_port_stats_ext_map, +GFP_KERNEL ); } bp->flags |=BNXT_FLAG_PORT_STATS_EXT ; }
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +2 -2
@@ -316,8 +316,8 @@ static int bnxt_hwrm_set_dcbx_app(struct bnxt *bp, struct dcb_app *app, n =IEEE_8021QAZ_MAX_TCS ; data_len =sizeof (*data) +sizeof (*fw_app) * n; - data =dma_zalloc_coherent (&bp->pdev->dev, data_len, &mapping, -GFP_KERNEL ); + data =dma_alloc_coherent (&bp->pdev->dev, data_len, &mapping, +GFP_KERNEL );if (!data)return -ENOMEM ;
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +2 -2
@@ -85,8 +85,8 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,return -EFAULT ; } - data_addr =dma_zalloc_coherent (&bp->pdev->dev, bytesize, - &data_dma_addr,GFP_KERNEL ); + data_addr =dma_alloc_coherent (&bp->pdev->dev, bytesize, + &data_dma_addr,GFP_KERNEL );if (!data_addr)return -ENOMEM ;
drivers/net/ethernet/broadcom/tg3.c +11 -11
@@ -8712,10 +8712,10 @@ static int tg3_mem_rx_acquire(struct tg3 *tp)if (!i &&tg3_flag (tp,ENABLE_RSS ))continue ; - tnapi->rx_rcb =dma_zalloc_coherent (&tp->pdev->dev, -TG3_RX_RCB_RING_BYTES (tp), - &tnapi->rx_rcb_mapping, -GFP_KERNEL ); + tnapi->rx_rcb =dma_alloc_coherent (&tp->pdev->dev, +TG3_RX_RCB_RING_BYTES (tp), + &tnapi->rx_rcb_mapping, +GFP_KERNEL );if (!tnapi->rx_rcb) goto err_out; }
@@ -8768,9 +8768,9 @@ static int tg3_alloc_consistent(struct tg3 *tp) {int i; - tp->hw_stats =dma_zalloc_coherent (&tp->pdev->dev, -sizeof (struct tg3_hw_stats ), - &tp->stats_mapping,GFP_KERNEL ); + tp->hw_stats =dma_alloc_coherent (&tp->pdev->dev, +sizeof (struct tg3_hw_stats ), + &tp->stats_mapping,GFP_KERNEL );if (!tp->hw_stats) goto err_out;
@@ -8778,10 +8778,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_zalloc_coherent (&tp->pdev->dev, -TG3_HW_STATUS_SIZE , - &tnapi->status_mapping, -GFP_KERNEL ); + tnapi->hw_status =dma_alloc_coherent (&tp->pdev->dev, +TG3_HW_STATUS_SIZE , + &tnapi->status_mapping, +GFP_KERNEL );if (!tnapi->hw_status) goto err_out;
drivers/net/ethernet/cavium/thunder/nicvf_queues.c +1 -1
@@ -59,7 +59,7 @@ static int nicvf_alloc_q_desc_mem(struct nicvf *nic, struct q_desc_mem *dmem, dmem->q_len = q_len; dmem->size = (desc_size * q_len) + align_bytes;/* Save address, need it while freeing */ - dmem->unalign_base =dma_zalloc_coherent (&nic->pdev->dev, dmem->size, + dmem->unalign_base =dma_alloc_coherent (&nic->pdev->dev, dmem->size, &dmem->dma,GFP_KERNEL );if (!dmem->unalign_base)return -ENOMEM ;
drivers/net/ethernet/chelsio/cxgb3/sge.c +1 -1
@@ -620,7 +620,7 @@ static void *alloc_ring(struct pci_dev *pdev, size_t nelem, size_t elem_size, {size_t len = nelem * elem_size;void *s =NULL ; -void *p =dma_zalloc_coherent (&pdev->dev, len, phys,GFP_KERNEL ); +void *p =dma_alloc_coherent (&pdev->dev, len, phys,GFP_KERNEL );if (!p)return NULL ;
drivers/net/ethernet/chelsio/cxgb4/sge.c +1 -1
@@ -694,7 +694,7 @@ static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size, {size_t len = nelem * elem_size + stat_size;void *s =NULL ; -void *p =dma_zalloc_coherent (dev, len, phys,GFP_KERNEL ); +void *p =dma_alloc_coherent (dev, len, phys,GFP_KERNEL );if (!p)return NULL ;
drivers/net/ethernet/chelsio/cxgb4vf/sge.c +1 -1
@@ -756,7 +756,7 @@ static void *alloc_ring(struct device *dev, size_t nelem, size_t hwsize,* Allocate the hardware ring and PCI DMA bus address space for said. */ size_t hwlen = nelem * hwsize + stat_size; -void *hwring =dma_zalloc_coherent (dev, hwlen, busaddrp,GFP_KERNEL ); +void *hwring =dma_alloc_coherent (dev, hwlen, busaddrp,GFP_KERNEL );if (!hwring)return NULL ;
drivers/net/ethernet/emulex/benet/be_cmds.c +34 -34
152 lines not on this page · raw message
drivers/net/ethernet/emulex/benet/be_ethtool.c +9 -9
@@ -274,8 +274,8 @@ static int lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name,int status =0 ; read_cmd.size =LANCER_READ_FILE_CHUNK ; - read_cmd.va =dma_zalloc_coherent (&adapter->pdev->dev, read_cmd.size, - &read_cmd.dma,GFP_ATOMIC ); + read_cmd.va =dma_alloc_coherent (&adapter->pdev->dev, read_cmd.size, + &read_cmd.dma,GFP_ATOMIC );if (!read_cmd.va) { dev_err(&adapter->pdev->dev,
@@ -815,7 +815,7 @@ static int be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) } cmd.size =sizeof (struct be_cmd_req_acpi_wol_magic_config ); - cmd.va =dma_zalloc_coherent (dev, cmd.size, &cmd.dma,GFP_KERNEL ); + cmd.va =dma_alloc_coherent (dev, cmd.size, &cmd.dma,GFP_KERNEL );if (!cmd.va)return -ENOMEM ;
@@ -851,9 +851,9 @@ static int be_test_ddr_dma(struct be_adapter *adapter) }; ddrdma_cmd.size =sizeof (struct be_cmd_req_ddrdma_test ); - ddrdma_cmd.va =dma_zalloc_coherent (&adapter->pdev->dev, - ddrdma_cmd.size, &ddrdma_cmd.dma, -GFP_KERNEL ); + ddrdma_cmd.va =dma_alloc_coherent (&adapter->pdev->dev, + ddrdma_cmd.size, &ddrdma_cmd.dma, +GFP_KERNEL );if (!ddrdma_cmd.va)return -ENOMEM ;
@@ -1014,9 +1014,9 @@ static int be_read_eeprom(struct net_device *netdev,memset (&eeprom_cmd,0 ,sizeof (struct be_dma_mem )); eeprom_cmd.size =sizeof (struct be_cmd_req_seeprom_read ); - eeprom_cmd.va =dma_zalloc_coherent (&adapter->pdev->dev, - eeprom_cmd.size, &eeprom_cmd.dma, -GFP_KERNEL ); + eeprom_cmd.va =dma_alloc_coherent (&adapter->pdev->dev, + eeprom_cmd.size, &eeprom_cmd.dma, +GFP_KERNEL );if (!eeprom_cmd.va)return -ENOMEM ;
drivers/net/ethernet/emulex/benet/be_main.c +9 -9
@@ -167,8 +167,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_zalloc_coherent (&adapter->pdev->dev, mem->size, &mem->dma, -GFP_KERNEL ); + mem->va =dma_alloc_coherent (&adapter->pdev->dev, mem->size, + &mem->dma,GFP_KERNEL );if (!mem->va)return -ENOMEM ;return 0 ;
@@ -5766,9 +5766,9 @@ static int be_drv_init(struct be_adapter *adapter)int status =0 ; mbox_mem_alloc->size =sizeof (struct be_mcc_mailbox ) +16 ; - mbox_mem_alloc->va =dma_zalloc_coherent (dev, mbox_mem_alloc->size, - &mbox_mem_alloc->dma, -GFP_KERNEL ); + mbox_mem_alloc->va =dma_alloc_coherent (dev, mbox_mem_alloc->size, + &mbox_mem_alloc->dma, +GFP_KERNEL );if (!mbox_mem_alloc->va)return -ENOMEM ;
@@ -5777,8 +5777,8 @@ static int be_drv_init(struct be_adapter *adapter) mbox_mem_align->dma =PTR_ALIGN (mbox_mem_alloc->dma,16 ); rx_filter->size =sizeof (struct be_cmd_req_rx_filter ); - rx_filter->va =dma_zalloc_coherent (dev, rx_filter->size, - &rx_filter->dma,GFP_KERNEL ); + rx_filter->va =dma_alloc_coherent (dev, rx_filter->size, + &rx_filter->dma,GFP_KERNEL );if (!rx_filter->va) { status = -ENOMEM ; goto free_mbox;
@@ -5792,8 +5792,8 @@ static int be_drv_init(struct be_adapter *adapter) stats_cmd->size =sizeof (struct be_cmd_req_get_stats_v1 ); else stats_cmd->size = sizeof(struct be_cmd_req_get_stats_v2); - stats_cmd->va =dma_zalloc_coherent (dev, stats_cmd->size, - &stats_cmd->dma,GFP_KERNEL ); + stats_cmd->va =dma_alloc_coherent (dev, stats_cmd->size, + &stats_cmd->dma,GFP_KERNEL );if (!stats_cmd->va) { status = -ENOMEM ; goto free_rx_filter;
drivers/net/ethernet/faraday/ftgmac100.c +6 -8
@@ -935,16 +935,14 @@ static int ftgmac100_alloc_rings(struct ftgmac100 *priv)return -ENOMEM ;/* Allocate descriptors */ - priv->rxdes =dma_zalloc_coherent (priv->dev, -MAX_RX_QUEUE_ENTRIES * -sizeof (struct ftgmac100_rxdes ), - &priv->rxdes_dma,GFP_KERNEL ); + priv->rxdes =dma_alloc_coherent (priv->dev, +MAX_RX_QUEUE_ENTRIES *sizeof (struct ftgmac100_rxdes ), + &priv->rxdes_dma,GFP_KERNEL );if (!priv->rxdes)return -ENOMEM ; - priv->txdes =dma_zalloc_coherent (priv->dev, -MAX_TX_QUEUE_ENTRIES * -sizeof (struct ftgmac100_txdes ), - &priv->txdes_dma,GFP_KERNEL ); + priv->txdes =dma_alloc_coherent (priv->dev, +MAX_TX_QUEUE_ENTRIES *sizeof (struct ftgmac100_txdes ), + &priv->txdes_dma,GFP_KERNEL );if (!priv->txdes)return -ENOMEM ;
drivers/net/ethernet/faraday/ftmac100.c +3 -4
@@ -734,10 +734,9 @@ static int ftmac100_alloc_buffers(struct ftmac100 *priv) {int i; - priv->descs =dma_zalloc_coherent (priv->dev, -sizeof (struct ftmac100_descs ), - &priv->descs_dma_addr, -GFP_KERNEL ); + priv->descs =dma_alloc_coherent (priv->dev, +sizeof (struct ftmac100_descs ), + &priv->descs_dma_addr,GFP_KERNEL );if (!priv->descs)return -ENOMEM ;
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c +2 -2
@@ -1006,8 +1006,8 @@ static int hix5hd2_init_hw_desc_queue(struct hix5hd2_priv *priv)for (i =0 ; i <QUEUE_NUMS ; i++) { size = priv->pool[i].count *sizeof (struct hix5hd2_desc ); - virt_addr =dma_zalloc_coherent (dev, size, &phys_addr, -GFP_KERNEL ); + virt_addr =dma_alloc_coherent (dev, size, &phys_addr, +GFP_KERNEL );if (virt_addr ==NULL ) goto error_free_pool;
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +2 -3
@@ -2041,9 +2041,8 @@ static int hns3_alloc_desc(struct hns3_enet_ring *ring) {int size = ring->desc_num *sizeof (ring->desc[0 ]); - ring->desc =dma_zalloc_coherent (ring_to_dev (ring), size, - &ring->desc_dma_addr, -GFP_KERNEL ); + ring->desc =dma_alloc_coherent (ring_to_dev (ring), size, + &ring->desc_dma_addr,GFP_KERNEL );if (!ring->desc)return -ENOMEM ;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +2 -3
@@ -39,9 +39,8 @@ static int hclge_alloc_cmd_desc(struct hclge_cmq_ring *ring) {int size = ring->desc_num *sizeof (struct hclge_desc ); - ring->desc =dma_zalloc_coherent (cmq_ring_to_dev (ring), - size, &ring->desc_dma_addr, -GFP_KERNEL ); + ring->desc =dma_alloc_coherent (cmq_ring_to_dev (ring), size, + &ring->desc_dma_addr,GFP_KERNEL );if (!ring->desc)return -ENOMEM ;
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c +2 -3
@@ -115,9 +115,8 @@ static int hclgevf_alloc_cmd_desc(struct hclgevf_cmq_ring *ring) {int size = ring->desc_num *sizeof (struct hclgevf_desc ); - ring->desc =dma_zalloc_coherent (cmq_ring_to_dev (ring), - size, &ring->desc_dma_addr, -GFP_KERNEL ); + ring->desc =dma_alloc_coherent (cmq_ring_to_dev (ring), size, + &ring->desc_dma_addr,GFP_KERNEL );if (!ring->desc)return -ENOMEM ;
drivers/net/ethernet/huawei/hinic/hinic_hw_api_cmd.c +8 -8
@@ -613,8 +613,8 @@ static int alloc_cmd_buf(struct hinic_api_cmd_chain *chain,u8 *cmd_vaddr;int err =0 ; - cmd_vaddr =dma_zalloc_coherent (&pdev->dev,API_CMD_BUF_SIZE , - &cmd_paddr,GFP_KERNEL ); + cmd_vaddr =dma_alloc_coherent (&pdev->dev,API_CMD_BUF_SIZE , + &cmd_paddr,GFP_KERNEL );if (!cmd_vaddr) {dev_err (&pdev->dev,"Failed to allocate API CMD DMA memory\n" );return -ENOMEM ;
@@ -663,8 +663,8 @@ static int api_cmd_create_cell(struct hinic_api_cmd_chain *chain,dma_addr_t node_paddr;int err; - node =dma_zalloc_coherent (&pdev->dev, chain->cell_size, - &node_paddr,GFP_KERNEL ); + node =dma_alloc_coherent (&pdev->dev, chain->cell_size, &node_paddr, +GFP_KERNEL );if (!node) {dev_err (&pdev->dev,"Failed to allocate dma API CMD cell\n" );return -ENOMEM ;
@@ -821,10 +821,10 @@ static int api_chain_init(struct hinic_api_cmd_chain *chain,if (!chain->cell_ctxt)return -ENOMEM ; - chain->wb_status =dma_zalloc_coherent (&pdev->dev, -sizeof (*chain->wb_status), - &chain->wb_status_paddr, -GFP_KERNEL ); + chain->wb_status =dma_alloc_coherent (&pdev->dev, +sizeof (*chain->wb_status), + &chain->wb_status_paddr, +GFP_KERNEL );if (!chain->wb_status) {dev_err (&pdev->dev,"Failed to allocate DMA wb status\n" );return -ENOMEM ;
drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c +4 -4
@@ -593,10 +593,10 @@ static int alloc_eq_pages(struct hinic_eq *eq) }for (pg =0 ; pg < eq->num_pages; pg++) { - eq->virt_addr[pg] =dma_zalloc_coherent (&pdev->dev, - eq->page_size, - &eq->dma_addr[pg], -GFP_KERNEL ); + eq->virt_addr[pg] =dma_alloc_coherent (&pdev->dev, + eq->page_size, + &eq->dma_addr[pg], +GFP_KERNEL );if (!eq->virt_addr[pg]) { err = -ENOMEM ; goto err_dma_alloc;
drivers/net/ethernet/huawei/hinic/hinic_hw_io.c +3 -3
@@ -355,9 +355,9 @@ int hinic_io_create_qps(struct hinic_func_to_io *func_to_io, goto err_sq_db; } - ci_addr_base =dma_zalloc_coherent (&pdev->dev,CI_TABLE_SIZE (num_qps), - &func_to_io->ci_dma_base, -GFP_KERNEL ); + ci_addr_base =dma_alloc_coherent (&pdev->dev,CI_TABLE_SIZE (num_qps), + &func_to_io->ci_dma_base, +GFP_KERNEL );if (!ci_addr_base) {dev_err (&pdev->dev,"Failed to allocate CI area\n" ); err = -ENOMEM ;
drivers/net/ethernet/huawei/hinic/hinic_hw_qp.c +5 -5
@@ -336,9 +336,9 @@ static int alloc_rq_cqe(struct hinic_rq *rq) goto err_cqe_dma_arr_alloc;for (i =0 ; i < wq->q_depth; i++) { - rq->cqe[i] =dma_zalloc_coherent (&pdev->dev, -sizeof (*rq->cqe[i]), - &rq->cqe_dma[i],GFP_KERNEL ); + rq->cqe[i] =dma_alloc_coherent (&pdev->dev, +sizeof (*rq->cqe[i]), + &rq->cqe_dma[i],GFP_KERNEL );if (!rq->cqe[i]) goto err_cqe_alloc; }
@@ -415,8 +415,8 @@ int hinic_init_rq(struct hinic_rq *rq, struct hinic_hwif *hwif,/* HW requirements: Must be at least 32 bit */ pi_size =ALIGN (sizeof (*rq->pi_virt_addr),sizeof (u32)); - rq->pi_virt_addr =dma_zalloc_coherent (&pdev->dev, pi_size, - &rq->pi_dma_addr,GFP_KERNEL ); + rq->pi_virt_addr =dma_alloc_coherent (&pdev->dev, pi_size, + &rq->pi_dma_addr,GFP_KERNEL );if (!rq->pi_virt_addr) {dev_err (&pdev->dev,"Failed to allocate PI address\n" ); err = -ENOMEM ;
drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c +4 -4
@@ -114,8 +114,8 @@ static int queue_alloc_page(struct hinic_hwif *hwif, u64 **vaddr, u64 *paddr,struct pci_dev *pdev = hwif->pdev;dma_addr_t dma_addr; - *vaddr =dma_zalloc_coherent (&pdev->dev, page_sz, &dma_addr, -GFP_KERNEL ); + *vaddr =dma_alloc_coherent (&pdev->dev, page_sz, &dma_addr, +GFP_KERNEL );if (!*vaddr) {dev_err (&pdev->dev,"Failed to allocate dma for wqs page\n" );return -ENOMEM ;
@@ -482,8 +482,8 @@ static int alloc_wq_pages(struct hinic_wq *wq, struct hinic_hwif *hwif,u64 *paddr = &wq->block_vaddr[i];dma_addr_t dma_addr; - *vaddr =dma_zalloc_coherent (&pdev->dev, wq->wq_page_size, - &dma_addr,GFP_KERNEL ); + *vaddr =dma_alloc_coherent (&pdev->dev, wq->wq_page_size, + &dma_addr,GFP_KERNEL );if (!*vaddr) {dev_err (&pdev->dev,"Failed to allocate wq page\n" ); goto err_alloc_wq_pages;
drivers/net/ethernet/ibm/emac/mal.c +2 -2
@@ -636,8 +636,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_zalloc_coherent (&ofdev->dev, bd_size, &mal->bd_dma, -GFP_KERNEL ); + mal->bd_virt =dma_alloc_coherent (&ofdev->dev, bd_size, &mal->bd_dma, +GFP_KERNEL );if (mal->bd_virt ==NULL ) { err = -ENOMEM ; goto fail_unmap;
drivers/net/ethernet/intel/e1000/e1000_ethtool.c +4 -4
@@ -993,8 +993,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_zalloc_coherent (&pdev->dev, txdr->size, &txdr->dma, -GFP_KERNEL ); + txdr->desc =dma_alloc_coherent (&pdev->dev, txdr->size, &txdr->dma, +GFP_KERNEL );if (!txdr->desc) { ret_val =2 ; goto err_nomem;
@@ -1051,8 +1051,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) } rxdr->size = rxdr->count *sizeof (struct e1000_rx_desc ); - rxdr->desc =dma_zalloc_coherent (&pdev->dev, rxdr->size, &rxdr->dma, -GFP_KERNEL ); + rxdr->desc =dma_alloc_coherent (&pdev->dev, rxdr->size, &rxdr->dma, +GFP_KERNEL );if (!rxdr->desc) { ret_val =6 ; goto err_nomem;
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
@@ -2305,8 +2305,8 @@ static int e1000_alloc_ring_dma(struct e1000_adapter *adapter, {struct pci_dev *pdev = adapter->pdev; - ring->desc =dma_zalloc_coherent (&pdev->dev, ring->size, &ring->dma, -GFP_KERNEL ); + ring->desc =dma_alloc_coherent (&pdev->dev, ring->size, &ring->dma, +GFP_KERNEL );if (!ring->desc)return -ENOMEM ;
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -2
@@ -109,8 +109,8 @@ int i40e_allocate_dma_mem_d(struct i40e_hw *hw, struct i40e_dma_mem *mem,struct i40e_pf *pf = (struct i40e_pf *)hw->back; mem->size =ALIGN (size, alignment); - mem->va =dma_zalloc_coherent (&pf->pdev->dev, mem->size, - &mem->pa,GFP_KERNEL ); + mem->va =dma_alloc_coherent (&pf->pdev->dev, mem->size, &mem->pa, +GFP_KERNEL );if (!mem->va)return -ENOMEM ;
drivers/net/ethernet/intel/ixgb/ixgb_main.c +4 -4
@@ -680,8 +680,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_zalloc_coherent (&pdev->dev, txdr->size, &txdr->dma, -GFP_KERNEL ); + txdr->desc =dma_alloc_coherent (&pdev->dev, txdr->size, &txdr->dma, +GFP_KERNEL );if (!txdr->desc) {vfree (txdr->buffer_info);return -ENOMEM ;
@@ -763,8 +763,8 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter) rxdr->size = rxdr->count *sizeof (struct ixgb_rx_desc ); rxdr->size =ALIGN (rxdr->size,4096 ); - rxdr->desc =dma_zalloc_coherent (&pdev->dev, rxdr->size, &rxdr->dma, -GFP_KERNEL ); + rxdr->desc =dma_alloc_coherent (&pdev->dev, rxdr->size, &rxdr->dma, +GFP_KERNEL );if (!rxdr->desc) {vfree (rxdr->buffer_info);
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +3 -3
@@ -2044,9 +2044,9 @@ static int mvpp2_aggr_txq_init(struct platform_device *pdev,u32 txq_dma;/* Allocate memory for TX descriptors */ - aggr_txq->descs =dma_zalloc_coherent (&pdev->dev, -MVPP2_AGGR_TXQ_SIZE *MVPP2_DESC_ALIGNED_SIZE , - &aggr_txq->descs_dma,GFP_KERNEL ); + aggr_txq->descs =dma_alloc_coherent (&pdev->dev, +MVPP2_AGGR_TXQ_SIZE *MVPP2_DESC_ALIGNED_SIZE , + &aggr_txq->descs_dma,GFP_KERNEL );if (!aggr_txq->descs)return -ENOMEM ;
drivers/net/ethernet/marvell/pxa168_eth.c +9 -9
@@ -557,9 +557,9 @@ static int init_hash_table(struct pxa168_eth_private *pep)* table is full. */ if (!pep->htpr) { - pep->htpr =dma_zalloc_coherent (pep->dev->dev.parent, -HASH_ADDR_TABLE_SIZE , - &pep->htpr_dma,GFP_KERNEL ); + pep->htpr =dma_alloc_coherent (pep->dev->dev.parent, +HASH_ADDR_TABLE_SIZE , + &pep->htpr_dma,GFP_KERNEL );if (!pep->htpr)return -ENOMEM ; }else {
@@ -1044,9 +1044,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_zalloc_coherent (pep->dev->dev.parent, size, - &pep->rx_desc_dma, -GFP_KERNEL ); + pep->p_rx_desc_area =dma_alloc_coherent (pep->dev->dev.parent, size, + &pep->rx_desc_dma, +GFP_KERNEL );if (!pep->p_rx_desc_area) goto out;
@@ -1103,9 +1103,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_zalloc_coherent (pep->dev->dev.parent, size, - &pep->tx_desc_dma, -GFP_KERNEL ); + pep->p_tx_desc_area =dma_alloc_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 */
drivers/net/ethernet/mediatek/mtk_eth_soc.c +9 -9
@@ -598,10 +598,10 @@ static int mtk_init_fq_dma(struct mtk_eth *eth)dma_addr_t dma_addr;int i; - eth->scratch_ring =dma_zalloc_coherent (eth->dev, - cnt *sizeof (struct mtk_tx_dma ), - ð->phy_scratch_ring, -GFP_ATOMIC ); + eth->scratch_ring =dma_alloc_coherent (eth->dev, + cnt *sizeof (struct mtk_tx_dma ), + ð->phy_scratch_ring, +GFP_ATOMIC );if (unlikely (!eth->scratch_ring))return -ENOMEM ;
@@ -1213,8 +1213,8 @@ static int mtk_tx_alloc(struct mtk_eth *eth)if (!ring->buf) goto no_tx_mem; - ring->dma =dma_zalloc_coherent (eth->dev,MTK_DMA_SIZE * sz, - &ring->phys,GFP_ATOMIC ); + ring->dma =dma_alloc_coherent (eth->dev,MTK_DMA_SIZE * sz, + &ring->phys,GFP_ATOMIC );if (!ring->dma) goto no_tx_mem;
@@ -1310,9 +1310,9 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)return -ENOMEM ; } - ring->dma =dma_zalloc_coherent (eth->dev, - rx_dma_size *sizeof (*ring->dma), - &ring->phys,GFP_ATOMIC ); + ring->dma =dma_alloc_coherent (eth->dev, + rx_dma_size *sizeof (*ring->dma), + &ring->phys,GFP_ATOMIC );if (!ring->dma)return -ENOMEM ;
drivers/net/ethernet/mellanox/mlx4/alloc.c +4 -4
@@ -584,8 +584,8 @@ static int mlx4_buf_direct_alloc(struct mlx4_dev *dev, int size, buf->npages =1 ; buf->page_shift =get_order (size) +PAGE_SHIFT ; buf->direct.buf = -dma_zalloc_coherent (&dev->persist->pdev->dev, - size, &t,GFP_KERNEL ); +dma_alloc_coherent (&dev->persist->pdev->dev, size, &t, +GFP_KERNEL );if (!buf->direct.buf)return -ENOMEM ;
@@ -624,8 +624,8 @@ int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,for (i =0 ; i < buf->nbufs; ++i) { buf->page_list[i].buf = -dma_zalloc_coherent (&dev->persist->pdev->dev, -PAGE_SIZE , &t,GFP_KERNEL ); +dma_alloc_coherent (&dev->persist->pdev->dev, +PAGE_SIZE , &t,GFP_KERNEL );if (!buf->page_list[i].buf) goto err_free;
drivers/net/ethernet/mellanox/mlx5/core/alloc.c +2 -2
@@ -63,8 +63,8 @@ static void *mlx5_dma_zalloc_coherent_node(struct mlx5_core_dev *dev,mutex_lock (&priv->alloc_mutex); original_node =dev_to_node (&dev->pdev->dev);set_dev_node (&dev->pdev->dev, node); - cpu_handle =dma_zalloc_coherent (&dev->pdev->dev, size, - dma_handle,GFP_KERNEL ); + cpu_handle =dma_alloc_coherent (&dev->pdev->dev, size, dma_handle, +GFP_KERNEL );set_dev_node (&dev->pdev->dev, original_node);mutex_unlock (&priv->alloc_mutex);return cpu_handle;
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +5 -5
@@ -1789,8 +1789,8 @@ static int alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) {struct device *ddev = &dev->pdev->dev; - cmd->cmd_alloc_buf =dma_zalloc_coherent (ddev,MLX5_ADAPTER_PAGE_SIZE , - &cmd->alloc_dma,GFP_KERNEL ); + cmd->cmd_alloc_buf =dma_alloc_coherent (ddev,MLX5_ADAPTER_PAGE_SIZE , + &cmd->alloc_dma,GFP_KERNEL );if (!cmd->cmd_alloc_buf)return -ENOMEM ;
@@ -1804,9 +1804,9 @@ static int alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd)dma_free_coherent (ddev,MLX5_ADAPTER_PAGE_SIZE , cmd->cmd_alloc_buf, cmd->alloc_dma); - cmd->cmd_alloc_buf =dma_zalloc_coherent (ddev, -2 *MLX5_ADAPTER_PAGE_SIZE -1 , - &cmd->alloc_dma,GFP_KERNEL ); + cmd->cmd_alloc_buf =dma_alloc_coherent (ddev, +2 *MLX5_ADAPTER_PAGE_SIZE -1 , + &cmd->alloc_dma,GFP_KERNEL );if (!cmd->cmd_alloc_buf)return -ENOMEM ;
drivers/net/ethernet/myricom/myri10ge/myri10ge.c +3 -3
@@ -3604,9 +3604,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_zalloc_coherent (&pdev->dev, bytes, - &ss->rx_done.bus, -GFP_KERNEL ); + ss->rx_done.entry =dma_alloc_coherent (&pdev->dev, bytes, + &ss->rx_done.bus, +GFP_KERNEL );if (ss->rx_done.entry ==NULL ) goto abort; bytes =sizeof (*ss->fw_stats);
drivers/net/ethernet/netronome/nfp/nfp_net_common.c +6 -6
@@ -2170,9 +2170,9 @@ nfp_net_tx_ring_alloc(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring) tx_ring->cnt = dp->txd_cnt; tx_ring->size =array_size (tx_ring->cnt,sizeof (*tx_ring->txds)); - tx_ring->txds =dma_zalloc_coherent (dp->dev, tx_ring->size, - &tx_ring->dma, -GFP_KERNEL | __GFP_NOWARN); + tx_ring->txds =dma_alloc_coherent (dp->dev, tx_ring->size, + &tx_ring->dma, +GFP_KERNEL | __GFP_NOWARN);if (!tx_ring->txds) {netdev_warn (dp->netdev,"failed to allocate TX descriptor ring memory, requested descriptor count: %d, consider lowering descriptor count\n" , tx_ring->cnt);
@@ -2328,9 +2328,9 @@ nfp_net_rx_ring_alloc(struct nfp_net_dp *dp, struct nfp_net_rx_ring *rx_ring) rx_ring->cnt = dp->rxd_cnt; rx_ring->size =array_size (rx_ring->cnt,sizeof (*rx_ring->rxds)); - rx_ring->rxds =dma_zalloc_coherent (dp->dev, rx_ring->size, - &rx_ring->dma, -GFP_KERNEL | __GFP_NOWARN); + rx_ring->rxds =dma_alloc_coherent (dp->dev, rx_ring->size, + &rx_ring->dma, +GFP_KERNEL | __GFP_NOWARN);if (!rx_ring->rxds) {netdev_warn (dp->netdev,"failed to allocate RX descriptor ring memory, requested descriptor count: %d, consider lowering descriptor count\n" , rx_ring->cnt);
drivers/net/ethernet/ni/nixge.c +6 -6
@@ -287,9 +287,9 @@ static int nixge_hw_dma_bd_init(struct net_device *ndev) priv->rx_bd_ci =0 ;/* Allocate the Tx and Rx buffer descriptors. */ - priv->tx_bd_v =dma_zalloc_coherent (ndev->dev.parent, -sizeof (*priv->tx_bd_v) *TX_BD_NUM , - &priv->tx_bd_p,GFP_KERNEL ); + priv->tx_bd_v =dma_alloc_coherent (ndev->dev.parent, +sizeof (*priv->tx_bd_v) *TX_BD_NUM , + &priv->tx_bd_p,GFP_KERNEL );if (!priv->tx_bd_v) goto out;
@@ -299,9 +299,9 @@ static int nixge_hw_dma_bd_init(struct net_device *ndev)if (!priv->tx_skb) goto out; - priv->rx_bd_v =dma_zalloc_coherent (ndev->dev.parent, -sizeof (*priv->rx_bd_v) *RX_BD_NUM , - &priv->rx_bd_p,GFP_KERNEL ); + priv->rx_bd_v =dma_alloc_coherent (ndev->dev.parent, +sizeof (*priv->rx_bd_v) *RX_BD_NUM , + &priv->rx_bd_p,GFP_KERNEL );if (!priv->rx_bd_v) goto out;
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +6 -6
@@ -1440,8 +1440,8 @@ pch_gbe_alloc_rx_buffers_pool(struct pch_gbe_adapter *adapter, size = rx_ring->count * bufsz +PCH_GBE_RESERVE_MEMORY ; rx_ring->rx_buff_pool = -dma_zalloc_coherent (&pdev->dev, size, - &rx_ring->rx_buff_pool_logic,GFP_KERNEL ); +dma_alloc_coherent (&pdev->dev, size, + &rx_ring->rx_buff_pool_logic,GFP_KERNEL );if (!rx_ring->rx_buff_pool)return -ENOMEM ;
@@ -1755,8 +1755,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_zalloc_coherent (&pdev->dev, tx_ring->size, - &tx_ring->dma,GFP_KERNEL ); + tx_ring->desc =dma_alloc_coherent (&pdev->dev, tx_ring->size, + &tx_ring->dma,GFP_KERNEL );if (!tx_ring->desc) {vfree (tx_ring->buffer_info);return -ENOMEM ;
@@ -1798,8 +1798,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_zalloc_coherent (&pdev->dev, rx_ring->size, - &rx_ring->dma,GFP_KERNEL ); + rx_ring->desc =dma_alloc_coherent (&pdev->dev, rx_ring->size, + &rx_ring->dma,GFP_KERNEL );if (!rx_ring->desc) {vfree (rx_ring->buffer_info);return -ENOMEM ;
drivers/net/ethernet/pasemi/pasemi_mac.c +3 -3
@@ -401,9 +401,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_zalloc_coherent (&mac->dma_pdev->dev, -RX_RING_SIZE *sizeof (u64), - &ring->buf_dma,GFP_KERNEL ); + ring->buffers =dma_alloc_coherent (&mac->dma_pdev->dev, +RX_RING_SIZE *sizeof (u64), + &ring->buf_dma,GFP_KERNEL );if (!ring->buffers) goto out_ring_desc;
drivers/net/ethernet/qlogic/qed/qed_cxt.c +8 -8
@@ -936,9 +936,9 @@ static int qed_cxt_src_t2_alloc(struct qed_hwfn *p_hwfn)u32 size =min_t (u32, total_size, psz);void **p_virt = &p_mngr->t2[i].p_virt; - *p_virt =dma_zalloc_coherent (&p_hwfn->cdev->pdev->dev, - size, &p_mngr->t2[i].p_phys, -GFP_KERNEL ); + *p_virt =dma_alloc_coherent (&p_hwfn->cdev->pdev->dev, size, + &p_mngr->t2[i].p_phys, +GFP_KERNEL );if (!p_mngr->t2[i].p_virt) { rc = -ENOMEM ; goto t2_fail;
@@ -1054,8 +1054,8 @@ static int qed_ilt_blk_alloc(struct qed_hwfn *p_hwfn,u32 size; size =min_t (u32, sz_left, p_blk->real_size_in_page); - p_virt =dma_zalloc_coherent (&p_hwfn->cdev->pdev->dev, size, - &p_phys,GFP_KERNEL ); + p_virt =dma_alloc_coherent (&p_hwfn->cdev->pdev->dev, size, + &p_phys,GFP_KERNEL );if (!p_virt)return -ENOMEM ;
@@ -2306,9 +2306,9 @@ qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn, goto out0; } - p_virt =dma_zalloc_coherent (&p_hwfn->cdev->pdev->dev, - p_blk->real_size_in_page, &p_phys, -GFP_KERNEL ); + p_virt =dma_alloc_coherent (&p_hwfn->cdev->pdev->dev, + p_blk->real_size_in_page, &p_phys, +GFP_KERNEL );if (!p_virt) { rc = -ENOMEM ; goto out1;
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +14 -14
@@ -434,14 +434,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_zalloc_coherent (&adapter->pdev->dev, rq_size, - &rq_phys_addr,GFP_KERNEL ); + rq_addr =dma_alloc_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_zalloc_coherent (&adapter->pdev->dev, rsp_size, - &rsp_phys_addr,GFP_KERNEL ); + rsp_addr =dma_alloc_coherent (&adapter->pdev->dev, rsp_size, + &rsp_phys_addr,GFP_KERNEL );if (!rsp_addr) { err = -ENOMEM ; goto out_free_rq;
@@ -855,8 +855,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_zalloc_coherent (&adapter->pdev->dev, nic_size, - &nic_dma_t,GFP_KERNEL ); + nic_info_addr =dma_alloc_coherent (&adapter->pdev->dev, nic_size, + &nic_dma_t,GFP_KERNEL );if (!nic_info_addr)return -ENOMEM ;
@@ -909,8 +909,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_zalloc_coherent (&adapter->pdev->dev, nic_size, - &nic_dma_t,GFP_KERNEL ); + nic_info_addr =dma_alloc_coherent (&adapter->pdev->dev, nic_size, + &nic_dma_t,GFP_KERNEL );if (!nic_info_addr)return -ENOMEM ;
@@ -964,8 +964,8 @@ int qlcnic_82xx_get_pci_info(struct qlcnic_adapter *adapter,void *pci_info_addr;int err =0 , i; - pci_info_addr =dma_zalloc_coherent (&adapter->pdev->dev, pci_size, - &pci_info_dma_t,GFP_KERNEL ); + pci_info_addr =dma_alloc_coherent (&adapter->pdev->dev, pci_size, + &pci_info_dma_t,GFP_KERNEL );if (!pci_info_addr)return -ENOMEM ;
@@ -1078,8 +1078,8 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func,return -EIO ; } - stats_addr =dma_zalloc_coherent (&adapter->pdev->dev, stats_size, - &stats_dma_t,GFP_KERNEL ); + stats_addr =dma_alloc_coherent (&adapter->pdev->dev, stats_size, + &stats_dma_t,GFP_KERNEL );if (!stats_addr)return -ENOMEM ;
@@ -1134,8 +1134,8 @@ int qlcnic_get_mac_stats(struct qlcnic_adapter *adapter,if (mac_stats ==NULL )return -ENOMEM ; - stats_addr =dma_zalloc_coherent (&adapter->pdev->dev, stats_size, - &stats_dma_t,GFP_KERNEL ); + stats_addr =dma_alloc_coherent (&adapter->pdev->dev, stats_size, + &stats_dma_t,GFP_KERNEL );if (!stats_addr)return -ENOMEM ;
drivers/net/ethernet/qualcomm/emac/emac-mac.c +1 -1
@@ -776,7 +776,7 @@ int emac_mac_rx_tx_rings_alloc_all(struct emac_adapter *adpt)8 +2 *8 ;/* 8 byte per one Tx and two Rx rings */ ring_header->used =0 ; - ring_header->v_addr =dma_zalloc_coherent (dev, ring_header->size, + ring_header->v_addr =dma_alloc_coherent (dev, ring_header->size, &ring_header->dma_addr,GFP_KERNEL );if (!ring_header->v_addr)
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +6 -6
@@ -400,9 +400,9 @@ static int init_tx_ring(struct device *dev, u8 queue_no, }/* allocate memory for TX descriptors */ - tx_ring->dma_tx =dma_zalloc_coherent (dev, - tx_rsize *sizeof (struct sxgbe_tx_norm_desc ), - &tx_ring->dma_tx_phy,GFP_KERNEL ); + tx_ring->dma_tx =dma_alloc_coherent (dev, + tx_rsize *sizeof (struct sxgbe_tx_norm_desc ), + &tx_ring->dma_tx_phy,GFP_KERNEL );if (!tx_ring->dma_tx)return -ENOMEM ;
@@ -479,9 +479,9 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no, rx_ring->queue_no = queue_no;/* allocate memory for RX descriptors */ - rx_ring->dma_rx =dma_zalloc_coherent (priv->device, - rx_rsize *sizeof (struct sxgbe_rx_norm_desc ), - &rx_ring->dma_rx_phy,GFP_KERNEL ); + rx_ring->dma_rx =dma_alloc_coherent (priv->device, + rx_rsize *sizeof (struct sxgbe_rx_norm_desc ), + &rx_ring->dma_rx_phy,GFP_KERNEL );if (rx_ring->dma_rx ==NULL )return -ENOMEM ;
drivers/net/ethernet/sfc/falcon/nic.c +2 -2
@@ -33,8 +33,8 @@int ef4_nic_alloc_buffer (struct ef4_nic *efx,struct ef4_buffer *buffer,unsigned int len,gfp_t gfp_flags) { - buffer->addr =dma_zalloc_coherent (&efx->pci_dev->dev, len, - &buffer->dma_addr, gfp_flags); + buffer->addr =dma_alloc_coherent (&efx->pci_dev->dev, len, + &buffer->dma_addr, gfp_flags);if (!buffer->addr)return -ENOMEM ; buffer->len = len;
drivers/net/ethernet/sfc/nic.c +2 -2
@@ -34,8 +34,8 @@int efx_nic_alloc_buffer (struct efx_nic *efx,struct efx_buffer *buffer,unsigned int len,gfp_t gfp_flags) { - buffer->addr =dma_zalloc_coherent (&efx->pci_dev->dev, len, - &buffer->dma_addr, gfp_flags); + buffer->addr =dma_alloc_coherent (&efx->pci_dev->dev, len, + &buffer->dma_addr, gfp_flags);if (!buffer->addr)return -ENOMEM ; buffer->len = len;
drivers/net/ethernet/sgi/meth.c +2 -2
@@ -211,8 +211,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_zalloc_coherent (NULL ,TX_RING_BUFFER_SIZE , - &priv->tx_ring_dma,GFP_ATOMIC ); + priv->tx_ring =dma_alloc_coherent (NULL ,TX_RING_BUFFER_SIZE , + &priv->tx_ring_dma,GFP_ATOMIC );if (!priv->tx_ring)return -ENOMEM ;
drivers/net/ethernet/socionext/netsec.c +2 -2
@@ -1029,8 +1029,8 @@ static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id)struct netsec_desc_ring *dring = &priv->desc_ring[id];int i; - dring->vaddr =dma_zalloc_coherent (priv->dev,DESC_SZ *DESC_NUM , - &dring->desc_dma,GFP_KERNEL ); + dring->vaddr =dma_alloc_coherent (priv->dev,DESC_SZ *DESC_NUM , + &dring->desc_dma,GFP_KERNEL );if (!dring->vaddr) goto err;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +16 -24
@@ -1549,22 +1549,18 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv) goto err_dma;if (priv->extend_desc) { - rx_q->dma_erx =dma_zalloc_coherent (priv->device, -DMA_RX_SIZE * -sizeof (struct -dma_extended_desc ), - &rx_q->dma_rx_phy, -GFP_KERNEL ); + rx_q->dma_erx =dma_alloc_coherent (priv->device, +DMA_RX_SIZE *sizeof (struct dma_extended_desc ), + &rx_q->dma_rx_phy, +GFP_KERNEL );if (!rx_q->dma_erx) goto err_dma; }else { - rx_q->dma_rx =dma_zalloc_coherent (priv->device, -DMA_RX_SIZE * -sizeof (struct -dma_desc ), - &rx_q->dma_rx_phy, -GFP_KERNEL ); + rx_q->dma_rx =dma_alloc_coherent (priv->device, +DMA_RX_SIZE *sizeof (struct dma_desc ), + &rx_q->dma_rx_phy, +GFP_KERNEL );if (!rx_q->dma_rx) goto err_dma; }
@@ -1612,21 +1608,17 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv) goto err_dma;if (priv->extend_desc) { - tx_q->dma_etx =dma_zalloc_coherent (priv->device, -DMA_TX_SIZE * -sizeof (struct -dma_extended_desc ), - &tx_q->dma_tx_phy, -GFP_KERNEL ); + tx_q->dma_etx =dma_alloc_coherent (priv->device, +DMA_TX_SIZE *sizeof (struct dma_extended_desc ), + &tx_q->dma_tx_phy, +GFP_KERNEL );if (!tx_q->dma_etx) goto err_dma; }else { - tx_q->dma_tx =dma_zalloc_coherent (priv->device, -DMA_TX_SIZE * -sizeof (struct -dma_desc ), - &tx_q->dma_tx_phy, -GFP_KERNEL ); + tx_q->dma_tx =dma_alloc_coherent (priv->device, +DMA_TX_SIZE *sizeof (struct dma_desc ), + &tx_q->dma_tx_phy, +GFP_KERNEL );if (!tx_q->dma_tx) goto err_dma; }
drivers/net/ethernet/tundra/tsi108_eth.c +4 -4
@@ -1311,13 +1311,13 @@ static int tsi108_open(struct net_device *dev) data->id, dev->irq, dev->name); } - data->rxring =dma_zalloc_coherent (&data->pdev->dev, rxring_size, - &data->rxdma,GFP_KERNEL ); + data->rxring =dma_alloc_coherent (&data->pdev->dev, rxring_size, + &data->rxdma,GFP_KERNEL );if (!data->rxring)return -ENOMEM ; - data->txring =dma_zalloc_coherent (&data->pdev->dev, txring_size, - &data->txdma,GFP_KERNEL ); + data->txring =dma_alloc_coherent (&data->pdev->dev, txring_size, + &data->txdma,GFP_KERNEL );if (!data->txring) {dma_free_coherent (&data->pdev->dev, rxring_size, data->rxring, data->rxdma);
drivers/net/ethernet/xilinx/ll_temac_main.c +6 -6
@@ -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_zalloc_coherent (ndev->dev.parent, -sizeof (*lp->tx_bd_v) *TX_BD_NUM , - &lp->tx_bd_p,GFP_KERNEL ); + lp->tx_bd_v =dma_alloc_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_zalloc_coherent (ndev->dev.parent, -sizeof (*lp->rx_bd_v) *RX_BD_NUM , - &lp->rx_bd_p,GFP_KERNEL ); + lp->rx_bd_v =dma_alloc_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;
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +6 -6
@@ -199,15 +199,15 @@ static int axienet_dma_bd_init(struct net_device *ndev) lp->rx_bd_ci =0 ;/* Allocate the Tx and Rx buffer descriptors. */ - lp->tx_bd_v =dma_zalloc_coherent (ndev->dev.parent, -sizeof (*lp->tx_bd_v) *TX_BD_NUM , - &lp->tx_bd_p,GFP_KERNEL ); + lp->tx_bd_v =dma_alloc_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_zalloc_coherent (ndev->dev.parent, -sizeof (*lp->rx_bd_v) *RX_BD_NUM , - &lp->rx_bd_p,GFP_KERNEL ); + lp->rx_bd_v =dma_alloc_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;
drivers/net/fddi/defxx.c +3 -3
@@ -1139,9 +1139,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_zalloc_coherent (bp->bus_dev, alloc_size, - &bp->kmalloced_dma, -GFP_ATOMIC ); + bp->kmalloced = top_v =dma_alloc_coherent (bp->bus_dev, alloc_size, + &bp->kmalloced_dma, +GFP_ATOMIC );if (top_v ==NULL )return DFX_K_FAILURE ;
drivers/net/fddi/skfp/skfddi.c +4 -4
@@ -409,10 +409,10 @@ static int skfp_driver_init(struct net_device *dev)if (bp->SharedMemSize >0 ) { bp->SharedMemSize +=16 ;// for descriptor alignment - bp->SharedMemAddr =dma_zalloc_coherent (&bp->pdev.dev, - bp->SharedMemSize, - &bp->SharedMemDMA, -GFP_ATOMIC ); + bp->SharedMemAddr =dma_alloc_coherent (&bp->pdev.dev, + bp->SharedMemSize, + &bp->SharedMemDMA, +GFP_ATOMIC );if (!bp->SharedMemAddr) {printk ("could not allocate mem for " ); printk("hardware module: %ld byte\n",
drivers/net/vmxnet3/vmxnet3_drv.c +4 -4
@@ -535,8 +535,8 @@ vmxnet3_tq_create(struct vmxnet3_tx_queue *tq, } sz = tq->tx_ring.size *sizeof (tq->buf_info[0 ]); - tq->buf_info =dma_zalloc_coherent (&adapter->pdev->dev, sz, - &tq->buf_info_pa,GFP_KERNEL ); + tq->buf_info =dma_alloc_coherent (&adapter->pdev->dev, sz, + &tq->buf_info_pa,GFP_KERNEL );if (!tq->buf_info) goto err;
@@ -1815,8 +1815,8 @@ vmxnet3_rq_create(struct vmxnet3_rx_queue *rq, struct vmxnet3_adapter *adapter) sz =sizeof (struct vmxnet3_rx_buf_info ) * (rq->rx_ring[0 ].size + rq->rx_ring[1 ].size); - bi =dma_zalloc_coherent (&adapter->pdev->dev, sz, &rq->buf_info_pa, -GFP_KERNEL ); + bi =dma_alloc_coherent (&adapter->pdev->dev, sz, &rq->buf_info_pa, +GFP_KERNEL );if (!bi) goto err;
drivers/net/wan/fsl_ucc_hdlc.c +3 -4
@@ -279,10 +279,9 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)iowrite16be (DEFAULT_HDLC_ADDR , &priv->ucc_pram->haddr4);/* Get BD buffer */ - bd_buffer =dma_zalloc_coherent (priv->dev, - (RX_BD_RING_LEN +TX_BD_RING_LEN ) * -MAX_RX_BUF_LENGTH , - &bd_dma_addr,GFP_KERNEL ); + bd_buffer =dma_alloc_coherent (priv->dev, + (RX_BD_RING_LEN +TX_BD_RING_LEN ) *MAX_RX_BUF_LENGTH , + &bd_dma_addr,GFP_KERNEL );if (!bd_buffer) {dev_err (priv->dev,"Could not allocate buffer descriptors\n" );
drivers/net/wireless/ath/ath10k/ce.c +3 -4
@@ -1553,10 +1553,9 @@ ath10k_ce_alloc_dest_ring(struct ath10k *ar, unsigned int ce_id,* coherent DMA are unsupported */ dest_ring->base_addr_owner_space_unaligned = -dma_zalloc_coherent (ar->dev, - (nentries *sizeof (struct ce_desc ) + -CE_DESC_RING_ALIGN ), - &base_addr,GFP_KERNEL ); +dma_alloc_coherent (ar->dev, + (nentries *sizeof (struct ce_desc ) +CE_DESC_RING_ALIGN ), + &base_addr,GFP_KERNEL );if (!dest_ring->base_addr_owner_space_unaligned) {kfree (dest_ring);return ERR_PTR (-ENOMEM );
drivers/net/wireless/ath/ath10k/mac.c +4 -4
@@ -5169,10 +5169,10 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,if (vif->type ==NL80211_IFTYPE_ADHOC || vif->type ==NL80211_IFTYPE_MESH_POINT || vif->type ==NL80211_IFTYPE_AP ) { - arvif->beacon_buf =dma_zalloc_coherent (ar->dev, -IEEE80211_MAX_FRAME_LEN , - &arvif->beacon_paddr, -GFP_ATOMIC ); + arvif->beacon_buf =dma_alloc_coherent (ar->dev, +IEEE80211_MAX_FRAME_LEN , + &arvif->beacon_paddr, +GFP_ATOMIC );if (!arvif->beacon_buf) { ret = -ENOMEM ; ath10k_warn(ar, "failed to allocate beacon buffer: %d\n",
drivers/net/wireless/ath/ath10k/pci.c +1 -2
@@ -936,8 +936,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,*/ alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT); - data_buf = (unsigned char *)dma_zalloc_coherent (ar->dev, - alloc_nbytes, + data_buf = (unsigned char *)dma_alloc_coherent (ar->dev, alloc_nbytes, &ce_data_base,GFP_ATOMIC );
drivers/net/wireless/ath/ath10k/wmi.c +1 -1
@@ -5193,7 +5193,7 @@ static int ath10k_wmi_alloc_chunk(struct ath10k *ar, u32 req_id,void *vaddr; pool_size = num_units *round_up (unit_len,4 ); - vaddr =dma_zalloc_coherent (ar->dev, pool_size, &paddr,GFP_KERNEL ); + vaddr =dma_alloc_coherent (ar->dev, pool_size, &paddr,GFP_KERNEL );if (!vaddr)return -ENOMEM ;
drivers/net/wireless/ath/wcn36xx/dxe.c +8 -9
@@ -174,9 +174,8 @@ static int wcn36xx_dxe_init_descs(struct device *dev, struct wcn36xx_dxe_ch *wcnint i; size = wcn_ch->desc_num *sizeof (struct wcn36xx_dxe_desc ); - wcn_ch->cpu_addr =dma_zalloc_coherent (dev, size, - &wcn_ch->dma_addr, -GFP_KERNEL ); + wcn_ch->cpu_addr =dma_alloc_coherent (dev, size, &wcn_ch->dma_addr, +GFP_KERNEL );if (!wcn_ch->cpu_addr)return -ENOMEM ;
@@ -627,9 +626,9 @@ int wcn36xx_dxe_allocate_mem_pools(struct wcn36xx *wcn)16 - (WCN36XX_BD_CHUNK_SIZE %8 ); s = wcn->mgmt_mem_pool.chunk_size *WCN36XX_DXE_CH_DESC_NUMB_TX_H ; - cpu_addr =dma_zalloc_coherent (wcn->dev, s, - &wcn->mgmt_mem_pool.phy_addr, -GFP_KERNEL ); + cpu_addr =dma_alloc_coherent (wcn->dev, s, + &wcn->mgmt_mem_pool.phy_addr, +GFP_KERNEL );if (!cpu_addr) goto out_err;
@@ -642,9 +641,9 @@ int wcn36xx_dxe_allocate_mem_pools(struct wcn36xx *wcn)16 - (WCN36XX_BD_CHUNK_SIZE %8 ); s = wcn->data_mem_pool.chunk_size *WCN36XX_DXE_CH_DESC_NUMB_TX_L ; - cpu_addr =dma_zalloc_coherent (wcn->dev, s, - &wcn->data_mem_pool.phy_addr, -GFP_KERNEL ); + cpu_addr =dma_alloc_coherent (wcn->dev, s, + &wcn->data_mem_pool.phy_addr, +GFP_KERNEL );if (!cpu_addr) goto out_err;
drivers/net/wireless/ath/wil6210/txrx_edma.c +4 -4
@@ -99,7 +99,7 @@ static int wil_sring_alloc(struct wil6210_priv *wil,/* Status messages are allocated and initialized to 0. This is necessary * since DR bit should be initialized to 0. */ - sring->va =dma_zalloc_coherent (dev, sz, &sring->pa,GFP_KERNEL ); + sring->va =dma_alloc_coherent (dev, sz, &sring->pa,GFP_KERNEL );if (!sring->va)return -ENOMEM ;
@@ -381,15 +381,15 @@ static int wil_ring_alloc_desc_ring(struct wil6210_priv *wil,if (!ring->ctx) goto err; - ring->va =dma_zalloc_coherent (dev, sz, &ring->pa,GFP_KERNEL ); + ring->va =dma_alloc_coherent (dev, sz, &ring->pa,GFP_KERNEL );if (!ring->va) goto err_free_ctx;if (ring->is_rx) { sz =sizeof (*ring->edma_rx_swtail.va); ring->edma_rx_swtail.va = -dma_zalloc_coherent (dev, sz, &ring->edma_rx_swtail.pa, -GFP_KERNEL ); +dma_alloc_coherent (dev, sz, &ring->edma_rx_swtail.pa, +GFP_KERNEL );if (!ring->edma_rx_swtail.va) goto err_free_va; }
drivers/net/wireless/broadcom/b43/dma.c +3 -3
@@ -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_zalloc_coherent (ring->dev->dev->dma_dev, - ring_mem_size, &(ring->dmabase), -GFP_KERNEL ); + ring->descbase =dma_alloc_coherent (ring->dev->dev->dma_dev, + ring_mem_size, &(ring->dmabase), +GFP_KERNEL );if (!ring->descbase)return -ENOMEM ;
drivers/net/wireless/broadcom/b43legacy/dma.c +3 -3
@@ -331,9 +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_zalloc_coherent (ring->dev->dev->dma_dev, - B43legacy_DMA_RINGMEMSIZE, - &(ring->dmabase),GFP_KERNEL ); + ring->descbase =dma_alloc_coherent (ring->dev->dev->dma_dev, + B43legacy_DMA_RINGMEMSIZE, + &(ring->dmabase),GFP_KERNEL );if (!ring->descbase)return -ENOMEM ;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +8 -8
@@ -1281,10 +1281,10 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)u32 addr; devinfo->shared.scratch = -dma_zalloc_coherent (&devinfo->pdev->dev, -BRCMF_DMA_D2H_SCRATCH_BUF_LEN , - &devinfo->shared.scratch_dmahandle, -GFP_KERNEL ); +dma_alloc_coherent (&devinfo->pdev->dev, +BRCMF_DMA_D2H_SCRATCH_BUF_LEN , + &devinfo->shared.scratch_dmahandle, +GFP_KERNEL );if (!devinfo->shared.scratch) goto fail;
@@ -1298,10 +1298,10 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)brcmf_pcie_write_tcm32 (devinfo, addr,BRCMF_DMA_D2H_SCRATCH_BUF_LEN ); devinfo->shared.ringupd = -dma_zalloc_coherent (&devinfo->pdev->dev, -BRCMF_DMA_D2H_RINGUPD_BUF_LEN , - &devinfo->shared.ringupd_dmahandle, -GFP_KERNEL ); +dma_alloc_coherent (&devinfo->pdev->dev, +BRCMF_DMA_D2H_RINGUPD_BUF_LEN , + &devinfo->shared.ringupd_dmahandle, +GFP_KERNEL );if (!devinfo->shared.ringupd) goto fail;
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +15 -24
@@ -711,30 +711,24 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans,* Allocate the circular buffer of Read Buffer Descriptors * (RBDs) */ - rxq->bd =dma_zalloc_coherent (dev, - free_size * rxq->queue_size, - &rxq->bd_dma,GFP_KERNEL ); + rxq->bd =dma_alloc_coherent (dev, free_size * rxq->queue_size, + &rxq->bd_dma,GFP_KERNEL );if (!rxq->bd) goto err;if (trans->cfg->mq_rx_supported) { - rxq->used_bd =dma_zalloc_coherent (dev, - (use_rx_td ? -sizeof (*rxq->cd) : -sizeof (__le32)) * - rxq->queue_size, - &rxq->used_bd_dma, -GFP_KERNEL ); + rxq->used_bd =dma_alloc_coherent (dev, + (use_rx_td ?sizeof (*rxq->cd) :sizeof (__le32)) * rxq->queue_size, + &rxq->used_bd_dma, +GFP_KERNEL );if (!rxq->used_bd) goto err; }/* Allocate the driver's pointer to receive buffer status */ - rxq->rb_stts =dma_zalloc_coherent (dev, use_rx_td ? -sizeof (__le16) : -sizeof (struct iwl_rb_status ), - &rxq->rb_stts_dma, -GFP_KERNEL ); + rxq->rb_stts =dma_alloc_coherent (dev, + use_rx_td ?sizeof (__le16) :sizeof (struct iwl_rb_status ), + &rxq->rb_stts_dma,GFP_KERNEL );if (!rxq->rb_stts) goto err;
@@ -742,16 +736,14 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans,return 0 ;/* Allocate the driver's pointer to TR tail */ - rxq->tr_tail =dma_zalloc_coherent (dev,sizeof (__le16), - &rxq->tr_tail_dma, -GFP_KERNEL ); + rxq->tr_tail =dma_alloc_coherent (dev,sizeof (__le16), + &rxq->tr_tail_dma,GFP_KERNEL );if (!rxq->tr_tail) goto err;/* Allocate the driver's pointer to CR tail */ - rxq->cr_tail =dma_zalloc_coherent (dev,sizeof (__le16), - &rxq->cr_tail_dma, -GFP_KERNEL ); + rxq->cr_tail =dma_alloc_coherent (dev,sizeof (__le16), + &rxq->cr_tail_dma,GFP_KERNEL );if (!rxq->cr_tail) goto err;/*
@@ -1947,9 +1939,8 @@ int iwl_pcie_alloc_ict(struct iwl_trans *trans)struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans); trans_pcie->ict_tbl = -dma_zalloc_coherent (trans->dev,ICT_SIZE , - &trans_pcie->ict_tbl_dma, -GFP_KERNEL ); +dma_alloc_coherent (trans->dev,ICT_SIZE , + &trans_pcie->ict_tbl_dma,GFP_KERNEL );if (!trans_pcie->ict_tbl)return -ENOMEM ;
drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c +3 -3
@@ -119,9 +119,9 @@ static int rt2x00mmio_alloc_queue_dma(struct rt2x00_dev *rt2x00dev,/* * Allocate DMA memory for descriptor and buffer. */ - addr =dma_zalloc_coherent (rt2x00dev->dev, - queue->limit * queue->desc_size, &dma, -GFP_KERNEL ); + addr =dma_alloc_coherent (rt2x00dev->dev, + queue->limit * queue->desc_size, &dma, +GFP_KERNEL );if (!addr)return -ENOMEM ;
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +4 -4
@@ -1339,10 +1339,10 @@ static int switchtec_ntb_init_shared_mw(struct switchtec_ntb *sndev)int rc; sndev->nr_rsvd_luts++; - sndev->self_shared =dma_zalloc_coherent (&sndev->stdev->pdev->dev, -LUT_SIZE , - &sndev->self_shared_dma, -GFP_KERNEL ); + sndev->self_shared =dma_alloc_coherent (&sndev->stdev->pdev->dev, +LUT_SIZE , + &sndev->self_shared_dma, +GFP_KERNEL );if (!sndev->self_shared) {dev_err (&sndev->stdev->dev,"unable to allocate memory for shared mw\n" );
drivers/nvme/host/pci.c +4 -4
@@ -1485,8 +1485,8 @@ static int nvme_alloc_queue(struct nvme_dev *dev, int qid, int depth)if (dev->ctrl.queue_count > qid)return 0 ; - nvmeq->cqes =dma_zalloc_coherent (dev->dev,CQ_SIZE (depth), - &nvmeq->cq_dma_addr,GFP_KERNEL ); + nvmeq->cqes =dma_alloc_coherent (dev->dev,CQ_SIZE (depth), + &nvmeq->cq_dma_addr,GFP_KERNEL );if (!nvmeq->cqes) goto free_nvmeq;
@@ -1915,8 +1915,8 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred,if (dev->ctrl.hmmaxd && dev->ctrl.hmmaxd < max_entries) max_entries = dev->ctrl.hmmaxd; - descs =dma_zalloc_coherent (dev->dev, max_entries *sizeof (*descs), - &descs_dma,GFP_KERNEL ); + descs =dma_alloc_coherent (dev->dev, max_entries *sizeof (*descs), + &descs_dma,GFP_KERNEL );if (!descs) goto out;
drivers/pci/controller/pcie-iproc-msi.c +3 -3
@@ -602,9 +602,9 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node) }/* Reserve memory for event queue and make sure memories are zeroed */ - msi->eq_cpu =dma_zalloc_coherent (pcie->dev, - msi->nr_eq_region *EQ_MEM_REGION_SIZE , - &msi->eq_dma,GFP_KERNEL ); + msi->eq_cpu =dma_alloc_coherent (pcie->dev, + msi->nr_eq_region *EQ_MEM_REGION_SIZE , + &msi->eq_dma,GFP_KERNEL );if (!msi->eq_cpu) { ret = -ENOMEM ; goto free_irqs;
drivers/pci/switch/switchtec.c +4 -4
@@ -1373,10 +1373,10 @@ static int switchtec_init_pci(struct switchtec_dev *stdev,if (ioread32 (&stdev->mmio_mrpc->dma_ver) ==0 )return 0 ; - stdev->dma_mrpc =dma_zalloc_coherent (&stdev->pdev->dev, -sizeof (*stdev->dma_mrpc), - &stdev->dma_mrpc_dma_addr, -GFP_KERNEL ); + stdev->dma_mrpc =dma_alloc_coherent (&stdev->pdev->dev, +sizeof (*stdev->dma_mrpc), + &stdev->dma_mrpc_dma_addr, +GFP_KERNEL );if (stdev->dma_mrpc ==NULL )return -ENOMEM ;
drivers/rapidio/devices/tsi721.c +11 -11
@@ -1382,9 +1382,9 @@ static int tsi721_doorbell_init(struct tsi721_device *priv)INIT_WORK (&priv->idb_work, tsi721_db_dpc);/* Allocate buffer for inbound doorbells queue */ - priv->idb_base =dma_zalloc_coherent (&priv->pdev->dev, -IDB_QSIZE *TSI721_IDB_ENTRY_SIZE , - &priv->idb_dma,GFP_KERNEL ); + priv->idb_base =dma_alloc_coherent (&priv->pdev->dev, +IDB_QSIZE *TSI721_IDB_ENTRY_SIZE , + &priv->idb_dma,GFP_KERNEL );if (!priv->idb_base)return -ENOMEM ;
@@ -1447,9 +1447,9 @@ static int tsi721_bdma_maint_init(struct tsi721_device *priv) regs = priv->regs +TSI721_DMAC_BASE (TSI721_DMACH_MAINT );/* Allocate space for DMA descriptors */ - bd_ptr =dma_zalloc_coherent (&priv->pdev->dev, - bd_num *sizeof (struct tsi721_dma_desc ), - &bd_phys,GFP_KERNEL ); + bd_ptr =dma_alloc_coherent (&priv->pdev->dev, + bd_num *sizeof (struct tsi721_dma_desc ), + &bd_phys,GFP_KERNEL );if (!bd_ptr)return -ENOMEM ;
@@ -1464,7 +1464,7 @@ static int tsi721_bdma_maint_init(struct tsi721_device *priv) sts_size = (bd_num >=TSI721_DMA_MINSTSSZ ) ? bd_num :TSI721_DMA_MINSTSSZ ; sts_size =roundup_pow_of_two (sts_size); - sts_ptr =dma_zalloc_coherent (&priv->pdev->dev, + sts_ptr =dma_alloc_coherent (&priv->pdev->dev, sts_size *sizeof (struct tsi721_dma_sts ), &sts_phys,GFP_KERNEL );if (!sts_ptr) {
@@ -1939,10 +1939,10 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id,/* Outbound message descriptor status FIFO allocation */ priv->omsg_ring[mbox].sts_size =roundup_pow_of_two (entries +1 ); - priv->omsg_ring[mbox].sts_base =dma_zalloc_coherent (&priv->pdev->dev, - priv->omsg_ring[mbox].sts_size * -sizeof (struct tsi721_dma_sts ), - &priv->omsg_ring[mbox].sts_phys,GFP_KERNEL ); + priv->omsg_ring[mbox].sts_base =dma_alloc_coherent (&priv->pdev->dev, + priv->omsg_ring[mbox].sts_size *sizeof (struct tsi721_dma_sts ), + &priv->omsg_ring[mbox].sts_phys, +GFP_KERNEL );if (priv->omsg_ring[mbox].sts_base ==NULL ) {tsi_debug (OMSG , &priv->pdev->dev,"ENOMEM for OB_MSG_%d status FIFO" , mbox);
drivers/rapidio/devices/tsi721_dma.c +4 -4
@@ -90,9 +90,9 @@ static int tsi721_bdma_ch_init(struct tsi721_bdma_chan *bdma_chan, int bd_num)* Allocate space for DMA descriptors * (add an extra element for link descriptor) */ - bd_ptr =dma_zalloc_coherent (dev, - (bd_num +1 ) *sizeof (struct tsi721_dma_desc ), - &bd_phys,GFP_ATOMIC ); + bd_ptr =dma_alloc_coherent (dev, + (bd_num +1 ) *sizeof (struct tsi721_dma_desc ), + &bd_phys,GFP_ATOMIC );if (!bd_ptr)return -ENOMEM ;
@@ -108,7 +108,7 @@ static int tsi721_bdma_ch_init(struct tsi721_bdma_chan *bdma_chan, int bd_num) sts_size = ((bd_num +1 ) >=TSI721_DMA_MINSTSSZ ) ? (bd_num +1 ) :TSI721_DMA_MINSTSSZ ; sts_size =roundup_pow_of_two (sts_size); - sts_ptr =dma_zalloc_coherent (dev, + sts_ptr =dma_alloc_coherent (dev, sts_size *sizeof (struct tsi721_dma_sts ), &sts_phys,GFP_ATOMIC );if (!sts_ptr) {
drivers/s390/net/ism_drv.c +7 -8
@@ -89,8 +89,8 @@ static int register_sba(struct ism_dev *ism)dma_addr_t dma_handle;struct ism_sba *sba; - sba =dma_zalloc_coherent (&ism->pdev->dev,PAGE_SIZE , - &dma_handle,GFP_KERNEL ); + sba =dma_alloc_coherent (&ism->pdev->dev,PAGE_SIZE , &dma_handle, +GFP_KERNEL );if (!sba)return -ENOMEM ;
@@ -116,8 +116,8 @@ static int register_ieq(struct ism_dev *ism)dma_addr_t dma_handle;struct ism_eq *ieq; - ieq =dma_zalloc_coherent (&ism->pdev->dev,PAGE_SIZE , - &dma_handle,GFP_KERNEL ); + ieq =dma_alloc_coherent (&ism->pdev->dev,PAGE_SIZE , &dma_handle, +GFP_KERNEL );if (!ieq)return -ENOMEM ;
@@ -234,10 +234,9 @@ static int ism_alloc_dmb(struct ism_dev *ism, struct smcd_dmb *dmb) test_and_set_bit(dmb->sba_idx, ism->sba_bitmap))return -EINVAL ; - dmb->cpu_addr =dma_zalloc_coherent (&ism->pdev->dev, dmb->dmb_len, - &dmb->dma_addr,GFP_KERNEL | - __GFP_NOWARN | __GFP_NOMEMALLOC | - __GFP_COMP | __GFP_NORETRY); + dmb->cpu_addr =dma_alloc_coherent (&ism->pdev->dev, dmb->dmb_len, + &dmb->dma_addr, +GFP_KERNEL | __GFP_NOWARN | __GFP_NOMEMALLOC | __GFP_COMP | __GFP_NORETRY);if (!dmb->cpu_addr)clear_bit (dmb->sba_idx, ism->sba_bitmap);
drivers/scsi/3w-sas.c +3 -2
@@ -646,8 +646,9 @@ static int twl_allocate_memory(TW_Device_Extension *tw_dev, int size, int which)unsigned long *cpu_addr;int retval =1 ; - cpu_addr =dma_zalloc_coherent (&tw_dev->tw_pci_dev->dev, - size *TW_Q_LENGTH , &dma_handle,GFP_KERNEL ); + cpu_addr =dma_alloc_coherent (&tw_dev->tw_pci_dev->dev, + size *TW_Q_LENGTH , &dma_handle, +GFP_KERNEL );if (!cpu_addr) {TW_PRINTK (tw_dev->host,TW_DRIVER ,0x5 ,"Memory allocation failed" ); goto out;
drivers/scsi/a100u2w.c +4 -4
@@ -1123,8 +1123,8 @@ static int inia100_probe_one(struct pci_dev *pdev,/* Get total memory needed for SCB */ sz =ORC_MAXQUEUE *sizeof (struct orc_scb ); - host->scb_virt =dma_zalloc_coherent (&pdev->dev, sz, &host->scb_phys, -GFP_KERNEL ); + host->scb_virt =dma_alloc_coherent (&pdev->dev, sz, &host->scb_phys, +GFP_KERNEL );if (!host->scb_virt) {printk ("inia100: SCB memory allocation error\n" ); goto out_host_put;
@@ -1132,8 +1132,8 @@ static int inia100_probe_one(struct pci_dev *pdev,/* Get total memory needed for ESCB */ sz =ORC_MAXQUEUE *sizeof (struct orc_extended_scb ); - host->escb_virt =dma_zalloc_coherent (&pdev->dev, sz, &host->escb_phys, -GFP_KERNEL ); + host->escb_virt =dma_alloc_coherent (&pdev->dev, sz, &host->escb_phys, +GFP_KERNEL );if (!host->escb_virt) {printk ("inia100: ESCB memory allocation error\n" ); goto out_free_scb_array;
drivers/scsi/arcmsr/arcmsr_hba.c +12 -6
@@ -587,8 +587,10 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)case ACB_ADAPTER_TYPE_B : {struct MessageUnit_B *reg; acb->roundup_ccbsize =roundup (sizeof (struct MessageUnit_B ),32 ); - dma_coherent =dma_zalloc_coherent (&pdev->dev, acb->roundup_ccbsize, - &dma_coherent_handle,GFP_KERNEL ); + dma_coherent =dma_alloc_coherent (&pdev->dev, + acb->roundup_ccbsize, + &dma_coherent_handle, +GFP_KERNEL );if (!dma_coherent) {pr_notice ("arcmsr%d: DMA allocation failed\n" , acb->host->host_no);return false;
@@ -617,8 +619,10 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)struct MessageUnit_D *reg; acb->roundup_ccbsize =roundup (sizeof (struct MessageUnit_D ),32 ); - dma_coherent =dma_zalloc_coherent (&pdev->dev, acb->roundup_ccbsize, - &dma_coherent_handle,GFP_KERNEL ); + dma_coherent =dma_alloc_coherent (&pdev->dev, + acb->roundup_ccbsize, + &dma_coherent_handle, +GFP_KERNEL );if (!dma_coherent) {pr_notice ("arcmsr%d: DMA allocation failed\n" , acb->host->host_no);return false;
@@ -659,8 +663,10 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)uint32_t completeQ_size; completeQ_size =sizeof (struct deliver_completeQ ) *ARCMSR_MAX_HBE_DONEQUEUE +128 ; acb->roundup_ccbsize =roundup (completeQ_size,32 ); - dma_coherent =dma_zalloc_coherent (&pdev->dev, acb->roundup_ccbsize, - &dma_coherent_handle,GFP_KERNEL ); + dma_coherent =dma_alloc_coherent (&pdev->dev, + acb->roundup_ccbsize, + &dma_coherent_handle, +GFP_KERNEL );if (!dma_coherent){pr_notice ("arcmsr%d: DMA allocation failed\n" , acb->host->host_no);return false;
drivers/scsi/be2iscsi/be_main.c +2 -2
@@ -3321,8 +3321,8 @@ static int be_queue_alloc(struct beiscsi_hba *phba, struct be_queue_info *q, q->len = len; q->entry_size = entry_size; mem->size = len * entry_size; - mem->va =dma_zalloc_coherent (&phba->pcidev->dev, mem->size, &mem->dma, -GFP_KERNEL ); + mem->va =dma_alloc_coherent (&phba->pcidev->dev, mem->size, &mem->dma, +GFP_KERNEL );if (!mem->va)return -ENOMEM ;return 0 ;
drivers/scsi/be2iscsi/be_mgmt.c +5 -6
@@ -293,8 +293,8 @@ static int beiscsi_prep_nemb_cmd(struct beiscsi_hba *phba,struct be_dma_mem *cmd, u8 subsystem, u8 opcode, u32 size)
Lines of this file are not shown. View the raw message.
drivers/scsi/bnx2fc/bnx2fc_hwi.c +24 -25
49 lines not on this page · raw message
drivers/scsi/bnx2fc/bnx2fc_tgt.c +22 -22
44 lines not on this page · raw message
drivers/scsi/megaraid/megaraid_sas_base.c +13 -13
Lines of this file are not shown. View the raw message.
drivers/scsi/megaraid/megaraid_sas_fusion.c +3 -2
Lines of this file are not shown. View the raw message.
drivers/scsi/smartpqi/smartpqi_init.c +16 -16
Lines of this file are not shown. View the raw message.
drivers/staging/mt7621-eth/mtk_eth_soc.c +1 -2
Lines of this file are not shown. View the raw message.
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +2 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.20.1
Part of the diff is not shown here. View the raw message.
Christoph Hellwig
maintainerPATCH 2/3 cross-tree: phase out dma_zalloc_coherent() on headers
In reply to Christoph HellwigFrom: Luis Chamberlain <[email protected]>
The last few stragglers coccinelle doesn't pick up are on driver specific header files. Phase those out as well as dma_alloc_coherent() zeroes out the memory as well now too.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 2 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 2 +- drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -1
@@ -2081,7 +2081,7 @@ 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_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL) + x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL)#define BNX2X_ILT_FREE (x, y, size) \ do { \
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +1 -1
@@ -52,7 +52,7 @@ extern int bnx2x_num_queues;#define BNX2X_PCI_ALLOC (y, size) \ ({ \ - void *x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \ + void *x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \ if (x) \ DP(NETIF_MSG_HW, \ "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n", \
drivers/net/ethernet/marvell/octeontx2/af/common.h +1 -1
@@ -64,7 +64,7 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q, qmem->entry_sz = entry_sz; qmem->alloc_sz = (qsize * entry_sz) +OTX2_ALIGN ; - qmem->base =dma_zalloc_coherent (dev, qmem->alloc_sz, + qmem->base =dma_alloc_coherent (dev, qmem->alloc_sz, &qmem->iova,GFP_KERNEL );if (!qmem->base)return -ENOMEM ;
Signature · 1 line
2.20.1
Re: [PATCH 2/3] cross-tree: phase out dma_zalloc_coherent() on headers
Quoted 5 lines · Christoph Hellwig
From: Luis Chamberlain <[email protected]>
The last few stragglers coccinelle doesn't pick up are on driver specific header files. Phase those out as well as
dma_alloc_coherent()zeroes out the memory as well now too.
You can use the --include-headers option to also process the header files (just an information, no need to change).
julia
Quoted 53 lines
Suggested-by Christoph Hellwig <[email protected]>Signed-off-by Luis Chamberlain <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>--- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 2 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 2 +- drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1
-1@@ -2081,7 +2081,7 @@ 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_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL) + x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL)#define BNX2X_ILT_FREE (x, y, size) \ do { \drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +1
-1@@ -52,7 +52,7 @@ extern int bnx2x_num_queues;#define BNX2X_PCI_ALLOC (y, size) \ ({ \ - void *x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \ + void *x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \ if (x) \ DP(NETIF_MSG_HW, \ "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n", \drivers/net/ethernet/marvell/octeontx2/af/common.h +1
-2@@ -64,7 +64,7 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q, qmem->entry_sz = entry_sz; qmem->alloc_sz = (qsize * entry_sz) +OTX2_ALIGN ; - qmem->base =dma_zalloc_coherent (dev, qmem->alloc_sz, + qmem->base =dma_alloc_coherent (dev, qmem->alloc_sz, &qmem->iova,GFP_KERNEL );if (!qmem->base)return -ENOMEM ; --2.20.1
Christoph Hellwig
maintainerPATCH 3/3 dma-mapping: remove dma_zalloc_coherent()
In reply to Christoph HellwigFrom: Luis Chamberlain <[email protected]>
dma_zalloc_coherent() is no longer needed as it has no users because dma_alloc_coherent() already zeroes out memory for us.
The Coccinelle grammar rule that used to check for dma_alloc_coherent()
+ memset() is modified so that it just tells the user that the memset is not needed anymore.
--- include/linux/dma-mapping.h | 9 --------- scripts/coccinelle/api/alloc/alloc_cast.cocci | 8 ++++---- scripts/coccinelle/api/alloc/zalloc-simple.cocci | 11 +---------- 3 files changed, 5 insertions(+), 23 deletions(-)
include/linux/dma-mapping.h +0 -9
@@ -717,15 +717,6 @@ static inline unsigned long dma_max_pfn(struct device *dev) }#endif -/* -* Please always use dma_alloc_coherent instead as it already zeroes the memory! -*/ -static inline void *dma_zalloc_coherent (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t flag) -{ -return dma_alloc_coherent (dev, size, dma_handle, flag); -} -static inline int dma_get_cache_alignment (void ) {#ifdef ARCH_DMA_MINALIGN
scripts/coccinelle/api/alloc/alloc_cast.cocci +4 -4
@@ -32,7 +32,7 @@ type T; (T *) \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\| - dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\| + dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\| kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\| pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\| kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
@@ -55,7 +55,7 @@ type r1.T; * (T *) \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\| - dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\| + dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\| kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\| pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\| kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
@@ -78,7 +78,7 @@ type r1.T; - (T *) \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\| - dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\| + dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\| kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\| pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\| kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
@@ -95,7 +95,7 @@ position p; (T@p *) \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\| - dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\| + dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\| kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\| pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\| kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
scripts/coccinelle/api/alloc/zalloc-simple.cocci +1 -10
@@ -69,15 +69,6 @@ statement S; - x = (T)vmalloc(E1); + x = (T)vzalloc(E1); | -- x = dma_alloc_coherent(E2,E1,E3,E4); -+ x = dma_zalloc_coherent(E2,E1,E3,E4); -| -- x = (T *)dma_alloc_coherent(E2,E1,E3,E4); -+ x = dma_zalloc_coherent(E2,E1,E3,E4); -| -- x = (T)dma_alloc_coherent(E2,E1,E3,E4); -+ x = (T)dma_zalloc_coherent(E2,E1,E3,E4); -| - x = kmalloc_node(E1,E2,E3); + x = kzalloc_node(E1,E2,E3); |
@@ -225,7 +216,7 @@ p << r2.p; x << r2.x; @@ -msg="WARNING: dma_zalloc_coherent should be used for %s, instead of dma_alloc_coherent/memset" % (x) +msg="WARNING: dma_alloc_coherent use in %s already zeroes out memory, so memset is not needed" % (x) coccilib.report.print_report(p[0], msg) //-----------------------------------------------------------------
Signature · 1 line
2.20.1
Re: [PATCH 3/3] dma-mapping: remove dma_zalloc_coherent()
Quoted 84 lines · Christoph Hellwig
From: Luis Chamberlain <[email protected]>
dma_zalloc_coherent()is no longer needed as it has no users becausedma_alloc_coherent()already zeroes out memory for us.The Coccinelle grammar rule that used to check for
dma_alloc_coherent()
+memset()is modified so that it just tells the user that the memset is not needed anymore.Suggested-by Christoph Hellwig <[email protected]>Signed-off-by Luis Chamberlain <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>--- include/linux/dma-mapping.h | 9 --------- scripts/coccinelle/api/alloc/alloc_cast.cocci | 8 ++++---- scripts/coccinelle/api/alloc/zalloc-simple.cocci | 11 +---------- 3 files changed, 5 insertions(+), 23 deletions(-)include/linux/dma-mapping.h +0
-9@@ -717,15 +717,6 @@ static inline unsigned long dma_max_pfn(struct device *dev) }#endif -/* -* Please always use dma_alloc_coherent instead as it already zeroes the memory! -*/ -static inline void *dma_zalloc_coherent (struct device *dev,size_t size, -dma_addr_t *dma_handle,gfp_t flag) -{ -return dma_alloc_coherent (dev, size, dma_handle, flag); -} -static inline int dma_get_cache_alignment (void ) {#ifdef ARCH_DMA_MINALIGN scripts/coccinelle/api/alloc/alloc_cast.cocci +4
-4@@ -32,7 +32,7 @@ type T; (T *) \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\| - dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\| + dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\| kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\| pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\| kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)@@ -55,7 +55,7 @@ type r1.T; * (T *) \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\| - dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\| + dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\| kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\| pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\| kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)@@ -78,7 +78,7 @@ type r1.T; - (T *) \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\| - dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\| + dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\| kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\| pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\| kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)@@ -95,7 +95,7 @@ position p; (T@p *) \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\| - dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\| + dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\| kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\| pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\| kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)scripts/coccinelle/api/alloc/zalloc-simple.cocci +0
-0@@ -69,15 +69,6 @@ statement S; - x = (T)vmalloc(E1);
scripts/coccinelle/api/alloc/zalloc-simple.cocci statement S; · line 79
Quoted 10 lines
scripts/coccinelle/api/alloc/zalloc-simple.cocci +0
-8+ x = (T)vzalloc(E1); | -- x = dma_alloc_coherent(E2,E1,E3,E4); -+ x = dma_zalloc_coherent(E2,E1,E3,E4); -| -- x = (T *)dma_alloc_coherent(E2,E1,E3,E4); -+ x = dma_zalloc_coherent(E2,E1,E3,E4); -| -- x = (T)dma_alloc_coherent(E2,E1,E3,E4); -+ x = (T)dma_zalloc_coherent(E2,E1,E3,E4);
Perhaps it would be better to make a separate rule that removed the memset? It wouldn't need the three cases.
x = (T)dma_alloc_coherent(E2,E1,E3,E4); would take care of everything.
julia
Quoted 17 lines
scripts/coccinelle/api/alloc/zalloc-simple.cocci +1
-3-| - x = kmalloc_node(E1,E2,E3); + x = kzalloc_node(E1,E2,E3); |@@ -225,7 +216,7 @@ p << r2.p; x << r2.x; @@ -msg="WARNING: dma_zalloc_coherent should be used for %s, instead of dma_alloc_coherent/memset" % (x) +msg="WARNING: dma_alloc_coherent use in %s already zeroes out memory, so memset is not needed" % (x) coccilib.report.print_report(p[0], msg) //----------------------------------------------------------------- --2.20.1
Quoted 27 lines · Christoph Hellwig
Hi Linus and world,
We've always had a weird situation around
dma_zalloc_coherent. To safely support mapping the allocations to userspace major architectures like x86 and arm have always zeroed allocations fromdma_alloc_coherent, but a couple other architectures were missing that zeroing either always or in corner cases. Then later we grew anothedma_zalloc_coherentinterface to explicitly request zeroing, but that just added__GFP_ZEROto the allocation flags, which for some allocators that didn't end up using the page allocator ended up being a no-op and still not zeroing the allocations.So for this merge window I fixed up all remaining architectures to zero the memory in
dma_alloc_coherent, and madedma_zalloc_coherenta no-op wrapper arounddma_alloc_coherent, which fixes all of the above issues.
dma_zalloc_coherentis now pointless and can go away, and Luis helped me writing a cocchinelle script and patch series to kill it, which I think we should apply now just after -rc1 to finally settle these issue.The script that generated the first patch is included here:
@
replace_dma_zalloc_coherent@
expression dev, size, data, handle, flags;
@@
Review
Quoted 2 lines
(quoted diff) +1
-1-dma_zalloc_coherent(dev, size, handle, flags) +dma_alloc_coherent(dev, size, handle, flags)
Great. We should also update api/alloc/zalloc-simple.cocci. The message could just say that the z version is no longer needed.
julia
Quoted 31 lines · Julia Lawall
Quoted 27 lines · Christoph Hellwig
Hi Linus and world,
We've always had a weird situation around
dma_zalloc_coherent. To safely support mapping the allocations to userspace major architectures like x86 and arm have always zeroed allocations fromdma_alloc_coherent, but a couple other architectures were missing that zeroing either always or in corner cases. Then later we grew anothedma_zalloc_coherentinterface to explicitly request zeroing, but that just added__GFP_ZEROto the allocation flags, which for some allocators that didn't end up using the page allocator ended up being a no-op and still not zeroing the allocations.So for this merge window I fixed up all remaining architectures to zero the memory in
dma_alloc_coherent, and madedma_zalloc_coherenta no-op wrapper arounddma_alloc_coherent, which fixes all of the above issues.
dma_zalloc_coherentis now pointless and can go away, and Luis helped me writing a cocchinelle script and patch series to kill it, which I think we should apply now just after -rc1 to finally settle these issue.The script that generated the first patch is included here:
@
replace_dma_zalloc_coherent@
expression dev, size, data, handle, flags;
@@
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +1
-1-dma_zalloc_coherent(dev, size, handle, flags) +dma_alloc_coherent(dev, size, handle, flags)Great. We should also update
api/alloc/zalloc-simple.cocci. The message could just say that the z version is no longer needed.
Oops, I see that you already took care of it. Thanks!
julia
Christoph Hellwig
maintainerLinus,
any chance you could take this before -rc2? That should avoid a lot of churn going forward. Any fine tuning of the memset-removal cochinnelle scripts can be queued up with normal updates.
Quoted 29 lines · Christoph Hellwig
Hi Linus and world,
We've always had a weird situation around
dma_zalloc_coherent. To safely support mapping the allocations to userspace major architectures like x86 and arm have always zeroed allocations fromdma_alloc_coherent, but a couple other architectures were missing that zeroing either always or in corner cases. Then later we grew anothedma_zalloc_coherentinterface to explicitly request zeroing, but that just added__GFP_ZEROto the allocation flags, which for some allocators that didn't end up using the page allocator ended up being a no-op and still not zeroing the allocations.So for this merge window I fixed up all remaining architectures to zero the memory in
dma_alloc_coherent, and madedma_zalloc_coherenta no-op wrapper arounddma_alloc_coherent, which fixes all of the above issues.
dma_zalloc_coherentis now pointless and can go away, and Luis helped me writing a cocchinelle script and patch series to kill it, which I think we should apply now just after -rc1 to finally settle these issue.The script that generated the first patch is included here:
@
replace_dma_zalloc_coherent@
expression dev, size, data, handle, flags;
@@(quoted diff) +1
-1-dma_zalloc_coherent(dev, size, handle, flags) +dma_alloc_coherent(dev, size, handle, flags)
Quoted 4 lines
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
---end quoted text---