From: Thomas Gleixner Date: Wed, 30 Jan 2008 12:30:24 +0000 (+0100) Subject: x86: clean up ioport_32.c X-Git-Tag: v2.6.25-rc1~1143^2~808 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a211abeaab74e2634669a64ebd82fac5d94d276;p=linux-2.6 x86: clean up ioport_32.c Remove unused variables, rename the "unused" argument to regp. It is used ! Codingstyle fixes. Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/kernel/ioport_32.c b/arch/x86/kernel/ioport_32.c index c5a6401176..c281ffa182 100644 --- a/arch/x86/kernel/ioport_32.c +++ b/arch/x86/kernel/ioport_32.c @@ -29,16 +29,14 @@ static void set_bitmap(unsigned long *bitmap, unsigned int base, } } - /* * this changes the io permissions bitmap in the current task. */ 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 = ¤t->thread; struct tss_struct * tss; - unsigned long *bitmap; + unsigned long i, max_long; if ((from + num <= from) || (from + num > IO_BITMAP_BITS)) return -EINVAL; @@ -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: */ if (!t->io_bitmap_ptr) { - bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); + unsigned long *bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); + if (!bitmap) return -ENOMEM; @@ -80,10 +79,7 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) if (t->io_bitmap_ptr[i] != ~0UL) max_long = i; - bytes = (max_long + 1) * sizeof(long); - bytes_updated = max(bytes, t->io_bitmap_max); - - t->io_bitmap_max = bytes; + t->io_bitmap_max = (max_long + 1) * sizeof(unsigned long); /* * 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) * 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 *)®sp; unsigned int level = regs->ebx; unsigned int old = (regs->eflags >> 12) & 3; struct thread_struct *t = ¤t->thread; @@ -124,8 +120,10 @@ asmlinkage long sys_iopl(unsigned long unused) if (!capable(CAP_SYS_RAWIO)) return -EPERM; } + t->iopl = level << 12; regs->eflags = (regs->eflags & ~X86_EFLAGS_IOPL) | t->iopl; set_iopl_mask(t->iopl); + return 0; }