Skip to contentSkip to conversation

: sparc: Convert all SBUS drivers to dma_*()

PATCH In review David Miller 1 participant 1 message Aug 28, 2008

Subsystems (5)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 9/49 : sparc: Convert all SBUS drivers to dma_*()

sparc: Convert all SBUS drivers to dma_*() interfaces.

And all the SBUS dma interfaces are deleted.

A private implementation remains inside of the 32-bit sparc port which exists only for the sake of the implementation of dma_*().

---
 arch/sparc/include/asm/sbus_32.h    |   17 -------
 arch/sparc/include/asm/sbus_64.h    |   63 --------------------------
 arch/sparc/kernel/sparc_ksyms.c     |    8 ---
 arch/sparc64/kernel/sparc64_ksyms.c |    8 ---
 drivers/atm/fore200e.c              |   16 +++---
 drivers/net/myri_sbus.c             |   63 +++++++++++++-------------
 drivers/net/sunbmac.c               |   68 ++++++++++++++-------------
 drivers/net/sunhme.c                |   85 ++++++++++++++---------------------
 drivers/net/sunlance.c              |   15 +++---
 drivers/net/sunqe.c                 |   45 +++++++++---------
 drivers/scsi/qlogicpti.c            |   53 +++++++++++-----------
 drivers/scsi/sun_esp.c              |   26 ++++++-----
 sound/core/memalloc.c               |    8 ++--
 sound/sparc/dbri.c                  |   41 +++++++++--------
 14 files changed, 206 insertions(+), 310 deletions(-)
arch/sparc/include/asm/sbus_32.h +0 -17
index 61d99f1..b09284b 100644
@@ -109,26 +109,9 @@ extern void sbus_set_sbus64(struct sbus_dev *, int);
 extern void sbus_fill_device_irq(struct sbus_dev *);
 
 /* These yield IOMMU mappings in consistent mode. */
-extern void *sbus_alloc_consistent(struct device *, long, u32 *dma_addrp);
-extern void sbus_free_consistent(struct device *, long, void *, u32);
 void prom_adjust_ranges(struct linux_prom_ranges *, int,
 			struct linux_prom_ranges *, int);
 
