mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86: use bitmap library functions
@ 2011-02-16 14:48 Akinobu Mita
  2011-02-16 15:38 ` Ingo Molnar
  2011-02-17 15:05 ` [tip:x86/asm] x86: Use " tip-bot for Akinobu Mita
  0 siblings, 2 replies; 5+ messages in thread
From: Akinobu Mita @ 2011-02-16 14:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Akinobu Mita, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86

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

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/x86/kernel/ioport.c |   20 +++++---------------
 1 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index 8eec0ec..8c96897 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -14,22 +14,9 @@
 #include <linux/slab.h>
 #include <linux/thread_info.h>
 #include <linux/syscalls.h>
+#include <linux/bitmap.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.
  */
@@ -69,7 +56,10 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
 	 */
 	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,
-- 
1.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-17 15:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-16 14:48 [PATCH] x86: use bitmap library functions Akinobu Mita
2011-02-16 15:38 ` Ingo Molnar
2011-02-17  5:00   ` Akinobu Mita
2011-02-17 13:59     ` Ingo Molnar
2011-02-17 15:05 ` [tip:x86/asm] x86: Use " tip-bot for Akinobu Mita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome