Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219561
b: refs/heads/master
c: 5d6b1fa
h: refs/heads/master
i:
  219559: c95e37b
v: v3
  • Loading branch information
Bjorn Helgaas authored and Jesse Barnes committed Oct 26, 2010
1 parent e616e54 commit f2bb4d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 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: a9cea017411c95ec789092971f9baaef1f826883
refs/heads/master: 5d6b1fa301b13cc651ee717a9b518124dea2f814
15 changes: 11 additions & 4 deletions trunk/kernel/resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,15 @@ static resource_size_t simple_align_resource(void *data,
return avail->start;
}

static void resource_clip(struct resource *res, resource_size_t min,
resource_size_t max)
{
if (res->start < min)
res->start = min;
if (res->end > max)
res->end = max;
}

/*
* Find empty slot in the resource tree given range and alignment.
*/
Expand Down Expand Up @@ -394,10 +403,8 @@ static int find_resource(struct resource *root, struct resource *new,
tmp.end = this->start - 1;
else
tmp.end = root->end;
if (tmp.start < min)
tmp.start = min;
if (tmp.end > max)
tmp.end = max;

resource_clip(&tmp, min, max);
tmp.start = ALIGN(tmp.start, align);

tmp.start = alignf(alignf_data, &tmp, size, align);
Expand Down

0 comments on commit f2bb4d1

Please sign in to comment.