mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
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: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
5cc62c2022
commit
82ec90eac3
@ -722,14 +722,12 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
|
|||||||
|
|
||||||
write_lock(&resource_lock);
|
write_lock(&resource_lock);
|
||||||
|
|
||||||
|
if (!parent)
|
||||||
|
goto skip;
|
||||||
|
|
||||||
if ((start < parent->start) || (end > parent->end))
|
if ((start < parent->start) || (end > parent->end))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
for (tmp = res->child; tmp; tmp = tmp->sibling) {
|
|
||||||
if ((tmp->start < start) || (tmp->end > end))
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res->sibling && (res->sibling->start <= end))
|
if (res->sibling && (res->sibling->start <= end))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -741,6 +739,11 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip:
|
||||||
|
for (tmp = res->child; tmp; tmp = tmp->sibling)
|
||||||
|
if ((tmp->start < start) || (tmp->end > end))
|
||||||
|
goto out;
|
||||||
|
|
||||||
res->start = start;
|
res->start = start;
|
||||||
res->end = end;
|
res->end = end;
|
||||||
result = 0;
|
result = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user