Skip to contentSkip to conversation

is_power_of_2-s390/block/dasd_int.h

PATCH New vignesh babu 1 participant 1 message Jun 12, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 is_power_of_2-s390/block/dasd_int.h

Replacing (n & (n-1)) in the context of power of 2 checks with is_power_of_2

---

drivers/s390/block/dasd_int.h +2 -1
index 241294c..5c28cb4 100644
@@ -53,6 +53,7 @@
 #include <linux/genhd.h>
 #include <linux/hdreg.h>
 #include <linux/interrupt.h>
+#include <linux/log2.h>
 #include <asm/ccwdev.h>
 #include <linux/workqueue.h>
 #include <asm/debug.h>
@@ -456,7 +457,7 @@ dasd_free_chunk(struct list_head *chunk_list, void *mem)
 static inline int
 dasd_check_blocksize(int bsize)
 {
-	if (bsize < 512 || bsize > 4096 || (bsize & (bsize - 1)) != 0)
+	if (bsize < 512 || bsize > 4096 || !is_power_of_2(bsize))
 		return -EMEDIUMTYPE;
 	return 0;
 }
Signature · 8 lines
Vignesh Babu BM 
_____________________________________________________________ 
"Why is it that every time I'm with you, makes me believe in magic?"

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors