Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82ec90ea authored by Yinghai Lu's avatar Yinghai Lu Committed by Bjorn Helgaas
Browse files

resources: allow adjust_resource() for resources with no parent



If a resource has no parent, allow its start/end to be set arbitrarily
as long as any children are still contained within the new range.

[bhelgaas: changelog]
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 5cc62c20
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -722,13 +722,11 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t

	write_lock(&resource_lock);

	if ((start < parent->start) || (end > parent->end))
		goto out;
	if (!parent)
		goto skip;

	for (tmp = res->child; tmp; tmp = tmp->sibling) {
		if ((tmp->start < start) || (tmp->end > end))
	if ((start < parent->start) || (end > parent->end))
		goto out;
	}

	if (res->sibling && (res->sibling->start <= end))
		goto out;
@@ -741,6 +739,11 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
			goto out;
	}

skip:
	for (tmp = res->child; tmp; tmp = tmp->sibling)
		if ((tmp->start < start) || (tmp->end > end))
			goto out;

	res->start = start;
	res->end = end;
	result = 0;