linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / arm / mach-pxa / dma.c
index 7d8c854..458112b 100644 (file)
@@ -45,16 +45,23 @@ int pxa_request_dma (char *name, pxa_dma_prio prio,
 
        local_irq_save(flags);
 
-       do {
-               /* try grabbing a DMA channel with the requested priority */
-               pxa_for_each_dma_prio (i, prio) {
+       /* try grabbing a DMA channel with the requested priority */
+       for (i = prio; i < prio + PXA_DMA_NBCH(prio); i++) {
+               if (!dma_channels[i].name) {
+                       found = 1;
+                       break;
+               }
+       }
+
+       if (!found) {
+               /* requested prio group is full, try hier priorities */
+               for (i = prio-1; i >= 0; i--) {
                        if (!dma_channels[i].name) {
                                found = 1;
                                break;
                        }
                }
-               /* if requested prio group is full, try a hier priority */
-       } while (!found && prio--);
+       }
 
        if (found) {
                DCSR(i) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR;