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>

authored by Daniel Walker and committed by Linus Torvalds 01ac835f 2278c5ac

+9 -9
+7 -7
arch/um/sys-i386/ldt.c
··· 147 147 if (ptrace_ldt) 148 148 return read_ldt_from_host(ptr, bytecount); 149 149 150 - down(&ldt->semaphore); 150 + mutex_lock(&ldt->lock); 151 151 if (ldt->entry_count <= LDT_DIRECT_ENTRIES) { 152 152 size = LDT_ENTRY_SIZE*LDT_DIRECT_ENTRIES; 153 153 if (size > bytecount) ··· 171 171 ptr += size; 172 172 } 173 173 } 174 - up(&ldt->semaphore); 174 + mutex_unlock(&ldt->lock); 175 175 176 176 if (bytecount == 0 || err == -EFAULT) 177 177 goto out; ··· 229 229 } 230 230 231 231 if (!ptrace_ldt) 232 - down(&ldt->semaphore); 232 + mutex_lock(&ldt->lock); 233 233 234 234 err = write_ldt_entry(mm_idp, func, &ldt_info, &addr, 1); 235 235 if (err) ··· 289 289 err = 0; 290 290 291 291 out_unlock: 292 - up(&ldt->semaphore); 292 + mutex_unlock(&ldt->lock); 293 293 out: 294 294 return err; 295 295 } ··· 396 396 397 397 398 398 if (!ptrace_ldt) 399 - init_MUTEX(&new_mm->ldt.semaphore); 399 + mutex_init(&new_mm->ldt.lock); 400 400 401 401 if (!from_mm) { 402 402 memset(&desc, 0, sizeof(desc)); ··· 456 456 * i.e., we have to use the stub for modify_ldt, which 457 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 460 if (from_mm->ldt.entry_count <= LDT_DIRECT_ENTRIES) 461 461 memcpy(new_mm->ldt.u.entries, from_mm->ldt.u.entries, 462 462 sizeof(new_mm->ldt.u.entries)); ··· 475 475 } 476 476 } 477 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 481 out:
+2 -2
include/asm-um/ldt.h
··· 8 8 #ifndef __ASM_LDT_H 9 9 #define __ASM_LDT_H 10 10 11 - #include "asm/semaphore.h" 11 + #include <linux/mutex.h> 12 12 #include "asm/host_ldt.h" 13 13 14 14 extern void ldt_host_info(void); ··· 27 27 28 28 typedef struct uml_ldt { 29 29 int entry_count; 30 - struct semaphore semaphore; 30 + struct mutex lock; 31 31 union { 32 32 struct ldt_entry * pages[LDT_PAGES_MAX]; 33 33 struct ldt_entry entries[LDT_DIRECT_ENTRIES];