git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
arch
/
powerpc
/
mm
/
imalloc.c
diff --git
a/arch/powerpc/mm/imalloc.c
b/arch/powerpc/mm/imalloc.c
index
8b0c132
..
c831815
100644
(file)
--- a/
arch/powerpc/mm/imalloc.c
+++ b/
arch/powerpc/mm/imalloc.c
@@
-13,12
+13,12
@@
#include <asm/uaccess.h>
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
#include <asm/uaccess.h>
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
-#include <
asm/semaphore
.h>
+#include <
linux/mutex
.h>
#include <asm/cacheflush.h>
#include "mmu_decl.h"
#include <asm/cacheflush.h>
#include "mmu_decl.h"
-static DE
CLARE_MUTEX(imlist_sem
);
+static DE
FINE_MUTEX(imlist_mutex
);
struct vm_struct * imlist = NULL;
static int get_free_im_addr(unsigned long size, unsigned long *im_addr)
struct vm_struct * imlist = NULL;
static int get_free_im_addr(unsigned long size, unsigned long *im_addr)
@@
-138,7
+138,7
@@
static struct vm_struct * split_im_region(unsigned long v_addr,
struct vm_struct *vm2 = NULL;
struct vm_struct *new_vm = NULL;
struct vm_struct *vm2 = NULL;
struct vm_struct *new_vm = NULL;
- vm1 =
(struct vm_struct *)
kmalloc(sizeof(*vm1), GFP_KERNEL);
+ vm1 = kmalloc(sizeof(*vm1), GFP_KERNEL);
if (vm1 == NULL) {
printk(KERN_ERR "%s() out of memory\n", __FUNCTION__);
return NULL;
if (vm1 == NULL) {
printk(KERN_ERR "%s() out of memory\n", __FUNCTION__);
return NULL;
@@
-172,7
+172,7
@@
static struct vm_struct * split_im_region(unsigned long v_addr,
* uppermost remainder, and use existing parent one for the
* lower remainder of parent range
*/
* uppermost remainder, and use existing parent one for the
* lower remainder of parent range
*/
- vm2 =
(struct vm_struct *)
kmalloc(sizeof(*vm2), GFP_KERNEL);
+ vm2 = kmalloc(sizeof(*vm2), GFP_KERNEL);
if (vm2 == NULL) {
printk(KERN_ERR "%s() out of memory\n", __FUNCTION__);
kfree(vm1);
if (vm2 == NULL) {
printk(KERN_ERR "%s() out of memory\n", __FUNCTION__);
kfree(vm1);
@@
-206,7
+206,7
@@
static struct vm_struct * __add_new_im_area(unsigned long req_addr,
break;
}
break;
}
- area =
(struct vm_struct *)
kmalloc(sizeof(*area), GFP_KERNEL);
+ area = kmalloc(sizeof(*area), GFP_KERNEL);
if (!area)
return NULL;
area->flags = 0;
if (!area)
return NULL;
area->flags = 0;
@@
-257,7
+257,7
@@
struct vm_struct * im_get_free_area(unsigned long size)
struct vm_struct *area;
unsigned long addr;
struct vm_struct *area;
unsigned long addr;
-
down(&imlist_sem
);
+
mutex_lock(&imlist_mutex
);
if (get_free_im_addr(size, &addr)) {
printk(KERN_ERR "%s() cannot obtain addr for size 0x%lx\n",
__FUNCTION__, size);
if (get_free_im_addr(size, &addr)) {
printk(KERN_ERR "%s() cannot obtain addr for size 0x%lx\n",
__FUNCTION__, size);
@@
-272,7
+272,7
@@
struct vm_struct * im_get_free_area(unsigned long size)
__FUNCTION__, addr, size);
}
next_im_done:
__FUNCTION__, addr, size);
}
next_im_done:
-
up(&imlist_sem
);
+
mutex_unlock(&imlist_mutex
);
return area;
}
return area;
}
@@
-281,9
+281,9
@@
struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size,
{
struct vm_struct *area;
{
struct vm_struct *area;
-
down(&imlist_sem
);
+
mutex_lock(&imlist_mutex
);
area = __im_get_area(v_addr, size, criteria);
area = __im_get_area(v_addr, size, criteria);
-
up(&imlist_sem
);
+
mutex_unlock(&imlist_mutex
);
return area;
}
return area;
}
@@
-297,17
+297,17
@@
void im_free(void * addr)
printk(KERN_ERR "Trying to %s bad address (%p)\n", __FUNCTION__, addr);
return;
}
printk(KERN_ERR "Trying to %s bad address (%p)\n", __FUNCTION__, addr);
return;
}
-
down(&imlist_sem
);
+
mutex_lock(&imlist_mutex
);
for (p = &imlist ; (tmp = *p) ; p = &tmp->next) {
if (tmp->addr == addr) {
*p = tmp->next;
unmap_vm_area(tmp);
kfree(tmp);
for (p = &imlist ; (tmp = *p) ; p = &tmp->next) {
if (tmp->addr == addr) {
*p = tmp->next;
unmap_vm_area(tmp);
kfree(tmp);
-
up(&imlist_sem
);
+
mutex_unlock(&imlist_mutex
);
return;
}
}
return;
}
}
-
up(&imlist_sem
);
+
mutex_unlock(&imlist_mutex
);
printk(KERN_ERR "Trying to %s nonexistent area (%p)\n", __FUNCTION__,
addr);
}
printk(KERN_ERR "Trying to %s nonexistent area (%p)\n", __FUNCTION__,
addr);
}