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;