Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f2f58178f497ca56501d44d79982621e19c5007f
Commit:     f2f58178f497ca56501d44d79982621e19c5007f
Parent:     3ebc51d7c95425c3b4667fa042576fb1c6e2ea16
Author:     Thomas Gleixner <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 30 13:30:23 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 13:30:23 2008 +0100

    x86: simplify set_bitmap in ioport_32.c
    
    Simplify set_bitmap(). This is not in a hotpath and we really can use the
    straight forward loop through those bits. A similar implementation is used
    in the 64 bit code as well.
    
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 arch/x86/kernel/ioport_32.c |   32 ++++++--------------------------
 1 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/arch/x86/kernel/ioport_32.c b/arch/x86/kernel/ioport_32.c
index 4ed48dc..c5a6401 100644
--- a/arch/x86/kernel/ioport_32.c
+++ b/arch/x86/kernel/ioport_32.c
@@ -16,36 +16,16 @@
 #include <linux/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)
+static void set_bitmap(unsigned long *bitmap, unsigned int base,
+                      unsigned int extent, int new_value)
 {
-       unsigned long mask;
-       unsigned long *bitmap_base = bitmap + (base / BITS_PER_LONG);
-       unsigned int low_index = base & (BITS_PER_LONG-1);
-       int length = low_index + extent;
-
-       if (low_index != 0) {
-               mask = (~0UL << low_index);
-               if (length < BITS_PER_LONG)
-                       mask &= ~(~0UL << length);
-               if (new_value)
-                       *bitmap_base++ |= mask;
-               else
-                       *bitmap_base++ &= ~mask;
-               length -= BITS_PER_LONG;
-       }
-
-       mask = (new_value ? ~0UL : 0UL);
-       while (length >= BITS_PER_LONG) {
-               *bitmap_base++ = mask;
-               length -= BITS_PER_LONG;
-       }
+       unsigned int i;
 
-       if (length > 0) {
-               mask = ~(~0UL << length);
+       for (i = base; i < base + extent; i++) {
                if (new_value)
-                       *bitmap_base++ |= mask;
+                       __set_bit(i, bitmap);
                else
-                       *bitmap_base++ &= ~mask;
+                       __clear_bit(i, bitmap);
        }
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to