Commit 9a211abe authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

x86: clean up ioport_32.c

Remove unused variables, rename the "unused" argument to regp. It is used !
Codingstyle fixes.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent f2f58178
...@@ -29,16 +29,14 @@ static void set_bitmap(unsigned long *bitmap, unsigned int base, ...@@ -29,16 +29,14 @@ static void set_bitmap(unsigned long *bitmap, unsigned int base,
} }
} }
/* /*
* this changes the io permissions bitmap in the current task. * this changes the io permissions bitmap in the current task.
*/ */
asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
{ {
unsigned long i, max_long, bytes, bytes_updated;
struct thread_struct * t = &current->thread; struct thread_struct * t = &current->thread;
struct tss_struct * tss; struct tss_struct * tss;
unsigned long *bitmap; unsigned long i, max_long;
if ((from + num <= from) || (from + num > IO_BITMAP_BITS)) if ((from + num <= from) || (from + num > IO_BITMAP_BITS))
return -EINVAL; return -EINVAL;
...@@ -51,7 +49,8 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) ...@@ -51,7 +49,8 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
* this is why we delay this operation until now: * this is why we delay this operation until now:
*/ */
if (!t->io_bitmap_ptr) { if (!t->io_bitmap_ptr) {
bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); unsigned long *bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
if (!bitmap) if (!bitmap)
return -ENOMEM; return -ENOMEM;
...@@ -80,10 +79,7 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) ...@@ -80,10 +79,7 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
if (t->io_bitmap_ptr[i] != ~0UL) if (t->io_bitmap_ptr[i] != ~0UL)
max_long = i; max_long = i;
bytes = (max_long + 1) * sizeof(long); t->io_bitmap_max = (max_long + 1) * sizeof(unsigned long);
bytes_updated = max(bytes, t->io_bitmap_max);
t->io_bitmap_max = bytes;
/* /*
* Sets the lazy trigger so that the next I/O operation will * Sets the lazy trigger so that the next I/O operation will
...@@ -110,9 +106,9 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) ...@@ -110,9 +106,9 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
* code. * code.
*/ */
asmlinkage long sys_iopl(unsigned long unused) asmlinkage long sys_iopl(unsigned long regsp)
{ {
volatile struct pt_regs * regs = (struct pt_regs *) &unused; volatile struct pt_regs *regs = (struct pt_regs *)&regsp;
unsigned int level = regs->ebx; unsigned int level = regs->ebx;
unsigned int old = (regs->eflags >> 12) & 3; unsigned int old = (regs->eflags >> 12) & 3;
struct thread_struct *t = &current->thread; struct thread_struct *t = &current->thread;
...@@ -124,8 +120,10 @@ asmlinkage long sys_iopl(unsigned long unused) ...@@ -124,8 +120,10 @@ asmlinkage long sys_iopl(unsigned long unused)
if (!capable(CAP_SYS_RAWIO)) if (!capable(CAP_SYS_RAWIO))
return -EPERM; return -EPERM;
} }
t->iopl = level << 12; t->iopl = level << 12;
regs->eflags = (regs->eflags & ~X86_EFLAGS_IOPL) | t->iopl; regs->eflags = (regs->eflags & ~X86_EFLAGS_IOPL) | t->iopl;
set_iopl_mask(t->iopl); set_iopl_mask(t->iopl);
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment