aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-05-17 21:51:11 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-06-13 17:42:22 -0400
commit82ec90eac304e81b1389175b4dded7abecc678ef (patch)
tree8f78691a62e6bdb699a2f8fda9f079916d59ace0 /kernel
parent5cc62c202211096ec26309722ec27455d52c8726 (diff)
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.c13
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
722 722
723 write_lock(&resource_lock); 723 write_lock(&resource_lock);
724 724
725 if (!parent)
726 goto skip;
727
725 if ((start < parent->start) || (end > parent->end)) 728 if ((start < parent->start) || (end > parent->end))
726 goto out; 729 goto out;
727 730
728 for (tmp = res->child; tmp; tmp = tmp->sibling) {
729 if ((tmp->start < start) || (tmp->end > end))
730 goto out;
731 }
732
733 if (res->sibling && (res->sibling->start <= end)) 731 if (res->sibling && (res->sibling->start <= end))
734 goto out; 732 goto out;
735 733
@@ -741,6 +739,11 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
741 goto out; 739 goto out;
742 } 740 }
743 741
742skip:
743 for (tmp = res->child; tmp; tmp = tmp->sibling)
744 if ((tmp->start < start) || (tmp->end > end))
745 goto out;
746
744 res->start = start; 747 res->start = start;
745 res->end = end; 748 res->end = end;
746 result = 0; 749 result = 0;