VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Rasmus Villemoes <linux@rasmusvillemoes.dk> 2016-01-15 16:59:06 -0800 committer: Linus Torvalds <torvalds@linux-foundation.org> 2016-01-16 11:17:29 -0800 commit: 857cca4d565d85857597ccf0b6f72cf0f06e046c parent: b79a7db37d560c9e4b6fdb5314cb8b226a2d6567
Commit Summary:
lib/test_printf.c: add test for large bitmaps
Diffstat:
1 file changed, 15 insertions, 0 deletions
diff --git a/lib/test_printf.c b/lib/test_printf.c
index 3e21170d327d..60740c10c3e8 100644
--- a/lib/test_printf.c
+++ b/lib/test_printf.c
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 
+#include <linux/bitmap.h>
 #include <linux/socket.h>
 #include <linux/in.h>
 
@@ -340,6 +341,20 @@ struct_clk(void)
 {
 }
 
+static void __init
+large_bitmap(void)
+{
+	const int nbits = 1 << 16;
+	unsigned long *bits = kcalloc(BITS_TO_LONGS(nbits), sizeof(long), GFP_KERNEL);
+	if (!bits)
+		return;
+
+	bitmap_set(bits, 1, 20);
+	bitmap_set(bits, 60000, 15);
+	test("1-20,60000-60014", "%*pbl", nbits, bits);
+	kfree(bits);
+}
+
 static void __init
 bitmap(void)
 {
@@ -359,6 +374,8 @@ bitmap(void)
 	bitmap_fill(bits, 20);
 	test("fffff|fffff", "%20pb|%*pb", bits, 20, bits);
 	test("0-19|0-19", "%20pbl|%*pbl", bits, 20, bits);
+
+	large_bitmap();
 }
 
 static void __init