Commit da1016df authored by Akinobu Mita's avatar Akinobu Mita Committed by Ingo Molnar

x86: Use bitmap library functions

Use bitmap_set()/bitmap_clear() to fill/zero a region of a
bitmap instead of doing set_bit()/clear_bit() each bit.

This change has been tested with ioperm() and there's no
change in behavior.
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
LKML-Reference: <1297867715-20394-1-git-send-email-akinobu.mita@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent b82fef82
...@@ -14,22 +14,9 @@ ...@@ -14,22 +14,9 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/thread_info.h> #include <linux/thread_info.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <linux/bitmap.h>
#include <asm/syscalls.h> #include <asm/syscalls.h>
/* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */
static void set_bitmap(unsigned long *bitmap, unsigned int base,
unsigned int extent, int new_value)
{
unsigned int i;
for (i = base; i < base + extent; i++) {
if (new_value)
__set_bit(i, bitmap);
else
__clear_bit(i, bitmap);
}
}
/* /*
* this changes the io permissions bitmap in the current task. * this changes the io permissions bitmap in the current task.
*/ */
...@@ -69,7 +56,10 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) ...@@ -69,7 +56,10 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
*/ */
tss = &per_cpu(init_tss, get_cpu()); tss = &per_cpu(init_tss, get_cpu());
set_bitmap(t->io_bitmap_ptr, from, num, !turn_on); if (turn_on)
bitmap_clear(t->io_bitmap_ptr, from, num);
else
bitmap_set(t->io_bitmap_ptr, from, num);
/* /*
* Search for a (possibly new) maximum. This is simple and stupid, * Search for a (possibly new) maximum. This is simple and stupid,
......
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