diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2012-03-28 17:42:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 20:14:36 -0400 |
commit | 5a04cca6c39cdd0b8c75b0628da634248f381b62 (patch) | |
tree | 3bb72a3fb05be731f19e97b48d1744783747f43b /kernel/sysctl.c | |
parent | 423a5bb49ec530ec8bbfc73fd2ded83da8e58684 (diff) |
sysctl: use bitmap library functions
Use bitmap_set() instead of using set_bit() for each bit. This conversion
is valid because the bitmap is private in the function call and atomic
bitops were unnecessary.
This also includes minor change.
- Use bitmap_copy() for shorter typing
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index d48ff4fd44c3..dbd70bdc1765 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/swap.h> | 23 | #include <linux/swap.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/sysctl.h> | 25 | #include <linux/sysctl.h> |
26 | #include <linux/bitmap.h> | ||
26 | #include <linux/signal.h> | 27 | #include <linux/signal.h> |
27 | #include <linux/printk.h> | 28 | #include <linux/printk.h> |
28 | #include <linux/proc_fs.h> | 29 | #include <linux/proc_fs.h> |
@@ -2393,9 +2394,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, | |||
2393 | } | 2394 | } |
2394 | } | 2395 | } |
2395 | 2396 | ||
2396 | while (val_a <= val_b) | 2397 | bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1); |
2397 | set_bit(val_a++, tmp_bitmap); | ||
2398 | |||
2399 | first = 0; | 2398 | first = 0; |
2400 | proc_skip_char(&kbuf, &left, '\n'); | 2399 | proc_skip_char(&kbuf, &left, '\n'); |
2401 | } | 2400 | } |
@@ -2438,8 +2437,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write, | |||
2438 | if (*ppos) | 2437 | if (*ppos) |
2439 | bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len); | 2438 | bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len); |
2440 | else | 2439 | else |
2441 | memcpy(bitmap, tmp_bitmap, | 2440 | bitmap_copy(bitmap, tmp_bitmap, bitmap_len); |
2442 | BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long)); | ||
2443 | } | 2441 | } |
2444 | kfree(tmp_bitmap); | 2442 | kfree(tmp_bitmap); |
2445 | *lenp -= left; | 2443 | *lenp -= left; |