/* The described resource region must match a currently busy region.  */
void __release_region(struct resource *parent, resource_size_t start, resource_size_t n)
/* The described resource region must match a currently busy region.  */
void __release_region(struct resource *parent, resource_size_t start, resource_size_t n)
{
	struct resource **p;
	resource_size_t end;
	p = &parent->child;
	end = start + n - 1;
	write_lock(&resource_lock);
	for (;;) {
		struct resource *res = *p;
		if (!res)
			break;
		if (res->start <= start && res->end >= end) {
			if (!(res->flags & IORESOURCE_BUSY)) {
				p = &res->child;
				continue;
			}
			if (res->start != start || res->end != end)
				break;
			*p = res->sibling;
			write_unlock(&resource_lock);
			kfree(res);
			return;
		}
		p = &res->sibling;
	}
	write_unlock(&resource_lock);
	printk(KERN_WARNING "Trying to free nonexistent resource "
		"<%016llx-%016llx>\n", (unsigned long long)start,
		(unsigned long long)end);
}