patch-2.4.20 linux-2.4.20/arch/sparc/mm/iommu.c

Next file: linux-2.4.20/arch/sparc/mm/srmmu.c
Previous file: linux-2.4.20/arch/sparc/mm/io-unit.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.19/arch/sparc/mm/iommu.c linux-2.4.20/arch/sparc/mm/iommu.c
@@ -167,7 +167,8 @@
 
 static void iommu_get_scsi_sgl_noflush(struct scatterlist *sg, int sz, struct sbus_bus *sbus)
 {
-	for (; sz >= 0; sz--) {
+	while (sz != 0) {
+		sz--;
 		sg[sz].dvma_address = (__u32) (sg[sz].address);
 		sg[sz].dvma_length = (__u32) (sg[sz].length);
 	}
@@ -176,7 +177,8 @@
 static void iommu_get_scsi_sgl_gflush(struct scatterlist *sg, int sz, struct sbus_bus *sbus)
 {
 	flush_page_for_dma(0);
-	for (; sz >= 0; sz--) {
+	while (sz != 0) {
+		sz--;
 		sg[sz].dvma_address = (__u32) (sg[sz].address);
 		sg[sz].dvma_length = (__u32) (sg[sz].length);
 	}
@@ -187,6 +189,7 @@
 	unsigned long page, oldpage = 0;
 
 	while(sz >= 0) {
+		sz--;
 		page = ((unsigned long) sg[sz].address) & PAGE_MASK;
 		if (oldpage == page)
 			page += PAGE_SIZE; /* We flushed that page already */
@@ -196,7 +199,6 @@
 		}
 		sg[sz].dvma_address = (__u32) (sg[sz].address);
 		sg[sz].dvma_length = (__u32) (sg[sz].length);
-		sz--;
 		oldpage = page - PAGE_SIZE;
 	}
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)