diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2011-05-07 14:56:00 -0400 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2011-07-30 15:21:39 -0400 |
commit | b7785e954348465e1926d9c10ff3e49c207d4ec6 (patch) | |
tree | 1c5866e1c99cc9185b3b8c993f7280572360a591 /arch/m68k | |
parent | 1c388919d89ca35741e9c4d3255adf87f76f0c06 (diff) |
m68k/amiga: Chip RAM - Use lookup_resource()
Replace a custom implementation (which doesn't lock the resource tree) by a
call to lookup_resource()
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/amiga/chipram.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c index 4790f77cbd48..99449fbf9a72 100644 --- a/arch/m68k/amiga/chipram.c +++ b/arch/m68k/amiga/chipram.c | |||
@@ -93,21 +93,21 @@ void *amiga_chip_alloc_res(unsigned long size, struct resource *res) | |||
93 | void amiga_chip_free(void *ptr) | 93 | void amiga_chip_free(void *ptr) |
94 | { | 94 | { |
95 | unsigned long start = ZTWO_PADDR(ptr); | 95 | unsigned long start = ZTWO_PADDR(ptr); |
96 | struct resource **p, *res; | 96 | struct resource *res; |
97 | unsigned long size; | 97 | unsigned long size; |
98 | 98 | ||
99 | for (p = &chipram_res.child; (res = *p); p = &res->sibling) { | 99 | res = lookup_resource(&chipram_res, start); |
100 | if (res->start != start) | 100 | if (!res) { |
101 | continue; | 101 | pr_err("amiga_chip_free: trying to free nonexistent region at " |
102 | *p = res->sibling; | 102 | "%p\n", ptr); |
103 | size = resource_size(res); | ||
104 | pr_debug("amiga_chip_free: free %lu bytes at %p\n", size, ptr); | ||
105 | atomic_add(size, &chipavail); | ||
106 | kfree(res); | ||
107 | return; | 103 | return; |
108 | } | 104 | } |
109 | pr_err("amiga_chip_free: trying to free nonexistent region at %p\n", | 105 | |
110 | ptr); | 106 | size = resource_size(res); |
107 | pr_debug("amiga_chip_free: free %lu bytes at %p\n", size, ptr); | ||
108 | atomic_add(size, &chipavail); | ||
109 | release_resource(res); | ||
110 | kfree(res); | ||
111 | } | 111 | } |
112 | EXPORT_SYMBOL(amiga_chip_free); | 112 | EXPORT_SYMBOL(amiga_chip_free); |
113 | 113 | ||