136,63 → 136,12 |
|
struct resource * __request_region(struct resource *parent, unsigned long start, unsigned long n, const char *name) |
{ |
struct resource *res = kmalloc(sizeof(*res), GFP_KERNEL); |
|
if (res) { |
memset(res, 0, sizeof(*res)); |
res->name = name; |
res->start = start; |
res->end = start + n - 1; |
res->flags = IORESOURCE_BUSY; |
|
for (;;) { |
struct resource *conflict; |
|
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; |
} |
} |
return res; |
return (void *)(0xFFFFFFFF); |
} |
|
void __release_region(struct resource *parent, unsigned long start, unsigned long n) |
{ |
struct resource **p; |
unsigned long end; |
|
p = &parent->child; |
end = start + n - 1; |
|
for (;;) { |
struct resource *res = *p; |
|
if (!res) |
break; |
if (res->start <= start && res->end >= end) { |
if (!(res->flags & IORESOURCE_BUSY)) { |
p = &res->child; |
continue; |
} |
if (res->start != start || res->end != end) |
break; |
*p = res->sibling; |
kfree(res); |
return; |
} |
p = &res->sibling; |
} |
printk(KERN_WARNING "Trying to free nonexistent resource <%08lx-%08lx>\n", start, end); |
} |
|
static int find_resource(struct resource *root, struct resource *new, |
337,20 → 286,6 |
|
} |
|
unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned long n) { |
|
memcpy(to,from,n); |
return 0; |
|
} |
|
unsigned long __copy_from_user_ll(void *to, const void __user *from, unsigned long n) { |
|
memcpy(to,from,n); |
return 0; |
|
} |
|
void complete(struct completion *c) { |
} |
|