> + total_weight = pnv_pci_ioda_total_dma_weight(phb); > + weight = pnv_pci_ioda_pe_dma_weight(pe); > + if (!total_weight || !weight) > + return; > + > + segs = (weight * phb->ioda.dma32_count) / total_weight; > + if (!segs) > + segs = 1; I'm a little bit concerned about rounding here. Having said that I've also lost track of dma32_count: if it's big then rounding won't matter. What's a typical dma32_count? > + > + /* > + * Allocate continuous DMA32 segments. We begin with the expected Very much a nit pick, but I think you mean s/continuous/contiguous/. > + * number of segments. With one more attempt, the number of DMA32 > + * segments to be allocated is decreased by one until one segment > + * is allocated successfully. > + */ > + while (segs) { > + found = false; > + for (base = 0; base <= phb->ioda.dma32_count - segs; base++) { > + for (i = base; i < base + segs; i++) { > + if (phb->ioda.dma32_segmap[i] != > + IODA_INVALID_PE) > + break; > + } > + > + if (i >= base + segs) { How would `i' ever be greater than base + segs? Should the test just be 'if (i == base + segs) {' > + found = true; > + break; > + } > + } Regards, Daniel