Have a second struct acpi_rmrr_unit pointer, starting out as NULL and getting set to the current one when the callback returns a positive value. Skip further iterations as long as both pointers match.
Great! int intel_iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt) { struct acpi_rmrr_unit *rmrr, *rmrr_cur = NULL; int rc = 0; unsigned int i; u16 bdf; for_each_rmrr_device ( rmrr, bdf, i ) { if ( rmrr != rmrr_cur ) { rc = func(PFN_DOWN(rmrr->base_address), PFN_UP(rmrr->end_address) - PFN_DOWN(rmrr->base_address), PCI_SBDF(rmrr->segment, bdf), ctxt); if ( unlikely(rc < 0) ) return rc; /* Hit this entry so just go next. */ if ( rc > 0 ) rmrr_cur = rmrr; } } return 0; } Thanks Tiejun _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel