diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-05-18 05:51:11 +0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-06-14 01:42:22 +0400 |
commit | 82ec90eac304e81b1389175b4dded7abecc678ef (patch) | |
tree | 8f78691a62e6bdb699a2f8fda9f079916d59ace0 /kernel | |
parent | 5cc62c202211096ec26309722ec27455d52c8726 (diff) | |
download | linux-82ec90eac304e81b1389175b4dded7abecc678ef.tar.xz |
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/resource.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index e1d2b8ee76d5..dc8b47764443 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -722,14 +722,12 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t write_lock(&resource_lock); + if (!parent) + goto skip; + if ((start < parent->start) || (end > parent->end)) 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)) 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; |