aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/resource.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-02-17 12:27:37 -0500
committerThomas Gleixner <tglx@linutronix.de>2010-02-17 12:28:05 -0500
commitb7e56edba4b02f2079042c326a8cd72a44635817 (patch)
treeb5042002e9747cd8fb1278d61f86d8b92a74c018 /kernel/resource.c
parent13ca0fcaa33f6b1984c4111b6ec5df42689fea6f (diff)
parentb0483e78e5c4c9871fc5541875b3bc006846d46b (diff)
Merge branch 'linus' into x86/mm
x86/mm is on 32-rc4 and missing the spinlock namespace changes which are needed for further commits into this topic. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/resource.c')
-rw-r--r--kernel/resource.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/kernel/resource.c b/kernel/resource.c
index e68cd7477c40..03c897f7935e 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -321,35 +321,37 @@ static int find_resource(struct resource *root, struct resource *new,
321 void *alignf_data) 321 void *alignf_data)
322{ 322{
323 struct resource *this = root->child; 323 struct resource *this = root->child;
324 struct resource tmp = *new;
324 325
325 new->start = root->start; 326 tmp.start = root->start;
326 /* 327 /*
327 * Skip past an allocated resource that starts at 0, since the assignment 328 * Skip past an allocated resource that starts at 0, since the assignment
328 * of this->start - 1 to new->end below would cause an underflow. 329 * of this->start - 1 to tmp->end below would cause an underflow.
329 */ 330 */
330 if (this && this->start == 0) { 331 if (this && this->start == 0) {
331 new->start = this->end + 1; 332 tmp.start = this->end + 1;
332 this = this->sibling; 333 this = this->sibling;
333 } 334 }
334 for(;;) { 335 for(;;) {
335 if (this) 336 if (this)
336 new->end = this->start - 1; 337 tmp.end = this->start - 1;
337 else 338 else
338 new->end = root->end; 339 tmp.end = root->end;
339 if (new->start < min) 340 if (tmp.start < min)
340 new->start = min; 341 tmp.start = min;
341 if (new->end > max) 342 if (tmp.end > max)
342 new->end = max; 343 tmp.end = max;
343 new->start = ALIGN(new->start, align); 344 tmp.start = ALIGN(tmp.start, align);
344 if (alignf) 345 if (alignf)
345 alignf(alignf_data, new, size, align); 346 alignf(alignf_data, &tmp, size, align);
346 if (new->start < new->end && new->end - new->start >= size - 1) { 347 if (tmp.start < tmp.end && tmp.end - tmp.start >= size - 1) {
347 new->end = new->start + size - 1; 348 new->start = tmp.start;
349 new->end = tmp.start + size - 1;
348 return 0; 350 return 0;
349 } 351 }
350 if (!this) 352 if (!this)
351 break; 353 break;
352 new->start = this->end + 1; 354 tmp.start = this->end + 1;
353 this = this->sibling; 355 this = this->sibling;
354 } 356 }
355 return -EBUSY; 357 return -EBUSY;