Skip to content

Commit 750afb0

Browse files
mcgrofChristoph Hellwig
authored andcommitted
cross-tree: phase out dma_zalloc_coherent()
We already need to zero out memory for dma_alloc_coherent(), as such using dma_zalloc_coherent() is superflous. Phase it out. This change was generated with the following Coccinelle SmPL patch: @ replace_dma_zalloc_coherent @ expression dev, size, data, handle, flags; @@ -dma_zalloc_coherent(dev, size, handle, flags) +dma_alloc_coherent(dev, size, handle, flags) Suggested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> [hch: re-ran the script on the latest tree] Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 3bd6e94 commit 750afb0

173 files changed

Lines changed: 915 additions & 949 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/mips/lantiq/xway/dma.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ ltq_dma_alloc(struct ltq_dma_channel *ch)
129129
unsigned long flags;
130130

131131
ch->desc = 0;
132-
ch->desc_base = dma_zalloc_coherent(ch->dev,
133-
LTQ_DESC_NUM * LTQ_DESC_SIZE,
134-
&ch->phys, GFP_ATOMIC);
132+
ch->desc_base = dma_alloc_coherent(ch->dev,
133+
LTQ_DESC_NUM * LTQ_DESC_SIZE,
134+
&ch->phys, GFP_ATOMIC);
135135

136136
spin_lock_irqsave(&ltq_dma_lock, flags);
137137
ltq_dma_w32(ch->nr, LTQ_DMA_CS);

‎arch/powerpc/platforms/pasemi/dma_lib.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size)
255255

256256
chan->ring_size = ring_size;
257257

258-
chan->ring_virt = dma_zalloc_coherent(&dma_pdev->dev,
258+
chan->ring_virt = dma_alloc_coherent(&dma_pdev->dev,
259259
ring_size * sizeof(u64),
260260
&chan->ring_dma, GFP_KERNEL);
261261

‎arch/powerpc/sysdev/fsl_rmu.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,9 +756,10 @@ fsl_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries)
756756
}
757757

758758
/* Initialize outbound message descriptor ring */
759-
rmu->msg_tx_ring.virt = dma_zalloc_coherent(priv->dev,
760-
rmu->msg_tx_ring.size * RIO_MSG_DESC_SIZE,
761-
&rmu->msg_tx_ring.phys, GFP_KERNEL);
759+
rmu->msg_tx_ring.virt = dma_alloc_coherent(priv->dev,
760+
rmu->msg_tx_ring.size * RIO_MSG_DESC_SIZE,
761+
&rmu->msg_tx_ring.phys,
762+
GFP_KERNEL);
762763
if (!rmu->msg_tx_ring.virt) {
763764
rc = -ENOMEM;
764765
goto out_dma;

‎drivers/ata/sata_fsl.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,8 @@ static int sata_fsl_port_start(struct ata_port *ap)
729729
if (!pp)
730730
return -ENOMEM;
731731

732-
mem = dma_zalloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma,
733-
GFP_KERNEL);
732+
mem = dma_alloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma,
733+
GFP_KERNEL);
734734
if (!mem) {
735735
kfree(pp);
736736
return -ENOMEM;

‎drivers/atm/he.c‎

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,10 @@ static void he_init_tx_lbfp(struct he_dev *he_dev)
533533

534534
static int he_init_tpdrq(struct he_dev *he_dev)
535535
{
536-
he_dev->tpdrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
537-
CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq),
538-
&he_dev->tpdrq_phys, GFP_KERNEL);
536+
he_dev->tpdrq_base = dma_alloc_coherent(&he_dev->pci_dev->dev,
537+
CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq),
538+
&he_dev->tpdrq_phys,
539+
GFP_KERNEL);
539540
if (he_dev->tpdrq_base == NULL) {
540541
hprintk("failed to alloc tpdrq\n");
541542
return -ENOMEM;
@@ -805,9 +806,9 @@ static int he_init_group(struct he_dev *he_dev, int group)
805806
goto out_free_rbpl_virt;
806807
}
807808