-#define SBUS_DMA_BIDIRECTIONAL	DMA_BIDIRECTIONAL
-#define SBUS_DMA_TODEVICE	DMA_TO_DEVICE
-#define SBUS_DMA_FROMDEVICE	DMA_FROM_DEVICE
-#define	SBUS_DMA_NONE		DMA_NONE
-
-/* All the rest use streaming mode mappings. */
-extern dma_addr_t sbus_map_single(struct device *, void *, size_t, int);
-extern void sbus_unmap_single(struct device *, dma_addr_t, size_t, int);
-extern int sbus_map_sg(struct device *, struct scatterlist *, int, int);
-extern void sbus_unmap_sg(struct device *, struct scatterlist *, int, int);
-
-/* Finally, allow explicit synchronization of streamable mappings. */
-extern void sbus_dma_sync_single_for_cpu(struct device *, dma_addr_t, size_t, int);
-extern void sbus_dma_sync_single_for_device(struct device *, dma_addr_t, size_t, int);
-
 /* Eric Brower ([email protected])
  * Translate SBus interrupt levels to ino values--
  * this is used when converting sbus "interrupts" OBP
arch/sparc/include/asm/sbus_64.h +0 -63

69 lines not on this page · raw message

arch/sparc/kernel/sparc_ksyms.c +0 -8
index 9d85a83..b1d2c97 100644
@@ -155,14 +155,6 @@ EXPORT_SYMBOL(BTFIXUP_CALL(pgprot_noncached));
 #ifdef CONFIG_SBUS
 EXPORT_SYMBOL(sbus_root);
 EXPORT_SYMBOL(sbus_set_sbus64);
-EXPORT_SYMBOL(sbus_alloc_consistent);
-EXPORT_SYMBOL(sbus_free_consistent);
-EXPORT_SYMBOL(sbus_map_single);
-EXPORT_SYMBOL(sbus_unmap_single);
-EXPORT_SYMBOL(sbus_map_sg);
-EXPORT_SYMBOL(sbus_unmap_sg);
-EXPORT_SYMBOL(sbus_dma_sync_single_for_cpu);
-EXPORT_SYMBOL(sbus_dma_sync_single_for_device);
 EXPORT_SYMBOL(sbus_iounmap);
 EXPORT_SYMBOL(sbus_ioremap);
 #endif
arch/sparc64/kernel/sparc64_ksyms.c +0 -8
index 1c56c8b..901c264 100644
@@ -162,14 +162,6 @@ EXPORT_SYMBOL(auxio_set_lte);
 #ifdef CONFIG_SBUS
 EXPORT_SYMBOL(sbus_root);
 EXPORT_SYMBOL(sbus_set_sbus64);
-EXPORT_SYMBOL(sbus_alloc_consistent);
-EXPORT_SYMBOL(sbus_free_consistent);
-EXPORT_SYMBOL(sbus_map_single);
-EXPORT_SYMBOL(sbus_unmap_single);
-EXPORT_SYMBOL(sbus_map_sg);
-EXPORT_SYMBOL(sbus_unmap_sg);
-EXPORT_SYMBOL(sbus_dma_sync_single_for_cpu);
-EXPORT_SYMBOL(sbus_dma_sync_single_for_device);
 #endif
 EXPORT_SYMBOL(outsb);
 EXPORT_SYMBOL(outsw);
drivers/atm/fore200e.c +8 -8
index c5ab44f..f607e59 100644
@@ -680,7 +680,7 @@ fore200e_sba_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int d
 {
     struct sbus_dev *sdev = fore200e->bus_dev;
     struct device *dev = &sdev->ofdev.dev;
-    u32 dma_addr = sbus_map_single(dev, virt_addr, size, direction);
+    u32 dma_addr = dma_map_single(dev, virt_addr, size, direction);
 
     DPRINTK(3, "SBUS DVMA mapping: virt_addr = 0x%p, size = %d, direction = %d --> dma_addr = 0x%08x\n",
 	    virt_addr, size, direction, dma_addr);
@@ -698,7 +698,7 @@ fore200e_sba_dma_unmap(struct fore200e* fore200e, u32 dma_addr, int size, int di
     DPRINTK(3, "SBUS DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d,\n",
 	    dma_addr, size, direction);
 
-    sbus_unmap_single(dev, dma_addr, size, direction);
+    dma_unmap_single(dev, dma_addr, size, direction);
 }
 
 
@@ -710,7 +710,7 @@ fore200e_sba_dma_sync_for_cpu(struct fore200e* fore200e, u32 dma_addr, int size,
 
     DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction);
     
-    sbus_dma_sync_single_for_cpu(dev, dma_addr, size, direction);
+    dma_sync_single_for_cpu(dev, dma_addr, size, direction);
 }
 
 static void
@@ -721,7 +721,7 @@ fore200e_sba_dma_sync_for_device(struct fore200e* fore200e, u32 dma_addr, int si
 
     DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction);
 
-    sbus_dma_sync_single_for_device(dev, dma_addr, size, direction);
+    dma_sync_single_for_device(dev, dma_addr, size, direction);
 }
 
 
@@ -738,8 +738,8 @@ fore200e_sba_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk,
     chunk->alloc_size = chunk->align_size = size * nbr;
 
     /* returned chunks are page-aligned */
-    chunk->alloc_addr = sbus_alloc_consistent(dev, chunk->alloc_size,
-					      &chunk->dma_addr);
+    chunk->alloc_addr = dma_alloc_coherent(dev, chunk->alloc_size,
+					   &chunk->dma_addr, GFP_ATOMIC);
 
     if ((chunk->alloc_addr = NULL) || (chunk->dma_addr = 0))
 	return -ENOMEM;
@@ -758,8 +758,8 @@ fore200e_sba_dma_chunk_free(struct fore200e* fore200e, struct chunk* chunk)
     struct sbus_dev *sdev = (struct sbus_dev *) fore200e->bus_dev;
     struct device *dev = &sdev->ofdev.dev;
 
-    sbus_free_consistent(dev, chunk->alloc_size,
-			 chunk->alloc_addr, chunk->dma_addr);
+    dma_free_coherent(dev, chunk->alloc_size,
+		      chunk->alloc_addr, chunk->dma_addr);
 }
 
 
drivers/net/myri_sbus.c +32 -31

125 lines not on this page · raw message

drivers/net/sunbmac.c +22 -18
index b92218c..8fe4c49 100644
@@ -23,6 +23,7 @@
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/bitops.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/auxio.h>
 #include <asm/byteorder.h>
