summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2012-03-28 21:42:50 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-29 00:14:36 (GMT)
commit5a04cca6c39cdd0b8c75b0628da634248f381b62 (patch)
tree3bb72a3fb05be731f19e97b48d1744783747f43b /kernel
parent423a5bb49ec530ec8bbfc73fd2ded83da8e58684 (diff)
downloadlinux-fsl-qoriq-5a04cca6c39cdd0b8c75b0628da634248f381b62.tar.xz
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')
-rw-r--r--kernel/sysctl.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d48ff4f..dbd70bd 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -23,6 +23,7 @@
#include <linux/swap.h>
#include <linux/slab.h>
#include <linux/sysctl.h>
+#include <linux/bitmap.h>
#include <linux/signal.h>
#include <linux/printk.h>
#include <linux/proc_fs.h>
@@ -2393,9 +2394,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
}
}
- while (val_a <= val_b)
- set_bit(val_a++, tmp_bitmap);
-
+ bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
first = 0;
proc_skip_char(&kbuf, &left, '\n');
}
@@ -2438,8 +2437,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
if (*ppos)
bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
else
- memcpy(bitmap, tmp_bitmap,
- BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long));
+ bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
}
kfree(tmp_bitmap);
*lenp -= left;