aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Walker <dwalker@mvista.com>2008-02-05 01:31:26 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:31 -0500
commit01ac835fdd121f36dded404af15225101f6ccee3 (patch)
tree7c147e37003fdad5525ce4b036917a29d9cdd1a2
parent2278c5ac9d39699bac44250b9c532de0c02cb16a (diff)
uml: LDT mutex conversion
The ldt.semaphore conforms to the new struct mutex requirments, so I converted it to use the new API and changed the name. Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/um/sys-i386/ldt.c14
-rw-r--r--include/asm-um/ldt.h4
2 files changed, 9 insertions, 9 deletions
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 505ed5c9a68d..a34263e6b08d 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -147,7 +147,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
147 if (ptrace_ldt) 147 if (ptrace_ldt)
148 return read_ldt_from_host(ptr, bytecount); 148 return read_ldt_from_host(ptr, bytecount);
149 149
150 down(&ldt->semaphore); 150 mutex_lock(&ldt->lock);
151 if (ldt->entry_count <= LDT_DIRECT_ENTRIES) { 151 if (ldt->entry_count <= LDT_DIRECT_ENTRIES) {
152 size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES; 152 size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES;
153 if (size > bytecount) 153 if (size > bytecount)
@@ -171,7 +171,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
171 ptr += size; 171 ptr += size;
172 } 172 }
173 } 173 }
174 up(&ldt->semaphore); 174 mutex_unlock(&ldt->lock);
175 175
176 if (bytecount == 0 || err == -EFAULT) 176 if (bytecount == 0 || err == -EFAULT)
177 goto out; 177 goto out;
@@ -229,7 +229,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
229 } 229 }
230 230
231 if (!ptrace_ldt) 231 if (!ptrace_ldt)
232 down(&ldt->semaphore); 232 mutex_lock(&ldt->lock);
233 233
234 err = write_ldt_entry(mm_idp, func, &ldt_info, &addr, 1); 234 err = write_ldt_entry(mm_idp, func, &ldt_info, &addr, 1);
235 if (err) 235 if (err)
@@ -289,7 +289,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
289 err = 0; 289 err = 0;
290 290
291out_unlock: 291out_unlock:
292 up(&ldt->semaphore); 292 mutex_unlock(&ldt->lock);
293out: 293out:
294 return err; 294 return err;
295} 295}
@@ -396,7 +396,7 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
396 396
397 397
398 if (!ptrace_ldt) 398 if (!ptrace_ldt)
399 init_MUTEX(&new_mm->ldt.semaphore); 399 mutex_init(&new_mm->ldt.lock);
400 400
401 if (!from_mm) { 401 if (!from_mm) {
402 memset(&desc, 0, sizeof(desc)); 402 memset(&desc, 0, sizeof(desc));
@@ -456,7 +456,7 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
456 * i.e., we have to use the stub for modify_ldt, which 456 * i.e., we have to use the stub for modify_ldt, which
457 * can't handle the big read buffer of up to 64kB. 457 * can't handle the big read buffer of up to 64kB.
458 */ 458 */
459 down(&from_mm->ldt.semaphore); 459 mutex_lock(&from_mm->ldt.lock);
460 if (from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES) 460 if (from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES)
461 memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries, 461 memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries,
462 sizeof(new_mm->ldt.u.entries)); 462 sizeof(new_mm->ldt.u.entries));
@@ -475,7 +475,7 @@ long init_new_ldt(struct mm_context *new_mm, struct mm_context *from_mm)
475 } 475 }
476 } 476 }
477 new_mm->ldt.entry_count = from_mm->ldt.entry_count; 477 new_mm->ldt.entry_count = from_mm->ldt.entry_count;
478 up(&from_mm->ldt.semaphore); 478 mutex_unlock(&from_mm->ldt.lock);
479 } 479 }
480 480
481 out: 481 out:
diff --git a/include/asm-um/ldt.h b/include/asm-um/ldt.h
index b2553f3e87eb..52af512f5e7d 100644
--- a/include/asm-um/ldt.h
+++ b/include/asm-um/ldt.h
@@ -8,7 +8,7 @@
8#ifndef __ASM_LDT_H 8#ifndef __ASM_LDT_H
9#define __ASM_LDT_H 9#define __ASM_LDT_H
10 10
11#include "asm/semaphore.h" 11#include <linux/mutex.h>
12#include "asm/host_ldt.h" 12#include "asm/host_ldt.h"
13 13
14extern void ldt_host_info(void); 14extern void ldt_host_info(void);
@@ -27,7 +27,7 @@ struct ldt_entry {
27 27
28typedef struct uml_ldt { 28typedef struct uml_ldt {
29 int entry_count; 29 int entry_count;
30 struct semaphore semaphore; 30 struct mutex lock;
31 union { 31 union {
32 struct ldt_entry * pages[LDT_PAGES_MAX]; 32 struct ldt_entry * pages[LDT_PAGES_MAX];
33 struct ldt_entry entries[LDT_DIRECT_ENTRIES]; 33 struct ldt_entry entries[LDT_DIRECT_ENTRIES];