@@ -239,9 +240,10 @@ static void bigmac_init_rings(struct bigmac *bp, int from_irq)
 		skb_reserve(skb, 34);
 
 		bb->be_rxd[i].rx_addr -			sbus_map_single(&bp->bigmac_sdev->ofdev.dev, skb->data,
-					RX_BUF_ALLOC_SIZE - 34,
-					SBUS_DMA_FROMDEVICE);
+			dma_map_single(&bp->bigmac_sdev->ofdev.dev,
+				       skb->data,
+				       RX_BUF_ALLOC_SIZE - 34,
+				       DMA_FROM_DEVICE);
 		bb->be_rxd[i].rx_flags  			(RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH));
 	}
@@ -776,9 +778,9 @@ static void bigmac_tx(struct bigmac *bp)
 		skb = bp->tx_skbs[elem];
 		bp->enet_stats.tx_packets++;
 		bp->enet_stats.tx_bytes += skb->len;
-		sbus_unmap_single(&bp->bigmac_sdev->ofdev.dev,
-				  this->tx_addr, skb->len,
-				  SBUS_DMA_TODEVICE);
+		dma_unmap_single(&bp->bigmac_sdev->ofdev.dev,
+				 this->tx_addr, skb->len,
+				 DMA_TO_DEVICE);
 
 		DTX(("skb(%p) ", skb));
 		bp->tx_skbs[elem] = NULL;
@@ -831,19 +833,19 @@ static void bigmac_rx(struct bigmac *bp)
 				drops++;
 				goto drop_it;
 			}
-			sbus_unmap_single(&bp->bigmac_sdev->ofdev.dev,
-					  this->rx_addr,
-					  RX_BUF_ALLOC_SIZE - 34,
-					  SBUS_DMA_FROMDEVICE);
+			dma_unmap_single(&bp->bigmac_sdev->ofdev.dev,
+					 this->rx_addr,
+					 RX_BUF_ALLOC_SIZE - 34,
+					 DMA_FROM_DEVICE);
 			bp->rx_skbs[elem] = new_skb;
 			new_skb->dev = bp->dev;
 			skb_put(new_skb, ETH_FRAME_LEN);
 			skb_reserve(new_skb, 34);
 			this->rx_addr -				sbus_map_single(&bp->bigmac_sdev->ofdev.dev,
-						new_skb->data,
-						RX_BUF_ALLOC_SIZE - 34,
-						SBUS_DMA_FROMDEVICE);
+				dma_map_single(&bp->bigmac_sdev->ofdev.dev,
+					       new_skb->data,
+					       RX_BUF_ALLOC_SIZE - 34,
+					       DMA_FROM_DEVICE);
 			this->rx_flags  				(RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH));
 
@@ -858,13 +860,13 @@ static void bigmac_rx(struct bigmac *bp)
 			}
 			skb_reserve(copy_skb, 2);
 			skb_put(copy_skb, len);
-			sbus_dma_sync_single_for_cpu(&bp->bigmac_sdev->ofdev.dev,
-						     this->rx_addr, len,
-						     SBUS_DMA_FROMDEVICE);
+			dma_sync_single_for_cpu(&bp->bigmac_sdev->ofdev.dev,
+						this->rx_addr, len,
+						DMA_FROM_DEVICE);
 			skb_copy_to_linear_data(copy_skb, (unsigned char *)skb->data, len);
-			sbus_dma_sync_single_for_device(&bp->bigmac_sdev->ofdev.dev,
-							this->rx_addr, len,
-							SBUS_DMA_FROMDEVICE);
+			dma_sync_single_for_device(&bp->bigmac_sdev->ofdev.dev,
+						   this->rx_addr, len,
+						   DMA_FROM_DEVICE);
 
 			/* Reuse original ring buffer. */
 			this->rx_flags @@ -960,8 +962,8 @@ static int bigmac_start_xmit(struct sk_buff *skb, struct net_device *dev)

u32 mapping;

len = skb->len;
- mapping = sbus_map_single(&bp->bigmac_sdev->ofdev.dev, skb->data,
- len, SBUS_DMA_TODEVICE);
+ mapping = dma_map_single(&bp->bigmac_sdev->ofdev.dev, skb->data,
+ len, DMA_TO_DEVICE);

/* Avoid a race... */
spin_lock_irq(&bp->lock);
@@ -1185,9 +1187,9 @@ static int __devinit bigmac_ether_init(struct sbus_dev *qec_sdev)
bigmac_stop(bp);

