aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/imalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/mm/imalloc.c')
-rw-r--r--arch/powerpc/mm/imalloc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/powerpc/mm/imalloc.c b/arch/powerpc/mm/imalloc.c
index 8b0c132bc163..add8c1a9af68 100644
--- a/arch/powerpc/mm/imalloc.c
+++ b/arch/powerpc/mm/imalloc.c
@@ -13,12 +13,12 @@
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
15#include <asm/pgtable.h> 15#include <asm/pgtable.h>
16#include <asm/semaphore.h> 16#include <linux/mutex.h>
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18 18
19#include "mmu_decl.h" 19#include "mmu_decl.h"
20 20
21static DECLARE_MUTEX(imlist_sem); 21static DEFINE_MUTEX(imlist_mutex);
22struct vm_struct * imlist = NULL; 22struct vm_struct * imlist = NULL;
23 23
24static int get_free_im_addr(unsigned long size, unsigned long *im_addr) 24static int get_free_im_addr(unsigned long size, unsigned long *im_addr)
@@ -257,7 +257,7 @@ struct vm_struct * im_get_free_area(unsigned long size)
257 struct vm_struct *area; 257 struct vm_struct *area;
258 unsigned long addr; 258 unsigned long addr;
259 259
260 down(&imlist_sem); 260 mutex_lock(&imlist_mutex);
261 if (get_free_im_addr(size, &addr)) { 261 if (get_free_im_addr(size, &addr)) {
262 printk(KERN_ERR "%s() cannot obtain addr for size 0x%lx\n", 262 printk(KERN_ERR "%s() cannot obtain addr for size 0x%lx\n",
263 __FUNCTION__, size); 263 __FUNCTION__, size);
@@ -272,7 +272,7 @@ struct vm_struct * im_get_free_area(unsigned long size)
272 __FUNCTION__, addr, size); 272 __FUNCTION__, addr, size);
273 } 273 }
274next_im_done: 274next_im_done:
275 up(&imlist_sem); 275 mutex_unlock(&imlist_mutex);
276 return area; 276 return area;
277} 277}
278 278
@@ -281,9 +281,9 @@ struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size,
281{ 281{
282 struct vm_struct *area; 282 struct vm_struct *area;
283 283
284 down(&imlist_sem); 284 mutex_lock(&imlist_mutex);
285 area = __im_get_area(v_addr, size, criteria); 285 area = __im_get_area(v_addr, size, criteria);
286 up(&imlist_sem); 286 mutex_unlock(&imlist_mutex);
287 return area; 287 return area;
288} 288}
289 289
@@ -297,17 +297,17 @@ void im_free(void * addr)
297 printk(KERN_ERR "Trying to %s bad address (%p)\n", __FUNCTION__, addr); 297 printk(KERN_ERR "Trying to %s bad address (%p)\n", __FUNCTION__, addr);
298 return; 298 return;
299 } 299 }
300 down(&imlist_sem); 300 mutex_lock(&imlist_mutex);
301 for (p = &imlist ; (tmp = *p) ; p = &tmp->next) { 301 for (p = &imlist ; (tmp = *p) ; p = &tmp->next) {
302 if (tmp->addr == addr) { 302 if (tmp->addr == addr) {
303 *p = tmp->next; 303 *p = tmp->next;
304 unmap_vm_area(tmp); 304 unmap_vm_area(tmp);
305 kfree(tmp); 305 kfree(tmp);
306 up(&imlist_sem); 306 mutex_unlock(&imlist_mutex);
307 return; 307 return;
308 } 308 }
309 } 309 }
310 up(&imlist_sem); 310 mutex_unlock(&imlist_mutex);
311 printk(KERN_ERR "Trying to %s nonexistent area (%p)\n", __FUNCTION__, 311 printk(KERN_ERR "Trying to %s nonexistent area (%p)\n", __FUNCTION__,
312 addr); 312 addr);
313} 313}