Commit 66c56cfa authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'remove-dma_zalloc_coherent-5.0' of git://git.infradead.org/users/hch/dma-mapping

Pull dma_zalloc_coherent() removal from Christoph Hellwig:
 "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"

* tag 'remove-dma_zalloc_coherent-5.0' of git://git.infradead.org/users/hch/dma-mapping:
  dma-mapping: remove dma_zalloc_coherent()
  cross-tree: phase out dma_zalloc_coherent() on headers
  cross-tree: phase out dma_zalloc_coherent()
parents 47334889 dfd32cad
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ ltq_dma_alloc(struct ltq_dma_channel *ch)
	unsigned long flags;

	ch->desc = 0;
	ch->desc_base = dma_zalloc_coherent(ch->dev,
	ch->desc_base = dma_alloc_coherent(ch->dev,
					   LTQ_DESC_NUM * LTQ_DESC_SIZE,
					   &ch->phys, GFP_ATOMIC);

+1 −1
Original line number Diff line number Diff line
@@ -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);

+4 −3
Original line number Diff line number Diff line
@@ -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.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.phys,
						   GFP_KERNEL);
	if (!rmu->msg_tx_ring.virt) {
		rc = -ENOMEM;
		goto out_dma;
+2 −2
Original line number Diff line number Diff line
@@ -729,7 +729,7 @@ 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,
	mem = dma_alloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma,
				 GFP_KERNEL);
	if (!mem) {
		kfree(pp);
+19 −20
Original line number Diff line number Diff line
@@ -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,
	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);
						&he_dev->tpdrq_phys,
						GFP_KERNEL);
	if (he_dev->tpdrq_base == NULL) {
		hprintk("failed to alloc tpdrq\n");
		return -ENOMEM;
@@ -805,7 +806,7 @@ 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,
	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) {
@@ -844,7 +845,7 @@ 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,
	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) {
@@ -868,7 +869,7 @@ 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,
	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) {
@@ -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,7 +1463,7 @@ static int he_start(struct atm_dev *dev)

	/* host status page */

	he_dev->hsp = dma_zalloc_coherent(&he_dev->pci_dev->dev,
	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) {
Loading