/* Allocate transmit/receive descriptor DVMA block. */
- bp->bmac_block = sbus_alloc_consistent(&bp->bigmac_sdev->ofdev.dev,
- PAGE_SIZE,
- &bp->bblock_dvma);
+ bp->bmac_block = dma_alloc_coherent(&bp->bigmac_sdev->ofdev.dev,
+ PAGE_SIZE,
+ &bp->bblock_dvma, GFP_ATOMIC);
if (bp->bmac_block = NULL || bp->bblock_dvma = 0) {
printk(KERN_ERR "BIGMAC: Cannot allocate consistent DMA.\n"); goto fail_and_cleanup;
@@ -1247,10 +1249,10 @@ fail_and_cleanup:
sbus_iounmap(bp->tregs, TCVR_REG_SIZE);

if (bp->bmac_block)
- sbus_free_consistent(&bp->bigmac_sdev->ofdev.dev,

-				     PAGE_SIZE,
-				     bp->bmac_block,
-				     bp->bblock_dvma);
+		dma_free_coherent(&bp->bigmac_sdev->ofdev.dev,
+				  PAGE_SIZE,
+				  bp->bmac_block,
+				  bp->bblock_dvma);

/* This also frees the co-located 'dev->priv' */ free_netdev(dev);
@@ -1282,10 +1284,10 @@ static int __devexit bigmac_sbus_remove(struct of_device *dev)
sbus_iounmap(bp->creg, CREG_REG_SIZE);
sbus_iounmap(bp->bregs, BMAC_REG_SIZE);
sbus_iounmap(bp->tregs, TCVR_REG_SIZE);
- sbus_free_consistent(&bp->bigmac_sdev->ofdev.dev,

-			     PAGE_SIZE,
-			     bp->bmac_block,
-			     bp->bblock_dvma);
+	dma_free_coherent(&bp->bigmac_sdev->ofdev.dev,
+			  PAGE_SIZE,
+			  bp->bmac_block,
+			  bp->bblock_dvma);

free_netdev(net_dev);

drivers/net/sunhme.c +34 -51

198 lines not on this page · raw message

drivers/net/sunlance.c +8 -6
index 4f4baf9..6575888 100644
@@ -91,6 +91,7 @@ static char lancestr[] = "LANCE";
 #include <linux/skbuff.h>
 #include <linux/ethtool.h>
 #include <linux/bitops.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -1283,10 +1284,10 @@ static void lance_free_hwresources(struct lance_private *lp)
 		sbus_iounmap(lp->init_block_iomem,
 			     sizeof(struct lance_init_block));
 	} else if (lp->init_block_mem) {
-		sbus_free_consistent(&lp->sdev->ofdev.dev,
-				     sizeof(struct lance_init_block),
-				     lp->init_block_mem,
-				     lp->init_block_dvma);
+		dma_free_coherent(&lp->sdev->ofdev.dev,
+				  sizeof(struct lance_init_block),
+				  lp->init_block_mem,
+				  lp->init_block_dvma);
 	}
 }
 
