aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/resource.c')
-rw-r--r--kernel/resource.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/kernel/resource.c b/kernel/resource.c
index af96c1e4b54b..e697f20e2288 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -303,8 +303,10 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
303static int find_resource(struct resource *root, struct resource *new, 303static int find_resource(struct resource *root, struct resource *new,
304 resource_size_t size, resource_size_t min, 304 resource_size_t size, resource_size_t min,
305 resource_size_t max, resource_size_t align, 305 resource_size_t max, resource_size_t align,
306 void (*alignf)(void *, struct resource *, 306 resource_size_t (*alignf)(void *,
307 resource_size_t, resource_size_t), 307 struct resource *,
308 resource_size_t,
309 resource_size_t),
308 void *alignf_data) 310 void *alignf_data)
309{ 311{
310 struct resource *this = root->child; 312 struct resource *this = root->child;
@@ -330,7 +332,7 @@ static int find_resource(struct resource *root, struct resource *new,
330 tmp.end = max; 332 tmp.end = max;
331 tmp.start = ALIGN(tmp.start, align); 333 tmp.start = ALIGN(tmp.start, align);
332 if (alignf) 334 if (alignf)
333 alignf(alignf_data, &tmp, size, align); 335 tmp.start = alignf(alignf_data, &tmp, size, align);
334 if (tmp.start < tmp.end && tmp.end - tmp.start >= size - 1) { 336 if (tmp.start < tmp.end && tmp.end - tmp.start >= size - 1) {
335 new->start = tmp.start; 337 new->start = tmp.start;
336 new->end = tmp.start + size - 1; 338 new->end = tmp.start + size - 1;
@@ -358,8 +360,10 @@ static int find_resource(struct resource *root, struct resource *new,
358int allocate_resource(struct resource *root, struct resource *new, 360int allocate_resource(struct resource *root, struct resource *new,
359 resource_size_t size, resource_size_t min, 361 resource_size_t size, resource_size_t min,
360 resource_size_t max, resource_size_t align, 362 resource_size_t max, resource_size_t align,
361 void (*alignf)(void *, struct resource *, 363 resource_size_t (*alignf)(void *,
362 resource_size_t, resource_size_t), 364 struct resource *,
365 resource_size_t,
366 resource_size_t),
363 void *alignf_data) 367 void *alignf_data)
364{ 368{
365 int err; 369 int err;