808-
he_dev->rbpl_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
809-
CONFIG_RBPL_SIZE * sizeof(struct he_rbp),
810-
&he_dev->rbpl_phys, GFP_KERNEL);
809+
he_dev->rbpl_base = dma_alloc_coherent(&he_dev->pci_dev->dev,
810+
CONFIG_RBPL_SIZE * sizeof(struct he_rbp),
811+
&he_dev->rbpl_phys, GFP_KERNEL);
811812
if (he_dev->rbpl_base == NULL) {
812813
hprintk("failed to alloc rbpl_base\n");
813814
goto out_destroy_rbpl_pool;
@@ -844,9 +845,9 @@ static int he_init_group(struct he_dev *he_dev, int group)
844845

845846
/* rx buffer ready queue */
846847

847-
he_dev->rbrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
848-
CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq),
849-
&he_dev->rbrq_phys, GFP_KERNEL);
848+
he_dev->rbrq_base = dma_alloc_coherent(&he_dev->pci_dev->dev,
849+
CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq),
850+
&he_dev->rbrq_phys, GFP_KERNEL);
850851
if (he_dev->rbrq_base == NULL) {
851852
hprintk("failed to allocate rbrq\n");
852853
goto out_free_rbpl;
@@ -868,9 +869,9 @@ static int he_init_group(struct he_dev *he_dev, int group)
868869

869870
/* tx buffer ready queue */
870871

871-
he_dev->tbrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
872-
CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
873-
&he_dev->tbrq_phys, GFP_KERNEL);
872+
he_dev->tbrq_base = dma_alloc_coherent(&he_dev->pci_dev->dev,
873+
CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
874+
&he_dev->tbrq_phys, GFP_KERNEL);
874875
if (he_dev->tbrq_base == NULL) {
875876
hprintk("failed to allocate tbrq\n");
876877
goto out_free_rbpq_base;
@@ -913,11 +914,9 @@ static int he_init_irq(struct he_dev *he_dev)
913914
/* 2.9.3.5 tail offset for each interrupt queue is located after the
914915
end of the interrupt queue */
915916

916-
he_dev->irq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
917-
(CONFIG_IRQ_SIZE + 1)
918-
* sizeof(struct he_irq),
919-
&he_dev->irq_phys,
920-
GFP_KERNEL);
917+
he_dev->irq_base = dma_alloc_coherent(&he_dev->pci_dev->dev,
918+
(CONFIG_IRQ_SIZE + 1) * sizeof(struct he_irq),
919+
&he_dev->irq_phys, GFP_KERNEL);
921920
if (he_dev->irq_base == NULL) {
922921
hprintk("failed to allocate irq\n");
923922
return -ENOMEM;
@@ -1464,9 +1463,9 @@ static int he_start(struct atm_dev *dev)
14641463

14651464
/* host status page */
14661465

1467-
he_dev->hsp = dma_zalloc_coherent(&he_dev->pci_dev->dev,
1468-
sizeof(struct he_hsp),
1469-
&he_dev->hsp_phys, GFP_KERNEL);
1466+
he_dev->hsp = dma_alloc_coherent(&he_dev->pci_dev->dev,
1467+
sizeof(struct he_hsp),
1468+
&he_dev->hsp_phys, GFP_KERNEL);
14701469
if (he_dev->hsp == NULL) {
14711470
hprintk("failed to allocate host status page\n");
14721471
return -ENOMEM;

‎drivers/atm/idt77252.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,8 @@ alloc_scq(struct idt77252_dev *card, int class)
641641
scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL);
642642
if (!scq)
643643
return NULL;
644-
scq->base = dma_zalloc_coherent(&card->pcidev->dev, SCQ_SIZE,
645-
&scq->paddr, GFP_KERNEL);
644+
scq->base = dma_alloc_coherent(&card->pcidev->dev, SCQ_SIZE,
645+
&scq->paddr, GFP_KERNEL);
646646
if (scq->base == NULL) {
647647
kfree(scq);
648648
return NULL;
@@ -971,8 +971,8 @@ init_rsq(struct idt77252_dev *card)
971971
{
972972
struct rsq_entry *rsqe;
973973

974-
card->rsq.base = dma_zalloc_coherent(&card->pcidev->dev, RSQSIZE,
975-
&card->rsq.paddr, GFP_KERNEL);
974+
card->rsq.base = dma_alloc_coherent(&card->pcidev->dev, RSQSIZE,
975+
&card->rsq.paddr, GFP_KERNEL);
976976
if (card->rsq.base == NULL) {
977977
printk("%s: can't allocate RSQ.\n", card->name);
978978
return -1;
@@ -3390,10 +3390,10 @@ static int init_card(struct atm_dev *dev)
33903390
writel(0, SAR_REG_GP);
33913391

33923392
/* Initialize RAW Cell Handle Register */
3393-
card->raw_cell_hnd = dma_zalloc_coherent(&card->pcidev->dev,
3394-
2 * sizeof(u32),
3395-
&card->raw_cell_paddr,
3396-
GFP_KERNEL);
3393+
card->raw_cell_hnd = dma_alloc_coherent(&card->pcidev->dev,
3394+
2 * sizeof(u32),
3395+
&card->raw_cell_paddr,
3396+
GFP_KERNEL);
33973397
if (!card->raw_cell_hnd) {
33983398
printk("%s: memory allocation failure.\n", card->name);
33993399
deinit_card(card);

‎drivers/block/skd_main.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,8 +2641,8 @@ static int skd_cons_skcomp(struct skd_device *skdev)
26412641
"comp pci_alloc, total bytes %zd entries %d\n",
26422642
SKD_SKCOMP_SIZE, SKD_N_COMPLETION_ENTRY);
26432643

2644-
skcomp = dma_zalloc_coherent(&skdev->pdev->dev, SKD_SKCOMP_SIZE,
2645-
&skdev->cq_dma_address, GFP_KERNEL);
2644+
skcomp = dma_alloc_coherent(&skdev->pdev->dev, SKD_SKCOMP_SIZE,
2645+
&skdev->cq_dma_address, GFP_KERNEL);
26462646

26472647
if (skcomp == NULL) {
26482648
rc = -ENOMEM;

‎drivers/crypto/amcc/crypto4xx_core.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ static u32 crypto4xx_put_pd_to_pdr(struct crypto4xx_device *dev, u32 idx)
283283
*/
284284
static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev)
285285
{
286-
dev->gdr = dma_zalloc_coherent(dev->core_dev->device,
287-
sizeof(struct ce_gd) * PPC4XX_NUM_GD,
288-
&dev->gdr_pa, GFP_ATOMIC);
286+
dev->gdr = dma_alloc_coherent(dev->core_dev->device,
287+
sizeof(struct ce_gd) * PPC4XX_NUM_GD,
288+
&dev->gdr_pa, GFP_ATOMIC);
289289
if (!dev->gdr)
290290
return -ENOMEM;
291291

‎drivers/crypto/cavium/cpt/cptpf_main.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae)
278278
mcode->num_cores = is_ae ? 6 : 10;
279279

280280
/* Allocate DMAable space */
281-
mcode->code = dma_zalloc_coherent(&cpt->pdev->dev, mcode->code_size,
282-
&mcode->phys_base, GFP_KERNEL);
281+
mcode->code = dma_alloc_coherent(&cpt->pdev->dev, mcode->code_size,
282+
&mcode->phys_base, GFP_KERNEL);
283283
if (!mcode->code) {
284284
dev_err(dev, "Unable to allocate space for microcode");
285285
ret = -ENOMEM;

‎drivers/crypto/cavium/cpt/cptvf_main.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,10 @@ static int alloc_command_queues(struct cpt_vf *cptvf,
236236

237237
c_size = (rem_q_size > qcsize_bytes) ? qcsize_bytes :
238238
rem_q_size;
239-
curr->head = (u8 *)dma_zalloc_coherent(&pdev->dev,
240-
c_size + CPT_NEXT_CHUNK_PTR_SIZE,
241-
&curr->dma_addr, GFP_KERNEL);
239+
curr->head = (u8 *)dma_alloc_coherent(&pdev->dev,
240+
c_size + CPT_NEXT_CHUNK_PTR_SIZE,
241+
&curr->dma_addr,
242+
GFP_KERNEL);
242243
if (!curr->head) {
243244
dev_err(&pdev->dev, "Command Q (%d) chunk (%d) allocation failed\n",
244245
i, queue->nchunks);

0 commit comments

Comments
 (0)