/* put_iova_domain - destroys the iova doamin @iovad: - iova domain in question. All the iova's in that domain are destroyed.  */
void put_iova_domain(struct iova_domain *iovad)
/* put_iova_domain - destroys the iova doamin @iovad: - iova domain in question. All the iova's in that domain are destroyed.  */
void put_iova_domain(struct iova_domain *iovad)
{
	struct rb_node *node;
	unsigned long flags;
	spin_lock_irqsave(&iovad->iova_rbtree_lock, flags);
	node = rb_first(&iovad->rbroot);
	while (node) {
		struct iova *iova = container_of(node, struct iova, node);
		rb_erase(node, &iovad->rbroot);
		free_iova_mem(iova);
		node = rb_first(&iovad->rbroot);
	}
	spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags);
}