x86: clean up arch/x86/kernel/ldt_32/64.c

White space and coding style clenaup.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Thomas Gleixner 2008-01-30 13:30:13 +01:00 committed by Ingo Molnar
parent 2f36fa13ce
commit 78aa1f66f7
2 changed files with 69 additions and 60 deletions

View File

@ -17,7 +17,7 @@
#include <asm/desc.h>
#include <asm/mmu_context.h>
#ifdef CONFIG_SMP /* avoids "defined but not used" warnig */
#ifdef CONFIG_SMP
static void flush_ldt(void *null)
{
if (current->active_mm)
@ -46,7 +46,8 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
if (oldsize)
memcpy(newldt, pc->ldt, oldsize * LDT_ENTRY_SIZE);
oldldt = pc->ldt;
memset(newldt+oldsize*LDT_ENTRY_SIZE, 0, (mincount-oldsize)*LDT_ENTRY_SIZE);
memset(newldt + oldsize * LDT_ENTRY_SIZE, 0,
(mincount - oldsize) * LDT_ENTRY_SIZE);
pc->ldt = newldt;
wmb();
pc->size = mincount;
@ -55,6 +56,7 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
if (reload) {
#ifdef CONFIG_SMP
cpumask_t mask;
preempt_disable();
load_LDT(pc);
mask = cpumask_of_cpu(smp_processor_id());
@ -77,6 +79,7 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
static inline int copy_ldt(mm_context_t *new, mm_context_t *old)
{
int err = alloc_ldt(new, old->size, 0);
if (err < 0)
return err;
memcpy(new->ldt, old->ldt, old->size * LDT_ENTRY_SIZE);
@ -196,7 +199,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
mutex_lock(&mm->context.lock);
if (ldt_info.entry_number >= mm->context.size) {
error = alloc_ldt(&current->mm->context, ldt_info.entry_number+1, 1);
error = alloc_ldt(&current->mm->context,
ldt_info.entry_number + 1, 1);
if (error < 0)
goto out_unlock;
}
@ -217,7 +221,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
/* Install the new entry ... */
install:
write_ldt_entry(mm->context.ldt, ldt_info.entry_number, entry_1, entry_2);
write_ldt_entry(mm->context.ldt, ldt_info.entry_number, entry_1,
entry_2);
error = 0;
out_unlock:
@ -226,7 +231,8 @@ out:
return error;
}
asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
asmlinkage int sys_modify_ldt(int func, void __user *ptr,
unsigned long bytecount)
{
int ret = -ENOSYS;

View File

@ -20,7 +20,7 @@
#include <asm/desc.h>
#include <asm/proto.h>
#ifdef CONFIG_SMP /* avoids "defined but not used" warnig */
#ifdef CONFIG_SMP
static void flush_ldt(void *null)
{
if (current->active_mm)
@ -49,7 +49,8 @@ static int alloc_ldt(mm_context_t *pc, unsigned mincount, int reload)
if (oldsize)
memcpy(newldt, pc->ldt, oldsize * LDT_ENTRY_SIZE);
oldldt = pc->ldt;
memset(newldt+oldsize*LDT_ENTRY_SIZE, 0, (mincount-oldsize)*LDT_ENTRY_SIZE);
memset(newldt + oldsize * LDT_ENTRY_SIZE, 0,
(mincount - oldsize) * LDT_ENTRY_SIZE);
wmb();
pc->ldt = newldt;
wmb();
@ -81,6 +82,7 @@ static int alloc_ldt(mm_context_t *pc, unsigned mincount, int reload)
static inline int copy_ldt(mm_context_t *new, mm_context_t *old)
{
int err = alloc_ldt(new, old->size, 0);
if (err < 0)
return err;
memcpy(new->ldt, old->ldt, old->size * LDT_ENTRY_SIZE);
@ -108,7 +110,6 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
}
/*
*
* Don't touch the LDT register - we're already in the next thread.
*/
void destroy_context(struct mm_struct *mm)
@ -195,7 +196,8 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
mutex_lock(&mm->context.lock);
if (ldt_info.entry_number >= (unsigned)mm->context.size) {
error = alloc_ldt(&current->mm->context, ldt_info.entry_number+1, 1);
error = alloc_ldt(&current->mm->context,
ldt_info.entry_number + 1, 1);
if (error < 0)
goto out_unlock;
}
@ -228,7 +230,8 @@ out:
return error;
}
asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
asmlinkage int sys_modify_ldt(int func, void __user *ptr,
unsigned long bytecount)
{
int ret = -ENOSYS;