Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79766
b: refs/heads/master
c: f2f5817
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Jan 30, 2008
1 parent 2d24837 commit 553ddf7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3ebc51d7c95425c3b4667fa042576fb1c6e2ea16
refs/heads/master: f2f58178f497ca56501d44d79982621e19c5007f
32 changes: 6 additions & 26 deletions trunk/arch/x86/kernel/ioport_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 553ddf7

Please sign in to comment.