@@ -1384,9 +1385,9 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
 		lp->tx = lance_tx_pio;
 	} else {
 		lp->init_block_mem -			sbus_alloc_consistent(&sdev->ofdev.dev,
-					      sizeof(struct lance_init_block),
-					      &lp->init_block_dvma);
+			dma_alloc_coherent(&sdev->ofdev.dev,
+					   sizeof(struct lance_init_block),
+					   &lp->init_block_dvma, GFP_ATOMIC);
 		if (!lp->init_block_mem || lp->init_block_dvma = 0) {
 			printk(KERN_ERR "SunLance: Cannot allocate consistent DMA memory.\n");
 			goto fail;
drivers/net/sunqe.c +23 -22

70 lines not on this page · raw message

drivers/scsi/qlogicpti.c +27 -26

97 lines not on this page · raw message

drivers/scsi/sun_esp.c +14 -12
index 35b6e2c..f750874 100644
@@ -9,6 +9,7 @@
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/init.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/irq.h>
 #include <asm/io.h>
@@ -101,8 +102,9 @@ static int __devinit esp_sbus_map_command_block(struct esp *esp)
 {
 	struct sbus_dev *sdev = esp->dev;
 
-	esp->command_block = sbus_alloc_consistent(&sdev->ofdev.dev, 16,
-						   &esp->command_block_dma);
+	esp->command_block = dma_alloc_coherent(&sdev->ofdev.dev, 16,
+						&esp->command_block_dma,
+						GFP_ATOMIC);
 	if (!esp->command_block)
 		return -ENOMEM;
 	return 0;
@@ -225,7 +227,7 @@ static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf,
 {
 	struct sbus_dev *sdev = esp->dev;
 
-	return sbus_map_single(&sdev->ofdev.dev, buf, sz, dir);
+	return dma_map_single(&sdev->ofdev.dev, buf, sz, dir);
 }
 
 static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg,
@@ -233,7 +235,7 @@ static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg,
 {
 	struct sbus_dev *sdev = esp->dev;
 
-	return sbus_map_sg(&sdev->ofdev.dev, sg, num_sg, dir);
+	return dma_map_sg(&sdev->ofdev.dev, sg, num_sg, dir);
 }
 
 static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr,
@@ -241,7 +243,7 @@ static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr,
 {
 	struct sbus_dev *sdev = esp->dev;
 
-	sbus_unmap_single(&sdev->ofdev.dev, addr, sz, dir);
+	dma_unmap_single(&sdev->ofdev.dev, addr, sz, dir);
 }
 
 static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
@@ -249,7 +251,7 @@ static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
 {
 	struct sbus_dev *sdev = esp->dev;
 
-	sbus_unmap_sg(&sdev->ofdev.dev, sg, num_sg, dir);
+	dma_unmap_sg(&sdev->ofdev.dev, sg, num_sg, dir);
 }
 
 static int sbus_esp_irq_pending(struct esp *esp)
@@ -558,9 +560,9 @@ static int __devinit esp_sbus_probe_one(struct device *dev,
 fail_free_irq:
 	free_irq(host->irq, esp);
 fail_unmap_command_block:
-	sbus_free_consistent(&esp_dev->ofdev.dev, 16,
-			     esp->command_block,
-			     esp->command_block_dma);
+	dma_free_coherent(&esp_dev->ofdev.dev, 16,
+			  esp->command_block,
+			  esp->command_block_dma);
 fail_unmap_regs:
 	sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE);
 fail_unlink:
@@ -609,9 +611,9 @@ static int __devexit esp_sbus_remove(struct of_device *dev)
 	dma_write32(val & ~DMA_INT_ENAB, DMA_CSR);
 
 	free_irq(irq, esp);
-	sbus_free_consistent(&sdev->ofdev.dev, 16,
-			     esp->command_block,
-			     esp->command_block_dma);
+	dma_free_coherent(&sdev->ofdev.dev, 16,
+			  esp->command_block,
+			  esp->command_block_dma);
 	sbus_iounmap(esp->regs, SBUS_ESP_REG_SIZE);
 	of_iounmap(&dma_of->resource[0], esp->dma_regs,
 		   resource_size(&dma_of->resource[0]));
sound/core/memalloc.c +4 -4
index cc80397..ccaaac4 100644
@@ -192,8 +192,8 @@ static void *snd_malloc_sbus_pages(struct device *dev, size_t size,
 	snd_assert(size > 0, return NULL);
 	snd_assert(dma_addr != NULL, return NULL);
 	pg = get_order(size);
-	res = sbus_alloc_consistent(&sdev->ofdev.dev, PAGE_SIZE * (1 << pg),
-				    dma_addr);
+	res = dma_alloc_coherent(&sdev->ofdev.dev, PAGE_SIZE * (1 << pg),
+				 dma_addr, GFP_ATOMIC);
 	if (res != NULL)
 		inc_snd_pages(pg);
 	return res;
@@ -209,8 +209,8 @@ static void snd_free_sbus_pages(struct device *dev, size_t size,
 		return;
 	pg = get_order(size);
 	dec_snd_pages(pg);
-	sbus_free_consistent(&sdev->ofdev.dev, PAGE_SIZE * (1 << pg),
-			     ptr, dma_addr);
+	dma_free_coherent(&sdev->ofdev.dev, PAGE_SIZE * (1 << pg),
+			  ptr, dma_addr);
 }
 
 #endif /* CONFIG_SBUS */
sound/sparc/dbri.c +21 -19
index a6b32ec..5242ecb 100644
@@ -57,6 +57,7 @@
 #include <linux/delay.h>
 #include <linux/irq.h>
 #include <linux/io.h>
+#include <linux/dma-mapping.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -2093,15 +2094,15 @@ static int snd_dbri_hw_params(struct snd_pcm_substream *substream,
 	 */
 	if (info->dvma_buffer = 0) {
 		if (DBRI_STREAMNO(substream) = DBRI_PLAY)
-			direction = SBUS_DMA_TODEVICE;
+			direction = DMA_TO_DEVICE;
 		else
-			direction = SBUS_DMA_FROMDEVICE;
+			direction = DMA_FROM_DEVICE;
 
 		info->dvma_buffer -			sbus_map_single(&dbri->sdev->ofdev.dev,
-					runtime->dma_area,
-					params_buffer_bytes(hw_params),
-					direction);
+			dma_map_single(&dbri->sdev->ofdev.dev,
+				       runtime->dma_area,
+				       params_buffer_bytes(hw_params),
+				       direction);
 	}
 
 	direction = params_buffer_bytes(hw_params);
@@ -2122,12 +2123,12 @@ static int snd_dbri_hw_free(struct snd_pcm_substream *substream)
 	 */
 	if (info->dvma_buffer) {
 		if (DBRI_STREAMNO(substream) = DBRI_PLAY)
-			direction = SBUS_DMA_TODEVICE;
+			direction = DMA_TO_DEVICE;
 		else
-			direction = SBUS_DMA_FROMDEVICE;
+			direction = DMA_FROM_DEVICE;
 
-		sbus_unmap_single(&dbri->sdev->ofdev.dev, info->dvma_buffer,
-				  substream->runtime->buffer_size, direction);
+		dma_unmap_single(&dbri->sdev->ofdev.dev, info->dvma_buffer,
+				 substream->runtime->buffer_size, direction);
 		info->dvma_buffer = 0;
 	}
 	if (info->pipe != -1) {
@@ -2525,9 +2526,9 @@ static int __devinit snd_dbri_create(struct snd_card *card,
 	dbri->sdev = sdev;
 	dbri->irq = irq;
 
-	dbri->dma = sbus_alloc_consistent(&sdev->ofdev.dev,
-					  sizeof(struct dbri_dma),
-					  &dbri->dma_dvma);
+	dbri->dma = dma_alloc_coherent(&sdev->ofdev.dev,
+				       sizeof(struct dbri_dma),
+				       &dbri->dma_dvma, GFP_ATOMIC);
 	memset((void *)dbri->dma, 0, sizeof(struct dbri_dma));
 
 	dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n",
@@ -2539,8 +2540,8 @@ static int __devinit snd_dbri_create(struct snd_card *card,
 				  dbri->regs_size, "DBRI Registers");
 	if (!dbri->regs) {
 		printk(KERN_ERR "DBRI: could not allocate registers\n");
-		sbus_free_consistent(&sdev->ofdev.dev, sizeof(struct dbri_dma),
-				     (void *)dbri->dma, dbri->dma_dvma);
+		dma_free_coherent(&sdev->ofdev.dev, sizeof(struct dbri_dma),
+				  (void *)dbri->dma, dbri->dma_dvma);
 		return -EIO;
 	}
 
@@ -2549,8 +2550,8 @@ static int __devinit snd_dbri_create(struct snd_card *card,
 	if (err) {
 		printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq);
 		sbus_iounmap(dbri->regs, dbri->regs_size);
-		sbus_free_consistent(&sdev->ofdev.dev, sizeof(struct dbri_dma),
-				     (void *)dbri->dma, dbri->dma_dvma);
+		dma_free_coherent(&sdev->ofdev.dev, sizeof(struct dbri_dma),
+				  (void *)dbri->dma, dbri->dma_dvma);
 		return err;
 	}
 
@@ -2577,9 +2578,9 @@ static void snd_dbri_free(struct snd_dbri *dbri)
 		sbus_iounmap(dbri->regs, dbri->regs_size);
 
 	if (dbri->dma)
-		sbus_free_consistent(&dbri->sdev->ofdev.dev,
-				     sizeof(struct dbri_dma),
-				     (void *)dbri->dma, dbri->dma_dvma);
+		dma_free_coherent(&dbri->sdev->ofdev.dev,
+				  sizeof(struct dbri_dma),
+				  (void *)dbri->dma, dbri->dma_dvma);
 }
 
 static int __devinit dbri_probe(struct of_device *of_dev,
Signature · 1 line
1.5.6.5.GIT