Skip to contentSkip to conversation

implement dma_mapping_error

PATCH New Jesse Barnes 1 participant 1 message Mar 27, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 implement dma_mapping_error

On sn2, dma_mapping_error is trivial. pci_map_single was already returning 0 in case of failure (0 is an invalid DMA address on sn2), so make dma_mapping_error check for that.

Thanks,
Jesse

===== arch/ia64/sn/io/machvec/pci_dma.c 1.29 vs edited =====

arch/ia64/sn/io/machvec/pci_dma.c +8 -4
@@ -391,11 +391,9 @@
 	dma_map = pcibr_dmamap_alloc(vhdl, NULL, size, PCIIO_DMA_DATA | 
 				     MINIMAL_ATE_FLAG(phys_addr, size));
 
-	if (!dma_map) {
-		printk(KERN_ERR "pci_map_single: Unable to allocate anymore "
-		       "32 bit page map entries.\n");
+	/* PMU out of entries */
+	if (!dma_map)
 		return 0;
-	}
 
 	dma_addr = (dma_addr_t) pcibr_dmamap_addr(dma_map, phys_addr, size);
 	dma_map->bd_dma_addr = dma_addr;
@@ -655,6 +653,12 @@
 int
 sn_dma_mapping_error(dma_addr_t dma_addr)
 {
+	/*
+	 * We can only run out of page mapping entries, so if there's
+	 * an error, tell the caller to try again later.
+	 */
+	if (!dma_addr)
+		return -EAGAIN;
 	return 0;
 }