aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ioport_32.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-01-30 07:30:24 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:24 -0500
commit9a211abeaab74e2634669a64ebd82fac5d94d276 (patch)
tree8c203795c369aeeeb960a5391278cc568c0ad261 /arch/x86/kernel/ioport_32.c
parentf2f58178f497ca56501d44d79982621e19c5007f (diff)
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 <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/ioport_32.c')
-rw-r--r--arch/x86/kernel/ioport_32.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/arch/x86/kernel/ioport_32.c b/arch/x86/kernel/ioport_32.c
index c5a64011764f..c281ffa18259 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,
29 } 29 }
30} 30}
31 31
32
33/* 32/*
34 * this changes the io permissions bitmap in the current task. 33 * this changes the io permissions bitmap in the current task.
35 */ 34 */
36asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) 35asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
37{ 36{
38 unsigned long i, max_long, bytes, bytes_updated;
39 struct thread_struct * t = &current->thread; 37 struct thread_struct * t = &current->thread;
40 struct tss_struct * tss; 38 struct tss_struct * tss;
41 unsigned long *bitmap; 39 unsigned long i, max_long;
42 40
43 if ((from + num <= from) || (from + num > IO_BITMAP_BITS)) 41 if ((from + num <= from) || (from + num > IO_BITMAP_BITS))
44 return -EINVAL; 42 return -EINVAL;
@@ -51,7 +49,8 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
51 * this is why we delay this operation until now: 49 * this is why we delay this operation until now:
52 */ 50 */
53 if (!t->io_bitmap_ptr) { 51 if (!t->io_bitmap_ptr) {
54 bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); 52 unsigned long *bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
53
55 if (!bitmap) 54 if (!bitmap)
56 return -ENOMEM; 55 return -ENOMEM;
57 56
@@ -80,10 +79,7 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
80 if (t->io_bitmap_ptr[i] != ~0UL) 79 if (t->io_bitmap_ptr[i] != ~0UL)
81 max_long = i; 80 max_long = i;
82 81
83 bytes = (max_long + 1) * sizeof(long); 82 t->io_bitmap_max = (max_long + 1) * sizeof(unsigned long);
84 bytes_updated = max(bytes, t->io_bitmap_max);
85
86 t->io_bitmap_max = bytes;
87 83
88 /* 84 /*
89 * Sets the lazy trigger so that the next I/O operation will 85 * 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 * code. 106 * code.
111 */ 107 */
112 108
113asmlinkage long sys_iopl(unsigned long unused) 109asmlinkage long sys_iopl(unsigned long regsp)
114{ 110{
115 volatile struct pt_regs * regs = (struct pt_regs *) &unused; 111 volatile struct pt_regs *regs = (struct pt_regs *)&regsp;
116 unsigned int level = regs->ebx; 112 unsigned int level = regs->ebx;
117 unsigned int old = (regs->eflags >> 12) & 3; 113 unsigned int old = (regs->eflags >> 12) & 3;
118 struct thread_struct *t = &current->thread; 114 struct thread_struct *t = &current->thread;
@@ -124,8 +120,10 @@ asmlinkage long sys_iopl(unsigned long unused)
124 if (!capable(CAP_SYS_RAWIO)) 120 if (!capable(CAP_SYS_RAWIO))
125 return -EPERM; 121 return -EPERM;
126 } 122 }
123
127 t->iopl = level << 12; 124 t->iopl = level << 12;
128 regs->eflags = (regs->eflags & ~X86_EFLAGS_IOPL) | t->iopl; 125 regs->eflags = (regs->eflags & ~X86_EFLAGS_IOPL) | t->iopl;
129 set_iopl_mask(t->iopl); 126 set_iopl_mask(t->iopl);
127
130 return 0; 128 return 0;
131} 129}