treewide: Use dma_zalloc_coherent
Subsystems (35)
cover treewide: Use dma_zalloc_coherent
Use the zeroing function instead of dma_alloc_coherent & memset(,0,)
Joe Perches (26):
powerpc: Use dma_zalloc_coherent
sh: Use dma_zalloc_coherent
ata: Use dma_zalloc_coherent
block: Use dma_zalloc_coherent
crypto: Use dma_zalloc_coherent
dma: Use dma_zalloc_coherent
gpu: Use dma_zalloc_coherent
infiniband: Use dma_zalloc_coherent
mmc: Use dma_zalloc_coherent
broadcom: Use dma_zalloc_coherent
hisilicon: Use dma_zalloc_coherent
intel: Use dma_zalloc_coherent
ath: Use dma_zalloc_coherent
rt2x00: Use dma_zalloc_coherent
bfa: Use dma_zalloc_coherent
bnx2fc: Use dma_zalloc_coherent
bnx2i: Use dma_zalloc_coherent
dpt_i2o: Use dma_zalloc_coherent
lpfc: Use dma_zalloc_coherent
megaraid: Use dma_zalloc_coherent
mvsas: Use dma_zalloc_coherent
qla2xxx: Use dma_zalloc_coherent
qla4xxx: Use dma_zalloc_coherent
usb: Use dma_zalloc_coherent
fbdev: Use dma_zalloc_coherent
sound: Use dma_zalloc_coherent
arch/powerpc/platforms/pasemi/dma_lib.c | 8 ++-- arch/powerpc/sysdev/fsl_rmu.c | 9 ++-- arch/sh/mm/consistent.c | 4 +- drivers/ata/sata_fsl.c | 5 +-- drivers/block/nvme-core.c | 5 +-- drivers/crypto/amcc/crypto4xx_core.c | 8 ++-- drivers/crypto/ixp4xx_crypto.c | 8 ++-- drivers/dma/imx-sdma.c | 5 +-- drivers/dma/mxs-dma.c | 8 ++-- drivers/gpu/drm/drm_pci.c | 6 +-- drivers/infiniband/hw/cxgb3/cxio_hal.c | 7 ++-- drivers/infiniband/hw/mthca/mthca_memfree.c | 5 +-- drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 20 ++++----- drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 6 +-- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 8 ++-- drivers/mmc/host/msm_sdcc.c | 8 ++-- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 6 +-- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 5 +-- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 6 +-- drivers/net/wireless/ath/ath10k/pci.c | 8 +--- drivers/net/wireless/ath/ath10k/wmi.c | 8 +--- drivers/net/wireless/ath/wcn36xx/dxe.c | 6 +-- drivers/net/wireless/rt2x00/rt2x00mmio.c | 8 ++-- drivers/scsi/bfa/bfad_bsg.c | 6 +-- drivers/scsi/bnx2fc/bnx2fc_hwi.c | 59 ++++++++++++--------------- drivers/scsi/bnx2fc/bnx2fc_tgt.c | 51 ++++++++++------------- drivers/scsi/bnx2i/bnx2i_hwi.c | 14 +++---- drivers/scsi/dpt_i2o.c | 19 ++++----- drivers/scsi/lpfc/lpfc_bsg.c | 5 +-- drivers/scsi/lpfc/lpfc_init.c | 22 ++++------ drivers/scsi/lpfc/lpfc_mbox.c | 6 +-- drivers/scsi/lpfc/lpfc_sli.c | 14 +++---- drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 ++-- drivers/scsi/mvsas/mv_init.c | 26 +++++------- drivers/scsi/qla2xxx/qla_init.c | 10 ++--- drivers/scsi/qla4xxx/ql4_init.c | 5 +-- drivers/scsi/qla4xxx/ql4_mbx.c | 21 ++++------ drivers/scsi/qla4xxx/ql4_nx.c | 5 +-- drivers/scsi/qla4xxx/ql4_os.c | 12 +++--- drivers/usb/dwc2/hcd_ddma.c | 20 ++++----- drivers/usb/host/uhci-hcd.c | 7 ++-- drivers/video/fbdev/da8xx-fb.c | 9 ++-- sound/aoa/soundbus/i2sbus/core.c | 12 ++---- sound/sparc/dbri.c | 6 +-- 44 files changed, 197 insertions(+), 308 deletions(-)
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 1/26 powerpc: Use dma_zalloc_coherent
Use the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- arch/powerpc/platforms/pasemi/dma_lib.c | 8 +++----- arch/powerpc/sysdev/fsl_rmu.c | 9 ++++----- 2 files changed, 7 insertions(+), 10 deletions(-)
arch/powerpc/platforms/pasemi/dma_lib.c +3 -5
@@ -255,15 +255,13 @@ int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size) chan->ring_size = ring_size; - chan->ring_virt =dma_alloc_coherent (&dma_pdev->dev, - ring_size *sizeof (u64), - &chan->ring_dma,GFP_KERNEL ); + chan->ring_virt =dma_zalloc_coherent (&dma_pdev->dev, + ring_size *sizeof (u64), + &chan->ring_dma,GFP_KERNEL );if (!chan->ring_virt)return -ENOMEM ; -memset (chan->ring_virt,0 , ring_size *sizeof (u64)); -return 0 ; }EXPORT_SYMBOL (pasemi_dma_alloc_ring);
arch/powerpc/sysdev/fsl_rmu.c +4 -5
@@ -744,15 +744,14 @@ 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_alloc_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_zalloc_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; } -memset (rmu->msg_tx_ring.virt,0 , - rmu->msg_tx_ring.size *RIO_MSG_DESC_SIZE ); rmu->msg_tx_ring.tx_slot =0 ;/* Point dequeue/enqueue pointers at first entry in ring */
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 2/26 sh: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- arch/sh/mm/consistent.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/sh/mm/consistent.c +1 -3
@@ -143,14 +143,12 @@ int __init platform_resource_setup_memory(struct platform_device *pdev,if (!memsize)return 0 ; - buf =dma_alloc_coherent (NULL , memsize, &dma_handle,GFP_KERNEL ); + buf =dma_zalloc_coherent (NULL , memsize, &dma_handle,GFP_KERNEL );if (!buf) {pr_warning ("%s: unable to allocate memory\n" , name);return -ENOMEM ; } -memset (buf,0 , memsize); - r->flags =IORESOURCE_MEM ; r->start = dma_handle; r->end = r->start + memsize -1 ;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 3/26 ata: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/ata/sata_fsl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/ata/sata_fsl.c +2 -3
@@ -734,13 +734,12 @@ static int sata_fsl_port_start(struct ata_port *ap)if (!pp)return -ENOMEM ; - mem =dma_alloc_coherent (dev,SATA_FSL_PORT_PRIV_DMA_SZ , &mem_dma, -GFP_KERNEL ); + mem =dma_zalloc_coherent (dev,SATA_FSL_PORT_PRIV_DMA_SZ , &mem_dma, +GFP_KERNEL );if (!mem) {kfree (pp);return -ENOMEM ; } -memset (mem,0 ,SATA_FSL_PORT_PRIV_DMA_SZ ); pp->cmdslot = mem; pp->cmdslot_paddr = mem_dma;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
Tejun Heo
AppliedRe: [PATCH -next 03/26] ata: Use dma_zalloc_coherent
Quoted 3 lines · Joe Perches
Use the zeroing function instead of
dma_alloc_coherent&memset(,0,)Signed-off-by Joe Perches <[email protected]>
Applied to cgroup/for-3.17.
Thanks.
Signature · 1 line
tejun
PATCH 4/26 block: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/block/nvme-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/block/nvme-core.c +2 -3
@@ -1242,11 +1242,10 @@ static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid,if (!nvmeq)return NULL ; - nvmeq->cqes =dma_alloc_coherent (dmadev,CQ_SIZE (depth), - &nvmeq->cq_dma_addr,GFP_KERNEL ); + nvmeq->cqes =dma_zalloc_coherent (dmadev,CQ_SIZE (depth), + &nvmeq->cq_dma_addr,GFP_KERNEL );if (!nvmeq->cqes) goto free_nvmeq; -memset ((void *)nvmeq->cqes,0 ,CQ_SIZE (depth)); nvmeq->sq_cmds =dma_alloc_coherent (dmadev,SQ_SIZE (depth), &nvmeq->sq_dma_addr,GFP_KERNEL );
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
Matthew Wilcox
AppliedRe: [PATCH -next 04/26] block: Use dma_zalloc_coherent
Quoted 1 line · Joe Perches
Use the zeroing function instead of
dma_alloc_coherent&memset(,0,)
Applied
PATCH 5/26 crypto: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/crypto/amcc/crypto4xx_core.c | 8 +++----- drivers/crypto/ixp4xx_crypto.c | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-)
drivers/crypto/amcc/crypto4xx_core.c +3 -5
@@ -304,14 +304,12 @@ static struct ce_pd *crypto4xx_get_pdp(struct crypto4xx_device *dev,*/ static u32 crypto4xx_build_gdr (struct crypto4xx_device *dev) { - dev->gdr =dma_alloc_coherent (dev->core_dev->device, -sizeof (struct ce_gd ) *PPC4XX_NUM_GD , - &dev->gdr_pa,GFP_ATOMIC ); + dev->gdr =dma_zalloc_coherent (dev->core_dev->device, +sizeof (struct ce_gd ) *PPC4XX_NUM_GD , + &dev->gdr_pa,GFP_ATOMIC );if (!dev->gdr)return -ENOMEM ; -memset (dev->gdr,0 ,sizeof (struct ce_gd ) *PPC4XX_NUM_GD ); -return 0 ; }
drivers/crypto/ixp4xx_crypto.c +4 -4
@@ -251,12 +251,12 @@ static int setup_crypt_desc(void) {struct device *dev = &pdev->dev;BUILD_BUG_ON (sizeof (struct crypt_ctl ) !=64 ); - crypt_virt =dma_alloc_coherent (dev, -NPE_QLEN *sizeof (struct crypt_ctl ), - &crypt_phys,GFP_ATOMIC ); + crypt_virt =dma_zalloc_coherent (dev, +NPE_QLEN *sizeof (struct crypt_ctl ), + &crypt_phys,GFP_ATOMIC );if (!crypt_virt)return -ENOMEM ; -memset (crypt_virt,0 ,NPE_QLEN *sizeof (struct crypt_ctl )); +return 0 ; }
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 6/26 dma: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/dma/imx-sdma.c | 5 ++--- drivers/dma/mxs-dma.c | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/dma/imx-sdma.c +2 -3
@@ -904,14 +904,13 @@ static int sdma_request_channel(struct sdma_channel *sdmac)int channel = sdmac->channel;int ret = -EBUSY ; - sdmac->bd =dma_alloc_coherent (NULL ,PAGE_SIZE , &sdmac->bd_phys,GFP_KERNEL ); + sdmac->bd =dma_zalloc_coherent (NULL ,PAGE_SIZE , &sdmac->bd_phys, +GFP_KERNEL );if (!sdmac->bd) { ret = -ENOMEM ; goto out; } -memset (sdmac->bd,0 ,PAGE_SIZE ); - sdma->channel_control[channel].base_bd_ptr = sdmac->bd_phys; sdma->channel_control[channel].current_bd_ptr = sdmac->bd_phys;
drivers/dma/mxs-dma.c +3 -5
@@ -413,16 +413,14 @@ 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_alloc_coherent (mxs_dma->dma_device.dev, -CCW_BLOCK_SIZE , &mxs_chan->ccw_phys, -GFP_KERNEL ); + mxs_chan->ccw =dma_zalloc_coherent (mxs_dma->dma_device.dev, +CCW_BLOCK_SIZE , + &mxs_chan->ccw_phys,GFP_KERNEL );if (!mxs_chan->ccw) { ret = -ENOMEM ; goto err_alloc; } -memset (mxs_chan->ccw,0 ,CCW_BLOCK_SIZE ); -if (mxs_chan->chan_irq !=NO_IRQ ) { ret =request_irq (mxs_chan->chan_irq, mxs_dma_int_handler,0 ,"mxs-dma" , mxs_dma);
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
Re: [PATCH -next 06/26] dma: Use dma_zalloc_coherent
Quoted 1 line · Joe Perches
Use the zeroing function instead of
dma_alloc_coherent&memset(,0,)
Applied after updating subsystem name,
Thanks
Signature · 1 line
~Vinod
PATCH 7/26 gpu: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/gpu/drm/drm_pci.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_pci.c +2 -4
@@ -55,15 +55,13 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t alireturn NULL ; dmah->size = size; - dmah->vaddr =dma_alloc_coherent (&dev->pdev->dev, size, &dmah->busaddr,GFP_KERNEL | __GFP_COMP); - + dmah->vaddr =dma_zalloc_coherent (&dev->pdev->dev, size, &dmah->busaddr, +GFP_KERNEL | __GFP_COMP);if (dmah->vaddr ==NULL ) {kfree (dmah);return NULL ; } -memset (dmah->vaddr,0 , size); -/* XXX - Is virt_to_page() legal for consistent mem? */ /* Reserve */ for (addr = (unsigned long)dmah->vaddr, sz = size;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 8/26 infiniband: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/infiniband/hw/cxgb3/cxio_hal.c | 7 +++---- drivers/infiniband/hw/mthca/mthca_memfree.c | 5 ++--- drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 20 ++++++++------------ drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 6 ++---- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 8 +++----- 5 files changed, 18 insertions(+), 28 deletions(-)
drivers/infiniband/hw/cxgb3/cxio_hal.c +3 -4
@@ -293,13 +293,12 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain,if (!wq->sq) goto err3; - wq->queue =dma_alloc_coherent (&(rdev_p->rnic_info.pdev->dev), - depth *sizeof (union t3_wr ), - &(wq->dma_addr),GFP_KERNEL ); + wq->queue =dma_zalloc_coherent (&(rdev_p->rnic_info.pdev->dev), + depth *sizeof (union t3_wr ), + &wq->dma_addr,GFP_KERNEL );if (!wq->queue) goto err4; -memset (wq->queue,0 , depth *sizeof (union t3_wr ));dma_unmap_addr_set (wq, mapping, wq->dma_addr); wq->doorbell = (void __iomem *)rdev_p->rnic_info.kdb_addr;if (!kernel_domain)
drivers/infiniband/hw/mthca/mthca_memfree.c +2 -3
@@ -624,13 +624,12 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type, page = dev->db_tab->page + end; alloc: - page->db_rec =dma_alloc_coherent (&dev->pdev->dev,MTHCA_ICM_PAGE_SIZE , - &page->mapping,GFP_KERNEL ); + page->db_rec =dma_zalloc_coherent (&dev->pdev->dev,MTHCA_ICM_PAGE_SIZE , + &page->mapping,GFP_KERNEL );if (!page->db_rec) { ret = -ENOMEM ; goto out; } -memset (page->db_rec,0 ,MTHCA_ICM_PAGE_SIZE ); ret =mthca_MAP_ICM_page (dev, page->mapping,mthca_uarc_virt (dev, &dev->driver_uar, i));
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +8 -12
@@ -365,11 +365,11 @@ 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_alloc_coherent (&dev->nic_info.pdev->dev, q->size, - &q->dma,GFP_KERNEL ); + q->va =dma_zalloc_coherent (&dev->nic_info.pdev->dev, q->size, + &q->dma,GFP_KERNEL );if (!q->va)return -ENOMEM ; -memset (q->va,0 , q->size); +return 0 ; }
@@ -1581,12 +1581,11 @@ 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_alloc_coherent (&pdev->dev, cq->len, &cq->pa,GFP_KERNEL ); + cq->va =dma_zalloc_coherent (&pdev->dev, cq->len, &cq->pa,GFP_KERNEL );if (!cq->va) { status = -ENOMEM ; goto mem_err; } -memset (cq->va,0 , cq->len); page_size = cq->len / hw_pages; cmd->cmd.pgsz_pgcnt = (page_size /OCRDMA_MIN_Q_PAGE_SIZE ) <<OCRDMA_CREATE_CQ_PAGE_SIZE_SHIFT ;
@@ -1973,10 +1972,9 @@ 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_alloc_coherent (&pdev->dev, len, &pa,GFP_KERNEL ); + qp->sq.va =dma_zalloc_coherent (&pdev->dev, len, &pa,GFP_KERNEL );if (!qp->sq.va)return -EINVAL ; -memset (qp->sq.va,0 , len); qp->sq.len = len; qp->sq.pa = pa; qp->sq.entry_size = dev->attr.wqe_size;
@@ -2023,10 +2021,9 @@ 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_alloc_coherent (&pdev->dev, len, &pa,GFP_KERNEL ); + qp->rq.va =dma_zalloc_coherent (&pdev->dev, len, &pa,GFP_KERNEL );if (!qp->rq.va)return -ENOMEM ; -memset (qp->rq.va,0 , len); qp->rq.pa = pa; qp->rq.len = len; qp->rq.entry_size = dev->attr.rqe_size;
@@ -2079,11 +2076,10 @@ 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_alloc_coherent (&pdev->dev, ird_q_len, - &pa,GFP_KERNEL ); + qp->ird_q_va =dma_zalloc_coherent (&pdev->dev, ird_q_len, &pa, +GFP_KERNEL );if (!qp->ird_q_va)return -ENOMEM ; -memset (qp->ird_q_va,0 , ird_q_len);ocrdma_build_q_pages (&cmd->ird_addr[0 ], dev->attr.num_ird_pages, pa, ird_page_size);for (; i < ird_q_len / dev->attr.rqe_size; i++) {
drivers/infiniband/hw/ocrdma/ocrdma_stats.c +2 -4
@@ -56,15 +56,13 @@ static bool ocrdma_alloc_stats_mem(struct ocrdma_dev *dev) mem->size =max_t (u32,sizeof (struct ocrdma_rdma_stats_req ),sizeof (struct ocrdma_rdma_stats_resp )); - mem->va =dma_alloc_coherent (&dev->nic_info.pdev->dev, mem->size, - &mem->pa,GFP_KERNEL ); + mem->va =dma_zalloc_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; } -memset (mem->va,0 , mem->size); -/* Alloc debugfs mem */ mem->debugfs_mem =kzalloc (OCRDMA_MAX_DBGFS_MEM ,GFP_KERNEL );if (!mem->debugfs_mem) {
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +3 -5
@@ -373,13 +373,12 @@ 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_alloc_coherent (&pdev->dev, map_len, - &ctx->ah_tbl.pa,GFP_KERNEL ); + ctx->ah_tbl.va =dma_zalloc_coherent (&pdev->dev, map_len, + &ctx->ah_tbl.pa,GFP_KERNEL );if (!ctx->ah_tbl.va) {kfree (ctx);return ERR_PTR (-ENOMEM ); } -memset (ctx->ah_tbl.va,0 , map_len); ctx->ah_tbl.len = map_len;memset (&resp,0 ,sizeof (resp));
@@ -708,13 +707,12 @@ 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_alloc_coherent (&pdev->dev, dma_len, &pa,GFP_KERNEL ); + va =dma_zalloc_coherent (&pdev->dev, dma_len, &pa,GFP_KERNEL );if (!va) {ocrdma_free_mr_pbl_tbl (dev, mr); status = -ENOMEM ;break ; } -memset (va,0 , dma_len); mr->pbl_table[i].va = va; mr->pbl_table[i].pa = pa; }
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
Re: [PATCH -next 08/26] infiniband: Use dma_zalloc_coherent
For cxgb3,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/26 mmc: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/mmc/host/msm_sdcc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/mmc/host/msm_sdcc.c +3 -5
@@ -1146,15 +1146,13 @@ msmsdcc_init_dma(struct msmsdcc_host *host)if (!host->dmares)return -ENODEV ; - host->dma.nc =dma_alloc_coherent (NULL , -sizeof (struct msmsdcc_nc_dmadata ), - &host->dma.nc_busaddr, -GFP_KERNEL ); + host->dma.nc =dma_zalloc_coherent (NULL , +sizeof (struct msmsdcc_nc_dmadata ), + &host->dma.nc_busaddr,GFP_KERNEL );if (host->dma.nc ==NULL ) {pr_err ("Unable to allocate DMA buffer\n" );return -ENOMEM ; } -memset (host->dma.nc,0x00 ,sizeof (struct msmsdcc_nc_dmadata )); host->dma.cmd_busaddr = host->dma.nc_busaddr; host->dma.cmdptr_busaddr = host->dma.nc_busaddr + offsetof(struct msmsdcc_nc_dmadata , cmdptr);
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 10/26 broadcom: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bcm63xx_enet.c +2 -4
@@ -2165,27 +2165,25 @@ 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_alloc_coherent (kdev, size, &priv->rx_desc_dma,GFP_KERNEL ); + p =dma_zalloc_coherent (kdev, size, &priv->rx_desc_dma,GFP_KERNEL );if (!p) {dev_err (kdev,"cannot allocate rx ring %u\n" , size); ret = -ENOMEM ; goto out_freeirq_tx; } -memset (p,0 , size); priv->rx_desc_alloc_size = size; priv->rx_desc_cpu = p;/* allocate tx dma ring */ size = priv->tx_ring_size *sizeof (struct bcm_enet_desc ); - p =dma_alloc_coherent (kdev, size, &priv->tx_desc_dma,GFP_KERNEL ); + p =dma_zalloc_coherent (kdev, size, &priv->tx_desc_dma,GFP_KERNEL );if (!p) {dev_err (kdev,"cannot allocate tx ring\n" ); ret = -ENOMEM ; goto out_free_rx_ring; } -memset (p,0 , size); priv->tx_desc_alloc_size = size; priv->tx_desc_cpu = p;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 11/26 hisilicon: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c +2 -3
@@ -867,12 +867,11 @@ 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_alloc_coherent (dev, size, &phys_addr, -GFP_KERNEL ); + virt_addr =dma_zalloc_coherent (dev, size, &phys_addr, +GFP_KERNEL );if (virt_addr ==NULL ) goto error_free_pool; -memset (virt_addr,0 , size); priv->pool[i].size = size; priv->pool[i].desc = virt_addr; priv->pool[i].phys_addr = phys_addr;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 12/26 intel: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ixgb/ixgb_main.c +2 -4
@@ -795,14 +795,12 @@ 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_alloc_coherent (&pdev->dev, rxdr->size, &rxdr->dma, -GFP_KERNEL ); - + rxdr->desc =dma_zalloc_coherent (&pdev->dev, rxdr->size, &rxdr->dma, +GFP_KERNEL );if (!rxdr->desc) {vfree (rxdr->buffer_info);return -ENOMEM ; } -memset (rxdr->desc,0 , rxdr->size); rxdr->next_to_clean =0 ; rxdr->next_to_use =0 ;
Signature · 14 lines
1.8.1.2.459.gbcd45b4.dirty ------------------------------------------------------------------------------ HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing & Easy Data Exploration http://p.sf.net/sfu/hpccsystems _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
Re: [PATCH -next 12/26] intel: Use dma_zalloc_coherent
Quoted 3 lines · Joe Perches
Use the zeroing function instead of
dma_alloc_coherent&memset(,0,)Signed-off-by Joe Perches <[email protected]>
Quoted 3 lines
--- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
PATCH 13/26 ath: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/net/wireless/ath/ath10k/pci.c | 8 ++------ drivers/net/wireless/ath/ath10k/wmi.c | 8 ++------ drivers/net/wireless/ath/wcn36xx/dxe.c | 6 ++---- 3 files changed, 6 insertions(+), 16 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +2 -6
@@ -359,16 +359,12 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,* 2) Buffer in DMA-able space */ orig_nbytes = nbytes; - data_buf = (unsigned char *)dma_alloc_coherent (ar->dev, - orig_nbytes, - &ce_data_base, -GFP_ATOMIC ); - + data_buf =dma_zalloc_coherent (ar->dev, orig_nbytes, &ce_data_base, +GFP_ATOMIC );if (!data_buf) { ret = -ENOMEM ; goto done; } -memset (data_buf,0 , orig_nbytes); remaining_bytes = orig_nbytes; ce_data = ce_data_base;
drivers/net/wireless/ath/ath10k/wmi.c +2 -6
@@ -1889,17 +1889,13 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, u32 req_id,if (!pool_size)return -EINVAL ; - ar->wmi.mem_chunks[idx].vaddr =dma_alloc_coherent (ar->dev, - pool_size, - &paddr, -GFP_ATOMIC ); + ar->wmi.mem_chunks[idx].vaddr =dma_zalloc_coherent (ar->dev, pool_size, + &paddr,GFP_ATOMIC );if (!ar->wmi.mem_chunks[idx].vaddr) {ath10k_warn ("failed to allocate memory chunk\n" );return -ENOMEM ; } -memset (ar->wmi.mem_chunks[idx].vaddr,0 , pool_size); - ar->wmi.mem_chunks[idx].paddr = paddr; ar->wmi.mem_chunks[idx].len = pool_size; ar->wmi.mem_chunks[idx].req_id = req_id;
drivers/net/wireless/ath/wcn36xx/dxe.c +2 -4
@@ -177,13 +177,11 @@ static int wcn36xx_dxe_init_descs(struct wcn36xx_dxe_ch *wcn_ch)int i; size = wcn_ch->desc_num *sizeof (struct wcn36xx_dxe_desc ); - wcn_ch->cpu_addr =dma_alloc_coherent (NULL , size, &wcn_ch->dma_addr, -GFP_KERNEL ); + wcn_ch->cpu_addr =dma_zalloc_coherent (NULL , size, &wcn_ch->dma_addr, +GFP_KERNEL );if (!wcn_ch->cpu_addr)return -ENOMEM ; -memset (wcn_ch->cpu_addr,0 , size); - cur_dxe = (struct wcn36xx_dxe_desc *)wcn_ch->cpu_addr; cur_ctl = wcn_ch->head_blk_ctl;
Signature · 7 lines
1.8.1.2.459.gbcd45b4.dirty _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Re: [PATCH -next 13/26] ath: Use dma_zalloc_coherent
Quoted 3 lines · Joe Perches
Use the zeroing function instead of
dma_alloc_coherent&memset(,0,)Signed-off-by Joe Perches <[email protected]>
For ath10k:
Signature · 6 lines
Kalle Valo _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH 14/26 rt2x00: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/net/wireless/rt2x00/rt2x00mmio.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/rt2x00/rt2x00mmio.c +3 -5
@@ -119,14 +119,12 @@ static int rt2x00mmio_alloc_queue_dma(struct rt2x00_dev *rt2x00dev,/* * Allocate DMA memory for descriptor and buffer. */ - addr =dma_alloc_coherent (rt2x00dev->dev, - queue->limit * queue->desc_size, - &dma,GFP_KERNEL ); + addr =dma_zalloc_coherent (rt2x00dev->dev, + queue->limit * queue->desc_size, &dma, +GFP_KERNEL );if (!addr)return -ENOMEM ; -memset (addr,0 , queue->limit * queue->desc_size); -/* * Initialize all queue entries to contain valid addresses. */
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 15/26 bfa: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/scsi/bfa/bfad_bsg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/bfa/bfad_bsg.c +3 -3
@@ -3270,13 +3270,13 @@ bfad_fcxp_map_sg(struct bfad_s *bfad, void *payload_kbuf,/* Allocate dma coherent memory */ buf_info = buf_base; buf_info->size = payload_len; - buf_info->virt =dma_alloc_coherent (&bfad->pcidev->dev, buf_info->size, - &buf_info->phys,GFP_KERNEL ); + buf_info->virt =dma_zalloc_coherent (&bfad->pcidev->dev, + buf_info->size, &buf_info->phys, +GFP_KERNEL );if (!buf_info->virt) goto out_free_mem;/* copy the linear bsg buffer to buf_info */ -memset (buf_info->virt,0 , buf_info->size);memcpy (buf_info->virt, payload_kbuf, buf_info->size);/*
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
RE: [PATCH -next 15/26] bfa: Use dma_zalloc_coherent
Thanks for the patch.
-----Original Message-----
From: Joe Perches [mailto:[email protected]]
Sent: 16 June 2014 02:08
To: linux-kernel
Cc: Anil Gurumurthy; Sudarsana Kalluru; James E.J. Bottomley; linux-scsi
Subject: [PATCH -next 15/26] bfa: Use dma_zalloc_coherent
Use the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/scsi/bfa/bfad_bsg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/bfa/bfad_bsg.c +3 -3
@@ -3270,13 +3270,13 @@ bfad_fcxp_map_sg(struct bfad_s *bfad, void *payload_kbuf,/* Allocate dma coherent memory */ buf_info = buf_base; buf_info->size = payload_len; - buf_info->virt =dma_alloc_coherent (&bfad->pcidev->dev, buf_info->size, - &buf_info->phys,GFP_KERNEL ); + buf_info->virt =dma_zalloc_coherent (&bfad->pcidev->dev, + buf_info->size, &buf_info->phys, +GFP_KERNEL );if (!buf_info->virt) goto out_free_mem;/* copy the linear bsg buffer to buf_info */ -memset (buf_info->virt,0 , buf_info->size);memcpy (buf_info->virt, payload_kbuf, buf_info->size);/*
--
1.8.1.2.459.gbcd45b4.dirty
________________________________
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
PATCH 16/26 bnx2fc: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/scsi/bnx2fc/bnx2fc_hwi.c | 59 +++++++++++++++++----------------------- drivers/scsi/bnx2fc/bnx2fc_tgt.c | 51 ++++++++++++++-------------------- 2 files changed, 46 insertions(+), 64 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_hwi.c +25 -34
@@ -1854,16 +1854,15 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba)* entries. Hence the limit with one page is 8192 task context * entries. */ - hba->task_ctx_bd_tbl =dma_alloc_coherent (&hba->pcidev->dev, -PAGE_SIZE , - &hba->task_ctx_bd_dma, -GFP_KERNEL ); + hba->task_ctx_bd_tbl =dma_zalloc_coherent (&hba->pcidev->dev, +PAGE_SIZE , + &hba->task_ctx_bd_dma, +GFP_KERNEL );if (!hba->task_ctx_bd_tbl) { printk(KERN_ERR PFX "unable to allocate task context BDT\n"); rc =-1 ; goto out; } -memset (hba->task_ctx_bd_tbl,0 ,PAGE_SIZE );/* * Allocate task_ctx which is an array of pointers pointing to
@@ -1892,16 +1891,15 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba) task_ctx_bdt = (struct regpair *)hba->task_ctx_bd_tbl;for (i =0 ; i < task_ctx_arr_sz; i++) { - hba->task_ctx[i] =dma_alloc_coherent (&hba->pcidev->dev, -PAGE_SIZE , - &hba->task_ctx_dma[i], -GFP_KERNEL ); + hba->task_ctx[i] =dma_zalloc_coherent (&hba->pcidev->dev, +PAGE_SIZE , + &hba->task_ctx_dma[i], +GFP_KERNEL );if (!hba->task_ctx[i]) { printk(KERN_ERR PFX "unable to alloc task context\n"); rc =-1 ; goto out3; } -memset (hba->task_ctx[i],0 ,PAGE_SIZE ); addr = (u64 )hba->task_ctx_dma[i]; task_ctx_bdt->hi =cpu_to_le32 ((u64 )addr >>32 ); task_ctx_bdt->lo =cpu_to_le32 ((u32 )addr);
@@ -2031,27 +2029,23 @@ static int bnx2fc_allocate_hash_table(struct bnx2fc_hba *hba)for (i =0 ; i < segment_count; ++i) { hba->hash_tbl_segments[i] = -dma_alloc_coherent (&hba->pcidev->dev, -BNX2FC_HASH_TBL_CHUNK_SIZE , - &dma_segment_array[i], -GFP_KERNEL ); +dma_zalloc_coherent (&hba->pcidev->dev, +BNX2FC_HASH_TBL_CHUNK_SIZE , + &dma_segment_array[i], +GFP_KERNEL );if (!hba->hash_tbl_segments[i]) { printk(KERN_ERR PFX "hash segment alloc failed\n"); goto cleanup_dma; } -memset (hba->hash_tbl_segments[i],0 , -BNX2FC_HASH_TBL_CHUNK_SIZE ); } - hba->hash_tbl_pbl =dma_alloc_coherent (&hba->pcidev->dev, -PAGE_SIZE , - &hba->hash_tbl_pbl_dma, -GFP_KERNEL ); + hba->hash_tbl_pbl =dma_zalloc_coherent (&hba->pcidev->dev,PAGE_SIZE , + &hba->hash_tbl_pbl_dma, +GFP_KERNEL );if (!hba->hash_tbl_pbl) { printk(KERN_ERR PFX "hash table pbl alloc failed\n"); goto cleanup_dma; } -memset (hba->hash_tbl_pbl,0 ,PAGE_SIZE ); pbl = hba->hash_tbl_pbl;for (i =0 ; i < segment_count; ++i) {
@@ -2108,27 +2102,26 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba)return -ENOMEM ; mem_size =BNX2FC_NUM_MAX_SESS *sizeof (struct regpair ); - hba->t2_hash_tbl_ptr =dma_alloc_coherent (&hba->pcidev->dev, mem_size, - &hba->t2_hash_tbl_ptr_dma, -GFP_KERNEL ); + hba->t2_hash_tbl_ptr =dma_zalloc_coherent (&hba->pcidev->dev, + mem_size, + &hba->t2_hash_tbl_ptr_dma, +GFP_KERNEL );if (!hba->t2_hash_tbl_ptr) { printk(KERN_ERR PFX "unable to allocate t2 hash table ptr\n");bnx2fc_free_fw_resc (hba);return -ENOMEM ; } -memset (hba->t2_hash_tbl_ptr,0x00 , mem_size); mem_size =BNX2FC_NUM_MAX_SESS *sizeof (struct fcoe_t2_hash_table_entry ); - hba->t2_hash_tbl =dma_alloc_coherent (&hba->pcidev->dev, mem_size, - &hba->t2_hash_tbl_dma, -GFP_KERNEL ); + hba->t2_hash_tbl =dma_zalloc_coherent (&hba->pcidev->dev, mem_size, + &hba->t2_hash_tbl_dma, +GFP_KERNEL );if (!hba->t2_hash_tbl) { printk(KERN_ERR PFX "unable to allocate t2 hash table\n");bnx2fc_free_fw_resc (hba);return -ENOMEM ; } -memset (hba->t2_hash_tbl,0x00 , mem_size);for (i =0 ; i <BNX2FC_NUM_MAX_SESS ; i++) { addr = (unsigned long ) hba->t2_hash_tbl_dma + ((i+1 ) *sizeof (struct fcoe_t2_hash_table_entry ));
@@ -2145,16 +2138,14 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba)return -ENOMEM ; } - hba->stats_buffer =dma_alloc_coherent (&hba->pcidev->dev, -PAGE_SIZE , - &hba->stats_buf_dma, -GFP_KERNEL ); + hba->stats_buffer =dma_zalloc_coherent (&hba->pcidev->dev,PAGE_SIZE , + &hba->stats_buf_dma, +GFP_KERNEL );if (!hba->stats_buffer) { printk(KERN_ERR PFX "unable to alloc Stats Buffer\n");bnx2fc_free_fw_resc (hba);return -ENOMEM ; } -memset (hba->stats_buffer,0x00 ,PAGE_SIZE );return 0 ; }
drivers/scsi/bnx2fc/bnx2fc_tgt.c +21 -30
152 lines not on this page · raw message
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 17/26 bnx2i: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +6 -8
@@ -1080,16 +1080,15 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) }/* Allocate memory area for actual SQ element */ - ep->qp.sq_virt = -dma_alloc_coherent (&hba->pcidev->dev, ep->qp.sq_mem_size, - &ep->qp.sq_phys,GFP_KERNEL ); + ep->qp.sq_virt =dma_zalloc_coherent (&hba->pcidev->dev, + ep->qp.sq_mem_size, + &ep->qp.sq_phys,GFP_KERNEL );if (!ep->qp.sq_virt) {printk (KERN_ALERT "bnx2i: unable to alloc SQ BD memory %d\n" , ep->qp.sq_mem_size); goto mem_alloc_err; } -memset (ep->qp.sq_virt,0x00 , ep->qp.sq_mem_size); ep->qp.sq_first_qe = ep->qp.sq_virt; ep->qp.sq_prod_qe = ep->qp.sq_first_qe; ep->qp.sq_cons_qe = ep->qp.sq_first_qe;
@@ -1117,15 +1116,14 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) }/* Allocate memory area for actual CQ element */ - ep->qp.cq_virt = -dma_alloc_coherent (&hba->pcidev->dev, ep->qp.cq_mem_size, - &ep->qp.cq_phys,GFP_KERNEL ); + ep->qp.cq_virt =dma_zalloc_coherent (&hba->pcidev->dev, + ep->qp.cq_mem_size, + &ep->qp.cq_phys,GFP_KERNEL );if (!ep->qp.cq_virt) {printk (KERN_ALERT "bnx2i: unable to alloc CQ BD memory %d\n" , ep->qp.cq_mem_size); goto mem_alloc_err; } -memset (ep->qp.cq_virt,0x00 , ep->qp.cq_mem_size); ep->qp.cq_first_qe = ep->qp.cq_virt; ep->qp.cq_prod_qe = ep->qp.cq_first_qe;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 18/26 dpt_i2o: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/scsi/dpt_i2o.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/scsi/dpt_i2o.c +8 -11
@@ -1376,13 +1376,12 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba)schedule_timeout_uninterruptible (1 ); }while (m ==EMPTY_QUEUE ); - status =dma_alloc_coherent (&pHba->pDev->dev,4 , &addr,GFP_KERNEL ); + status =dma_zalloc_coherent (&pHba->pDev->dev,4 , &addr,GFP_KERNEL );if (status ==NULL ) {adpt_send_nop (pHba, m);printk (KERN_ERR "IOP reset failed - no free memory.\n" );return -ENOMEM ; } -memset (status,0 ,4 ); msg[0 ]=EIGHT_WORD_MSG_SIZE |SGL_OFFSET_0 ; msg[1 ]=I2O_CMD_ADAPTER_RESET <<24 |HOST_TID <<12 |ADAPTER_TID ;
@@ -2830,14 +2829,13 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba) msg=(u32 __iomem *)(pHba->msg_addr_virt+m); - status =dma_alloc_coherent (&pHba->pDev->dev,4 , &addr,GFP_KERNEL ); + status =dma_zalloc_coherent (&pHba->pDev->dev,4 , &addr,GFP_KERNEL );if (!status) {adpt_send_nop (pHba, m);printk (KERN_WARNING "%s: IOP reset failed - no free memory.\n" , pHba->name);return -ENOMEM ; } -memset (status,0 ,4 );writel (EIGHT_WORD_MSG_SIZE |SGL_OFFSET_6 , &msg[0 ]);writel (I2O_CMD_OUTBOUND_INIT <<24 |HOST_TID <<12 |ADAPTER_TID , &msg[1 ]);
@@ -2884,14 +2882,14 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba) pHba->reply_pool, pHba->reply_pool_pa); } - pHba->reply_pool =dma_alloc_coherent (&pHba->pDev->dev, - pHba->reply_fifo_size *REPLY_FRAME_SIZE *4 , - &pHba->reply_pool_pa,GFP_KERNEL ); + pHba->reply_pool = +dma_zalloc_coherent (&pHba->pDev->dev, + pHba->reply_fifo_size *REPLY_FRAME_SIZE *4 , + &pHba->reply_pool_pa,GFP_KERNEL );if (!pHba->reply_pool) {printk (KERN_ERR "%s: Could not allocate reply pool\n" , pHba->name);return -ENOMEM ; } -memset (pHba->reply_pool,0 , pHba->reply_fifo_size *REPLY_FRAME_SIZE *4 );for (i =0 ; i < pHba->reply_fifo_size; i++) { writel(pHba->reply_pool_pa + (i * REPLY_FRAME_SIZE * 4),
@@ -3120,13 +3118,12 @@ static int adpt_i2o_build_sys_table(void) sys_tbl_len =sizeof (struct i2o_sys_tbl ) +// Header + IOPs (hba_count) *sizeof (struct i2o_sys_tbl_entry ); - sys_tbl =dma_alloc_coherent (&pHba->pDev->dev, - sys_tbl_len, &sys_tbl_pa,GFP_KERNEL ); + sys_tbl =dma_zalloc_coherent (&pHba->pDev->dev, sys_tbl_len, + &sys_tbl_pa,GFP_KERNEL );if (!sys_tbl) {printk (KERN_WARNING "SysTab Set failed. Out of memory.\n" );return -ENOMEM ; } -memset (sys_tbl,0 , sys_tbl_len); sys_tbl->num_entries = hba_count; sys_tbl->version =I2OVERSION ;
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 19/26 lpfc: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/scsi/lpfc/lpfc_bsg.c | 5 ++--- drivers/scsi/lpfc/lpfc_init.c | 22 +++++++--------------- drivers/scsi/lpfc/lpfc_mbox.c | 6 +++--- drivers/scsi/lpfc/lpfc_sli.c | 14 +++++--------- 4 files changed, 17 insertions(+), 30 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +2 -3
@@ -2693,14 +2693,13 @@ lpfc_bsg_dma_page_alloc(struct lpfc_hba *phba)INIT_LIST_HEAD (&dmabuf->list);/* now, allocate dma buffer */ - dmabuf->virt =dma_alloc_coherent (&pcidev->dev,BSG_MBOX_SIZE , - &(dmabuf->phys),GFP_KERNEL ); + dmabuf->virt =dma_zalloc_coherent (&pcidev->dev,BSG_MBOX_SIZE , + &(dmabuf->phys),GFP_KERNEL );if (!dmabuf->virt) {kfree (dmabuf);return NULL ; } -memset ((uint8_t *)dmabuf->virt,0 ,BSG_MBOX_SIZE );return dmabuf; }
drivers/scsi/lpfc/lpfc_init.c +7 -15
@@ -5848,16 +5848,14 @@ lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba)if (!dmabuf)return NULL ; - dmabuf->virt =dma_alloc_coherent (&phba->pcidev->dev, -LPFC_HDR_TEMPLATE_SIZE , - &dmabuf->phys, -GFP_KERNEL ); + dmabuf->virt =dma_zalloc_coherent (&phba->pcidev->dev, +LPFC_HDR_TEMPLATE_SIZE , + &dmabuf->phys,GFP_KERNEL );if (!dmabuf->virt) { rpi_hdr =NULL ; goto err_free_dmabuf; } -memset (dmabuf->virt,0 ,LPFC_HDR_TEMPLATE_SIZE );if (!IS_ALIGNED (dmabuf->phys,LPFC_HDR_TEMPLATE_SIZE )) { rpi_hdr =NULL ; goto err_free_coherent;
@@ -6246,14 +6244,11 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) }/* Allocate memory for SLI-2 structures */ - phba->slim2p.virt =dma_alloc_coherent (&pdev->dev, -SLI2_SLIM_SIZE , - &phba->slim2p.phys, -GFP_KERNEL ); + phba->slim2p.virt =dma_zalloc_coherent (&pdev->dev,SLI2_SLIM_SIZE , + &phba->slim2p.phys,GFP_KERNEL );if (!phba->slim2p.virt) goto out_iounmap; -memset (phba->slim2p.virt,0 ,SLI2_SLIM_SIZE ); phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim , mbx); phba->mbox_ext = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim , mbx_ext_words));
@@ -6618,15 +6613,12 @@ lpfc_create_bootstrap_mbox(struct lpfc_hba *phba)* plus an alignment restriction of 16 bytes. */ bmbx_size =sizeof (struct lpfc_bmbx_create ) + (LPFC_ALIGN_16_BYTE -1 ); - dmabuf->virt =dma_alloc_coherent (&phba->pcidev->dev, - bmbx_size, - &dmabuf->phys, -GFP_KERNEL ); + dmabuf->virt =dma_zalloc_coherent (&phba->pcidev->dev, bmbx_size, + &dmabuf->phys,GFP_KERNEL );if (!dmabuf->virt) {kfree (dmabuf);return -ENOMEM ; } -memset (dmabuf->virt,0 , bmbx_size);/* * Initialize the bootstrap mailbox pointers now so that the register
drivers/scsi/lpfc/lpfc_mbox.c +3 -3
@@ -1811,12 +1811,12 @@ lpfc_sli4_config(struct lpfc_hba *phba, struct lpfcMboxq *mbox,* page, this is used as a priori size of SLI4_PAGE_SIZE for * the later DMA memory free. */ - viraddr =dma_alloc_coherent (&phba->pcidev->dev,SLI4_PAGE_SIZE , - &phyaddr,GFP_KERNEL ); + viraddr =dma_zalloc_coherent (&phba->pcidev->dev, +SLI4_PAGE_SIZE , &phyaddr, +GFP_KERNEL );/* In case of malloc fails, proceed with whatever we have */ if (!viraddr)break ; -memset (viraddr,0 ,SLI4_PAGE_SIZE ); mbox->sge_array->addr[pagen] = viraddr;/* Keep the first page for later sub-header construction */ if (pagen ==0 )
drivers/scsi/lpfc/lpfc_sli.c +5 -9
@@ -4864,15 +4864,12 @@ lpfc_sli4_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,* mailbox command. */ dma_size = *vpd_size; - dmabuf->virt =dma_alloc_coherent (&phba->pcidev->dev, - dma_size, - &dmabuf->phys, -GFP_KERNEL ); + dmabuf->virt =dma_zalloc_coherent (&phba->pcidev->dev, dma_size, + &dmabuf->phys,GFP_KERNEL );if (!dmabuf->virt) {kfree (dmabuf);return -ENOMEM ; } -memset (dmabuf->virt,0 , dma_size);/* * The SLI4 implementation of READ_REV conflicts at word1,
@@ -12760,14 +12757,13 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t entry_size, dmabuf =kzalloc (sizeof (struct lpfc_dmabuf ),GFP_KERNEL );if (!dmabuf) goto out_fail; - dmabuf->virt =dma_alloc_coherent (&phba->pcidev->dev, - hw_page_size, &dmabuf->phys, -GFP_KERNEL ); + dmabuf->virt =dma_zalloc_coherent (&phba->pcidev->dev, + hw_page_size, &dmabuf->phys, +GFP_KERNEL );if (!dmabuf->virt) {kfree (dmabuf); goto out_fail; } -memset (dmabuf->virt,0 , hw_page_size); dmabuf->buffer_tag = x;list_add_tail (&dmabuf->list, &queue->page_list);/* initialize queue's entry array */
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 20/26 megaraid: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +3 -6
@@ -608,10 +608,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) goto fail_get_cmd; } - IOCInitMessage = -dma_alloc_coherent (&instance->pdev->dev, -sizeof (struct MPI2_IOC_INIT_REQUEST ), - &ioc_init_handle,GFP_KERNEL ); + IOCInitMessage =dma_zalloc_coherent (&instance->pdev->dev, +sizeof (struct MPI2_IOC_INIT_REQUEST ), + &ioc_init_handle,GFP_KERNEL );if (!IOCInitMessage) { printk(KERN_ERR "Could not allocate memory for "
@@ -620,8 +619,6 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) goto fail_fw_init; } -memset (IOCInitMessage,0 ,sizeof (struct MPI2_IOC_INIT_REQUEST )); - IOCInitMessage->Function =MPI2_FUNCTION_IOC_INIT ; IOCInitMessage->WhoInit =MPI2_WHOINIT_HOST_DRIVER ; IOCInitMessage->MsgVersion =cpu_to_le16 (MPI2_VERSION );
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 21/26 mvsas: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/scsi/mvsas/mv_init.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
drivers/scsi/mvsas/mv_init.c +11 -15
@@ -263,33 +263,29 @@ static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)/* * alloc and init our DMA areas */ - mvi->tx =dma_alloc_coherent (mvi->dev, -sizeof (*mvi->tx) *MVS_CHIP_SLOT_SZ , - &mvi->tx_dma,GFP_KERNEL ); + mvi->tx =dma_zalloc_coherent (mvi->dev, +sizeof (*mvi->tx) *MVS_CHIP_SLOT_SZ , + &mvi->tx_dma,GFP_KERNEL );if (!mvi->tx) goto err_out; -memset (mvi->tx,0 ,sizeof (*mvi->tx) *MVS_CHIP_SLOT_SZ ); - mvi->rx_fis =dma_alloc_coherent (mvi->dev,MVS_RX_FISL_SZ , - &mvi->rx_fis_dma,GFP_KERNEL ); + + mvi->rx_fis =dma_zalloc_coherent (mvi->dev,MVS_RX_FISL_SZ , + &mvi->rx_fis_dma,GFP_KERNEL );if (!mvi->rx_fis) goto err_out; -memset (mvi->rx_fis,0 ,MVS_RX_FISL_SZ ); - mvi->rx =dma_alloc_coherent (mvi->dev, -sizeof (*mvi->rx) * (MVS_RX_RING_SZ +1 ), - &mvi->rx_dma,GFP_KERNEL ); + mvi->rx =dma_zalloc_coherent (mvi->dev, +sizeof (*mvi->rx) * (MVS_RX_RING_SZ +1 ), + &mvi->rx_dma,GFP_KERNEL );if (!mvi->rx) goto err_out; -memset (mvi->rx,0 ,sizeof (*mvi->rx) * (MVS_RX_RING_SZ +1 )); mvi->rx[0 ] =cpu_to_le32 (0xfff ); mvi->rx_cons =0xfff ; - mvi->slot =dma_alloc_coherent (mvi->dev, -sizeof (*mvi->slot) * slot_nr, - &mvi->slot_dma,GFP_KERNEL ); + mvi->slot =dma_zalloc_coherent (mvi->dev,sizeof (*mvi->slot) * slot_nr, + &mvi->slot_dma,GFP_KERNEL );if (!mvi->slot) goto err_out; -memset (mvi->slot,0 ,sizeof (*mvi->slot) * slot_nr); mvi->bulk_buffer = dma_alloc_coherent(mvi->dev, TRASH_BUCKET_SIZE,
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 22/26 qla2xxx: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/scsi/qla2xxx/qla_init.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +4 -6
@@ -1526,8 +1526,8 @@ try_fce: FCE_SIZE, ha->fce, ha->fce_dma);/* Allocate memory for Fibre Channel Event Buffer. */ - tc =dma_alloc_coherent (&ha->pdev->dev,FCE_SIZE , &tc_dma, -GFP_KERNEL ); + tc =dma_zalloc_coherent (&ha->pdev->dev,FCE_SIZE , &tc_dma, +GFP_KERNEL );if (!tc) { ql_log(ql_log_warn, vha, 0x00be, "Unable to allocate (%d KB) for FCE.\n",
@@ -1535,7 +1535,6 @@ try_fce: goto try_eft; } -memset (tc,0 ,FCE_SIZE ); rval =qla2x00_enable_fce_trace (vha, tc_dma,FCE_NUM_BUFFERS , ha->fce_mb, &ha->fce_bufs);if (rval) {
@@ -1560,8 +1559,8 @@ try_eft: EFT_SIZE, ha->eft, ha->eft_dma);/* Allocate memory for Extended Trace Buffer. */ - tc =dma_alloc_coherent (&ha->pdev->dev,EFT_SIZE , &tc_dma, -GFP_KERNEL ); + tc =dma_zalloc_coherent (&ha->pdev->dev,EFT_SIZE , &tc_dma, +GFP_KERNEL );if (!tc) { ql_log(ql_log_warn, vha, 0x00c1, "Unable to allocate (%d KB) for EFT.\n",
@@ -1569,7 +1568,6 @@ try_eft: goto cont_alloc; } -memset (tc,0 ,EFT_SIZE ); rval =qla2x00_enable_eft_trace (vha, tc_dma,EFT_NUM_BUFFERS );if (rval) { ql_log(ql_log_warn, vha, 0x00c2,
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
Re: [PATCH -next 22/26] qla2xxx: Use dma_zalloc_coherent
Quoted 53 lines
Use the zeroing function instead of
dma_alloc_coherent&memset(,0,)Signed-off-by Joe Perches <[email protected]>---
drivers/scsi/qla2xxx/qla_init.c| 10 ++++------1 file changed, 4 insertions(+), 6 deletions(-)drivers/scsi/qla2xxx/qla_init.c +4
-6@@ -1526,8 +1526,8 @@ try_fce: FCE_SIZE, ha->fce, ha->fce_dma);/* Allocate memory for Fibre Channel Event Buffer. */ - tc =dma_alloc_coherent (&ha->pdev->dev,FCE_SIZE , &tc_dma, -GFP_KERNEL ); + tc =dma_zalloc_coherent (&ha->pdev->dev,FCE_SIZE , &tc_dma, +GFP_KERNEL );if (!tc) { ql_log(ql_log_warn, vha, 0x00be, "Unable to allocate (%d KB) for FCE.\n",@@ -1535,7 +1535,6 @@ try_fce: goto try_eft; } -memset (tc,0 ,FCE_SIZE ); rval =qla2x00_enable_fce_trace (vha, tc_dma,FCE_NUM_BUFFERS , ha->fce_mb, &ha->fce_bufs);if (rval) {@@ -1560,8 +1559,8 @@ try_eft: EFT_SIZE, ha->eft, ha->eft_dma);/* Allocate memory for Extended Trace Buffer. */ - tc =dma_alloc_coherent (&ha->pdev->dev,EFT_SIZE , &tc_dma, -GFP_KERNEL ); + tc =dma_zalloc_coherent (&ha->pdev->dev,EFT_SIZE , &tc_dma, +GFP_KERNEL );if (!tc) { ql_log(ql_log_warn, vha, 0x00c1, "Unable to allocate (%d KB) for EFT.\n",@@ -1569,7 +1568,6 @@ try_eft: goto cont_alloc; } -memset (tc,0 ,EFT_SIZE ); rval =qla2x00_enable_eft_trace (vha, tc_dma,EFT_NUM_BUFFERS );if (rval) { ql_log(ql_log_warn, vha, 0x00c2,Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 23/26 qla4xxx: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/scsi/qla4xxx/ql4_init.c | 5 ++--- drivers/scsi/qla4xxx/ql4_mbx.c | 21 +++++++++------------ drivers/scsi/qla4xxx/ql4_nx.c | 5 ++--- drivers/scsi/qla4xxx/ql4_os.c | 12 +++++------- 4 files changed, 18 insertions(+), 25 deletions(-)
drivers/scsi/qla4xxx/ql4_init.c +2 -3
@@ -153,15 +153,14 @@ int qla4xxx_get_sys_info(struct scsi_qla_host *ha)dma_addr_t sys_info_dma;int status =QLA_ERROR ; - sys_info =dma_alloc_coherent (&ha->pdev->dev,sizeof (*sys_info), - &sys_info_dma,GFP_KERNEL ); + sys_info =dma_zalloc_coherent (&ha->pdev->dev,sizeof (*sys_info), + &sys_info_dma,GFP_KERNEL );if (sys_info ==NULL ) {DEBUG2 (printk ("scsi%ld: %s: Unable to allocate dma buffer.\n" , ha->host_no, __func__)); goto exit_get_sys_info_no_free; } -memset (sys_info,0 ,sizeof (*sys_info));/* Get flash sys info */ if (qla4xxx_get_flash(ha, sys_info_dma, FLASH_OFFSET_SYS_INFO,
drivers/scsi/qla4xxx/ql4_mbx.c +9 -12
@@ -625,15 +625,14 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)uint32_t mbox_sts[MBOX_REG_COUNT ];int status =QLA_ERROR ; - init_fw_cb =dma_alloc_coherent (&ha->pdev->dev, -sizeof (struct addr_ctrl_blk ), - &init_fw_cb_dma,GFP_KERNEL ); + init_fw_cb =dma_zalloc_coherent (&ha->pdev->dev, +sizeof (struct addr_ctrl_blk ), + &init_fw_cb_dma,GFP_KERNEL );if (init_fw_cb ==NULL ) {DEBUG2 (printk ("scsi%ld: %s: Unable to alloc init_cb\n" , ha->host_no, __func__)); goto exit_init_fw_cb_no_free; } -memset (init_fw_cb,0 ,sizeof (struct addr_ctrl_blk ));/* Get Initialize Firmware Control Block. */ memset (&mbox_cmd,0 ,sizeof (mbox_cmd));
@@ -710,9 +709,9 @@ int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha)uint32_t mbox_cmd[MBOX_REG_COUNT ];uint32_t mbox_sts[MBOX_REG_COUNT ]; - init_fw_cb =dma_alloc_coherent (&ha->pdev->dev, -sizeof (struct addr_ctrl_blk ), - &init_fw_cb_dma,GFP_KERNEL ); + init_fw_cb =dma_zalloc_coherent (&ha->pdev->dev, +sizeof (struct addr_ctrl_blk ), + &init_fw_cb_dma,GFP_KERNEL );if (init_fw_cb ==NULL ) {printk ("scsi%ld: %s: Unable to alloc init_cb\n" , ha->host_no, __func__);
@@ -720,7 +719,6 @@ int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha) }/* Get Initialize Firmware Control Block. */ -memset (init_fw_cb,0 ,sizeof (struct addr_ctrl_blk ));if (qla4xxx_get_ifcb (ha, &mbox_cmd[0 ], &mbox_sts[0 ], init_fw_cb_dma) !=QLA_SUCCESS ) { DEBUG2(printk("scsi%ld: %s: Failed to get init_fw_ctrl_blk\n",
@@ -1342,16 +1340,15 @@ int qla4xxx_about_firmware(struct scsi_qla_host *ha)uint32_t mbox_sts[MBOX_REG_COUNT ];int status =QLA_ERROR ; - about_fw =dma_alloc_coherent (&ha->pdev->dev, -sizeof (struct about_fw_info ), - &about_fw_dma,GFP_KERNEL ); + about_fw =dma_zalloc_coherent (&ha->pdev->dev, +sizeof (struct about_fw_info ), + &about_fw_dma,GFP_KERNEL );if (!about_fw) {DEBUG2 (ql4_printk (KERN_ERR , ha,"%s: Unable to alloc memory " "for about_fw\n" , __func__));return status; } -memset (about_fw,0 ,sizeof (struct about_fw_info ));memset (&mbox_cmd,0 ,sizeof (mbox_cmd));memset (&mbox_sts,0 ,sizeof (mbox_sts));
drivers/scsi/qla4xxx/ql4_nx.c +2 -3
@@ -4050,15 +4050,14 @@ int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha)dma_addr_t sys_info_dma;int status =QLA_ERROR ; - sys_info =dma_alloc_coherent (&ha->pdev->dev,sizeof (*sys_info), - &sys_info_dma,GFP_KERNEL ); + sys_info =dma_zalloc_coherent (&ha->pdev->dev,sizeof (*sys_info), + &sys_info_dma,GFP_KERNEL );if (sys_info ==NULL ) {DEBUG2 (printk ("scsi%ld: %s: Unable to allocate dma buffer.\n" , ha->host_no, __func__));return status; } -memset (sys_info,0 ,sizeof (*sys_info));memset (&mbox_cmd,0 ,sizeof (mbox_cmd));memset (&mbox_sts,0 ,sizeof (mbox_sts));
drivers/scsi/qla4xxx/ql4_os.c +5 -7
@@ -2693,16 +2693,15 @@ qla4xxx_iface_set_param(struct Scsi_Host *shost, void *data, uint32_t len)uint32_t rem = len;struct nlattr *attr; - init_fw_cb =dma_alloc_coherent (&ha->pdev->dev, -sizeof (struct addr_ctrl_blk ), - &init_fw_cb_dma,GFP_KERNEL ); + init_fw_cb =dma_zalloc_coherent (&ha->pdev->dev, +sizeof (struct addr_ctrl_blk ), + &init_fw_cb_dma,GFP_KERNEL );if (!init_fw_cb) {ql4_printk (KERN_ERR , ha,"%s: Unable to alloc init_cb\n" , __func__);return -ENOMEM ; } -memset (init_fw_cb,0 ,sizeof (struct addr_ctrl_blk ));memset (&mbox_cmd,0 ,sizeof (mbox_cmd));memset (&mbox_sts,0 ,sizeof (mbox_sts));
@@ -4201,15 +4200,14 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha)sizeof (struct shadow_regs ) +MEM_ALIGN_VALUE + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); - ha->queues =dma_alloc_coherent (&ha->pdev->dev, ha->queues_len, - &ha->queues_dma,GFP_KERNEL ); + ha->queues =dma_zalloc_coherent (&ha->pdev->dev, ha->queues_len, + &ha->queues_dma,GFP_KERNEL );if (ha->queues ==NULL ) {ql4_printk (KERN_WARNING , ha,"Memory Allocation failed - queues.\n" ); goto mem_alloc_error_exit; } -memset (ha->queues,0 , ha->queues_len);/* * As per RISC alignment requirements -- the bus-address must be a
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
PATCH 24/26 usb: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/usb/dwc2/hcd_ddma.c | 20 +++++++------------- drivers/usb/host/uhci-hcd.c | 7 +++---- 2 files changed, 10 insertions(+), 17 deletions(-)
drivers/usb/dwc2/hcd_ddma.c +7 -13
@@ -87,17 +87,12 @@ static u16 dwc2_frame_incr_val(struct dwc2_qh *qh)static int dwc2_desc_list_alloc (struct dwc2_hsotg *hsotg,struct dwc2_qh *qh,gfp_t flags) { - qh->desc_list =dma_alloc_coherent (hsotg->dev, -sizeof (struct dwc2_hcd_dma_desc ) * -dwc2_max_desc_num (qh), &qh->desc_list_dma, - flags); - + qh->desc_list =dma_zalloc_coherent (hsotg->dev, +sizeof (struct dwc2_hcd_dma_desc ) *dwc2_max_desc_num (qh), + &qh->desc_list_dma, flags);if (!qh->desc_list)return -ENOMEM ; -memset (qh->desc_list,0 , -sizeof (struct dwc2_hcd_dma_desc ) *dwc2_max_desc_num (qh)); - qh->n_bytes =kzalloc (sizeof (u32) *dwc2_max_desc_num (qh), flags);if (!qh->n_bytes) { dma_free_coherent(hsotg->dev, sizeof(struct dwc2_hcd_dma_desc)
@@ -128,14 +123,13 @@ static int dwc2_frame_list_alloc(struct dwc2_hsotg *hsotg, gfp_t mem_flags)if (hsotg->frame_list)return 0 ; - hsotg->frame_list =dma_alloc_coherent (hsotg->dev, -4 *FRLISTEN_64_SIZE , - &hsotg->frame_list_dma, - mem_flags); + hsotg->frame_list =dma_zalloc_coherent (hsotg->dev, +4 *FRLISTEN_64_SIZE , + &hsotg->frame_list_dma, + mem_flags);if (!hsotg->frame_list)return -ENOMEM ; -memset (hsotg->frame_list,0 ,4 *FRLISTEN_64_SIZE );return 0 ; }
drivers/usb/host/uhci-hcd.c +3 -4
@@ -589,15 +589,14 @@ static int uhci_start(struct usb_hcd *hcd) uhci->dentry = dentry;#endif - uhci->frame =dma_alloc_coherent (uhci_dev (uhci), -UHCI_NUMFRAMES *sizeof (*uhci->frame), - &uhci->frame_dma_handle,0 ); + uhci->frame =dma_zalloc_coherent (uhci_dev (uhci), +UHCI_NUMFRAMES *sizeof (*uhci->frame), + &uhci->frame_dma_handle,0 );if (!uhci->frame) {dev_err (uhci_dev (uhci),"unable to allocate consistent memory for frame list\n" ); goto err_alloc_frame; } -memset (uhci->frame,0 ,UHCI_NUMFRAMES *sizeof (*uhci->frame)); uhci->frame_cpu =kcalloc (UHCI_NUMFRAMES ,sizeof (*uhci->frame_cpu),GFP_KERNEL );
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
Alan Stern
maintainerRe: [PATCH -next 24/26] usb: Use dma_zalloc_coherent
Quoted 3 lines · Joe Perches
Use the zeroing function instead of
dma_alloc_coherent&memset(,0,)Signed-off-by Joe Perches <[email protected]>
...
Quoted 5 lines
drivers/usb/host/uhci-hcd.c +0
-0
drivers/usb/host/uhci-hcd.c static int uhci_start(struct usb_hcd *hcd) · line 594
Quoted 9 lines
drivers/usb/host/uhci-hcd.c +3
-3@@ -589,15 +589,14 @@ static int uhci_start(struct usb_hcd *hcd) uhci->dentry = dentry;#endif - uhci->frame =dma_alloc_coherent (uhci_dev (uhci), -UHCI_NUMFRAMES *sizeof (*uhci->frame), - &uhci->frame_dma_handle,0 ); + uhci->frame =dma_zalloc_coherent (uhci_dev (uhci), +UHCI_NUMFRAMES *sizeof (*uhci->frame), + &uhci->frame_dma_handle,0 );
Please don't change the coding style. This file indents continuation lines by two tab stops; it doesn't align things with opening parens.
Alan Stern
Re: [PATCH -next 24/26] usb: Use dma_zalloc_coherent
Quoted 16 lines · Alan Stern
Quoted 3 lines · Joe Perches
Use the zeroing function instead of
dma_alloc_coherent&memset(,0,)Signed-off-by Joe Perches <[email protected]>...
Quoted 8 lines
drivers/usb/host/uhci-hcd.c +0
-0@@ -589,15 +589,14 @@ static int uhci_start(struct usb_hcd *hcd) uhci->dentry = dentry;#endif
Quoted 9 lines
drivers/usb/host/uhci-hcd.c static int uhci_start(struct usb_hcd *hcd) · line 594
Quoted 6 lines
drivers/usb/host/uhci-hcd.c +3
-3- uhci->frame =dma_alloc_coherent (uhci_dev (uhci), -UHCI_NUMFRAMES *sizeof (*uhci->frame), - &uhci->frame_dma_handle,0 ); + uhci->frame =dma_zalloc_coherent (uhci_dev (uhci), +UHCI_NUMFRAMES *sizeof (*uhci->frame), + &uhci->frame_dma_handle,0 );Please don't change the coding style. This file indents continuation lines by two tab stops; it doesn't align things with opening parens.
Convert it to style of your choice.
Anyway, there are a lot of instances of alignment to parens in drivers/usb/ than not.
Also, that last argument 0 should be GFP_KERNEL
RE: [PATCH -next 24/26] usb: Use dma_zalloc_coherent
In reply to Joe PerchesQuoted 17 lines
From: Joe Perches [mailto:[email protected]]
Sent: Sunday, June 15, 2014 1:38 PMUse the zeroing function instead of
dma_alloc_coherent&memset(,0,)Signed-off-by Joe Perches <[email protected]>--- drivers/usb/dwc2/hcd_ddma.c | 20 +++++++------------- drivers/usb/host/uhci-hcd.c | 7 +++---- 2 files changed, 10 insertions(+), 17 deletions(-)drivers/usb/dwc2/hcd_ddma.c +0
-0@@ -87,17 +87,12 @@ static u16 dwc2_frame_incr_val(struct dwc2_qh *qh) static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
drivers/usb/dwc2/hcd_ddma.c static u16 dwc2_frame_incr_val(struct dwc2_qh *qh) · line 92
Quoted 10 lines
drivers/usb/dwc2/hcd_ddma.c +3
-5gfp_t flags) { - qh->desc_list =dma_alloc_coherent (hsotg->dev, -sizeof (struct dwc2_hcd_dma_desc ) * -dwc2_max_desc_num (qh), &qh->desc_list_dma, - flags); - + qh->desc_list =dma_zalloc_coherent (hsotg->dev, +sizeof (struct dwc2_hcd_dma_desc ) *dwc2_max_desc_num (qh), + &qh->desc_list_dma, flags);
This will cause checkpatch to complain about a too-long line, surely? If you fix that, you can add my acked-by for the dwc2 parts.
Signature · 1 line
Paul
Re: [PATCH -next 24/26] usb: Use dma_zalloc_coherent
Quoted 21 lines · Paul Zimmerman
Quoted 21 lines
From: Joe Perches [mailto:[email protected]]
Sent: Sunday, June 15, 2014 1:38 PMUse the zeroing function instead of
dma_alloc_coherent&memset(,0,)Signed-off-by Joe Perches <[email protected]>--- drivers/usb/dwc2/hcd_ddma.c | 20 +++++++------------- drivers/usb/host/uhci-hcd.c | 7 +++---- 2 files changed, 10 insertions(+), 17 deletions(-)drivers/usb/dwc2/hcd_ddma.c +0
-2@@ -87,17 +87,12 @@ static u16 dwc2_frame_incr_val(struct dwc2_qh *qh)static int dwc2_desc_list_alloc (struct dwc2_hsotg *hsotg,struct dwc2_qh *qh,gfp_t flags) { - qh->desc_list = dma_alloc_coherent(hsotg->dev, - sizeof(struct dwc2_hcd_dma_desc) *
Quoted 8 lines
drivers/usb/dwc2/hcd_ddma.c static u16 dwc2_frame_incr_val(struct dwc2_qh *qh) · line 92
Quoted 6 lines
drivers/usb/dwc2/hcd_ddma.c +3
-3-dwc2_max_desc_num (qh), &qh->desc_list_dma, - flags); - + qh->desc_list =dma_zalloc_coherent (hsotg->dev, +sizeof (struct dwc2_hcd_dma_desc ) *dwc2_max_desc_num (qh), + &qh->desc_list_dma, flags);This will cause checkpatch to complain about a too-long line, surely?
Hi Paul.
It does and I don't care.
Quoted 1 line
If you fix that, you can add my acked-by for the dwc2 parts.
If you care that much, I can fix it for you, but I think it's better as a long line.
PATCH 25/26 fbdev: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- drivers/video/fbdev/da8xx-fb.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/video/fbdev/da8xx-fb.c +3 -6
@@ -1447,18 +1447,15 @@ static int fb_probe(struct platform_device *device) da8xx_fb_fix.line_length -1 ;/* allocate palette buffer */ - par->v_palette_base =dma_alloc_coherent (NULL , -PALETTE_SIZE , - (resource_size_t *) - &par->p_palette_base, -GFP_KERNEL |GFP_DMA ); + par->v_palette_base =dma_zalloc_coherent (NULL ,PALETTE_SIZE , + (resource_size_t *)&par->p_palette_base, +GFP_KERNEL |GFP_DMA );if (!par->v_palette_base) {dev_err (&device->dev,"GLCD: kmalloc for palette buffer failed\n" ); ret = -EINVAL ; goto err_release_fb_mem; } -memset (par->v_palette_base,0 ,PALETTE_SIZE ); par->irq =platform_get_irq (device,0 );if (par->irq <0 ) {
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
Re: [PATCH -next 25/26] fbdev: Use dma_zalloc_coherent
Quoted 5 lines · Joe Perches
drivers/video/fbdev/da8xx-fb.c +0
-0
drivers/video/fbdev/da8xx-fb.c static int fb_probe(struct platform_device *device) · line 1451
Quoted 10 lines
drivers/video/fbdev/da8xx-fb.c +2
-5@@ -1447,18 +1447,15 @@ static int fb_probe(struct platform_device *device) da8xx_fb_fix.line_length -1 ;/* allocate palette buffer */ - par->v_palette_base =dma_alloc_coherent (NULL , -PALETTE_SIZE , - (resource_size_t *) - &par->p_palette_base, -GFP_KERNEL |GFP_DMA ); + par->v_palette_base = dma_zalloc_coherent(NULL, PALETTE_SIZE, + (resource_size_t *)&par->p_palette_base,
Suggestion for further cleanup: It seems this cast is no longer needed.
drivers/video/fbdev/da8xx-fb.c static int fb_probe(struct platform_device *device) · line 1452
Quoted 1 line
drivers/video/fbdev/da8xx-fb.c +1
-0+ GFP_KERNEL | GFP_DMA);
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH -next 25/26] fbdev: Use dma_zalloc_coherent
Quoted 2 lines · Geert Uytterhoeven
drivers/video/fbdev/da8xx-fb.c
Quoted 1 line · Joe Perches
drivers/video/fbdev/da8xx-fb.c +0
-0
[]
Quoted 13 lines
drivers/video/fbdev/da8xx-fb.c static int fb_probe(struct platform_device *device) · line 1451
Quoted 11 lines
drivers/video/fbdev/da8xx-fb.c +2
-5@@ -1447,18 +1447,15 @@ static int fb_probe(struct platform_device *device) da8xx_fb_fix.line_length -1 ;/* allocate palette buffer */ - par->v_palette_base =dma_alloc_coherent (NULL , -PALETTE_SIZE , - (resource_size_t *) - &par->p_palette_base, -GFP_KERNEL |GFP_DMA ); + par->v_palette_base = dma_zalloc_coherent(NULL, PALETTE_SIZE, + (resource_size_t *)&par->p_palette_base,Suggestion for further cleanup: It seems this cast is no longer needed.
Sure, but after this is applied.
Re: [PATCH -next 25/26] fbdev: Use dma_zalloc_coherent
In reply to Joe PerchesQuoted 24 lines · Joe Perches
Use the zeroing function instead of
dma_alloc_coherent&memset(,0,)Signed-off-by Joe Perches <[email protected]>--- drivers/video/fbdev/da8xx-fb.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)drivers/video/fbdev/da8xx-fb.c +3
-5@@ -1447,18 +1447,15 @@ static int fb_probe(struct platform_device *device) da8xx_fb_fix.line_length -1 ;/* allocate palette buffer */ - par->v_palette_base =dma_alloc_coherent (NULL , -PALETTE_SIZE , - (resource_size_t *) - &par->p_palette_base, -GFP_KERNEL |GFP_DMA ); + par->v_palette_base =dma_zalloc_coherent (NULL ,PALETTE_SIZE , + (resource_size_t *)&par->p_palette_base, +GFP_KERNEL |GFP_DMA );
drivers/video/fbdev/da8xx-fb.c static int fb_probe(struct platform_device *device) · line 1461
Quoted 10 lines
drivers/video/fbdev/da8xx-fb.c +0
-1if (!par->v_palette_base) {dev_err (&device->dev,"GLCD: kmalloc for palette buffer failed\n" ); ret = -EINVAL ; goto err_release_fb_mem; } -memset (par->v_palette_base,0 ,PALETTE_SIZE ); par->irq =platform_get_irq (device,0 );if (par->irq <0 ) {
Thanks, queued for 3.17.
Tomi
PATCH 26/26 sound: Use dma_zalloc_coherent
In reply to Joe PerchesUse the zeroing function instead of dma_alloc_coherent & memset(,0,)
--- sound/aoa/soundbus/i2sbus/core.c | 12 ++++-------- sound/sparc/dbri.c | 6 ++---- 2 files changed, 6 insertions(+), 12 deletions(-)
sound/aoa/soundbus/i2sbus/core.c +4 -8
@@ -47,15 +47,11 @@ static int alloc_dbdma_descriptor_ring(struct i2sbus_dev *i2sdev,/* We use the PCI APIs for now until the generic one gets fixed * enough or until we get some macio-specific versions */ - r->space =dma_alloc_coherent ( - &macio_get_pci_dev (i2sdev->macio)->dev, - r->size, - &r->bus_addr, -GFP_KERNEL ); + r->space =dma_zalloc_coherent (&macio_get_pci_dev (i2sdev->macio)->dev, + r->size, &r->bus_addr,GFP_KERNEL ); +if (!r->space) +return -ENOMEM ; -if (!r->space)return -ENOMEM ; - -memset (r->space,0 , r->size); r->cmds = (void *)DBDMA_ALIGN (r->space); r->bus_cmd_start = r->bus_addr + (dma_addr_t)((char *)r->cmds - (char *)r->space);
sound/sparc/dbri.c +2 -4
@@ -2534,12 +2534,10 @@ static int snd_dbri_create(struct snd_card *card, dbri->op = op; dbri->irq = irq; - dbri->dma =dma_alloc_coherent (&op->dev, -sizeof (struct dbri_dma ), - &dbri->dma_dvma,GFP_ATOMIC ); + dbri->dma =dma_zalloc_coherent (&op->dev,sizeof (struct dbri_dma ), + &dbri->dma_dvma,GFP_ATOMIC );if (!dbri->dma)return -ENOMEM ; -memset ((void *)dbri->dma,0 ,sizeof (struct dbri_dma ));dprintk (D_GEN ,"DMA Cmd Block 0x%p (0x%08x)\n" , dbri->dma, dbri->dma_dvma);
Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty
Takashi Iwai
AppliedRe: [PATCH -next 26/26] sound: Use dma_zalloc_coherent
At Sun, 15 Jun 2014 13:37:55 -0700,
Quoted 4 lines · Joe Perches
Use the zeroing function instead of
dma_alloc_coherent&memset(,0,)Signed-off-by Joe Perches <[email protected]>
Applied, thanks.
Takashi
Quoted 51 lines
--- sound/aoa/soundbus/i2sbus/core.c | 12 ++++-------- sound/sparc/dbri.c | 6 ++---- 2 files changed, 6 insertions(+), 12 deletions(-)sound/aoa/soundbus/i2sbus/core.c +4
-8@@ -47,15 +47,11 @@ static int alloc_dbdma_descriptor_ring(struct i2sbus_dev *i2sdev,/* We use the PCI APIs for now until the generic one gets fixed * enough or until we get some macio-specific versions */ - r->space =dma_alloc_coherent ( - &macio_get_pci_dev (i2sdev->macio)->dev, - r->size, - &r->bus_addr, -GFP_KERNEL ); + r->space =dma_zalloc_coherent (&macio_get_pci_dev (i2sdev->macio)->dev, + r->size, &r->bus_addr,GFP_KERNEL ); +if (!r->space) +return -ENOMEM ; -if (!r->space)return -ENOMEM ; - -memset (r->space,0 , r->size); r->cmds = (void *)DBDMA_ALIGN (r->space); r->bus_cmd_start = r->bus_addr + (dma_addr_t)((char *)r->cmds - (char *)r->space);sound/sparc/dbri.c +2
-4@@ -2534,12 +2534,10 @@ static int snd_dbri_create(struct snd_card *card, dbri->op = op; dbri->irq = irq; - dbri->dma =dma_alloc_coherent (&op->dev, -sizeof (struct dbri_dma ), - &dbri->dma_dvma,GFP_ATOMIC ); + dbri->dma =dma_zalloc_coherent (&op->dev,sizeof (struct dbri_dma ), + &dbri->dma_dvma,GFP_ATOMIC );if (!dbri->dma)return -ENOMEM ; -memset ((void *)dbri->dma,0 ,sizeof (struct dbri_dma ));dprintk (D_GEN ,"DMA Cmd Block 0x%p (0x%08x)\n" , dbri->dma, dbri->dma_dvma);Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty