Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143705
b: refs/heads/master
c: ff54250
h: refs/heads/master
i:
  143703: 145bfe1
v: v3
  • Loading branch information
Linus Torvalds committed Apr 19, 2009
1 parent 1b1105a commit e262025
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d4ab5daca4b3bf9c9166908db0c436722d52e77
refs/heads/master: ff54250a0ebab7f90a5f848a0ba63f999830c872
46 changes: 12 additions & 34 deletions trunk/kernel/resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,43 +533,21 @@ static void __init __reserve_region_with_split(struct resource *root,
res->end = end;
res->flags = IORESOURCE_BUSY;

for (;;) {
conflict = __request_resource(parent, res);
if (!conflict)
break;
if (conflict != parent) {
parent = conflict;
if (!(conflict->flags & IORESOURCE_BUSY))
continue;
}

/* Uhhuh, that didn't work out.. */
kfree(res);
res = NULL;
break;
}

if (!res) {
/* failed, split and try again */

/* conflict covered whole area */
if (conflict->start <= start && conflict->end >= end)
return;
conflict = __request_resource(parent, res);
if (!conflict)
return;

if (conflict->start > start)
__reserve_region_with_split(root, start, conflict->start-1, name);
if (!(conflict->flags & IORESOURCE_BUSY)) {
resource_size_t common_start, common_end;
/* failed, split and try again */
kfree(res);

common_start = max(conflict->start, start);
common_end = min(conflict->end, end);
if (common_start < common_end)
__reserve_region_with_split(root, common_start, common_end, name);
}
if (conflict->end < end)
__reserve_region_with_split(root, conflict->end+1, end, name);
}
/* conflict covered whole area */
if (conflict->start <= start && conflict->end >= end)
return;

if (conflict->start > start)
__reserve_region_with_split(root, start, conflict->start-1, name);
if (conflict->end < end)
__reserve_region_with_split(root, conflict->end+1, end, name);
}

void __init reserve_region_with_split(struct resource *root,
Expand Down

0 comments on commit e262025

Please sign in to comment.