Skip to contentSkip to conversation

is_power_of_2-decnet/dn_route.c

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

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

PATCH 1/1 is_power_of_2-decnet/dn_route.c

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

---

net/decnet/dn_route.c +2 -1
index a8bf106..0a67706 100644
@@ -76,6 +76,7 @@
 #include <linux/netfilter_decnet.h>
 #include <linux/rcupdate.h>
 #include <linux/times.h>
+#include <linux/log2.h>
 #include <asm/errno.h>
 #include <net/netlink.h>
 #include <net/neighbour.h>
@@ -1792,7 +1793,7 @@ void __init dn_route_init(void)
 	do {
 		dn_rt_hash_mask = (1UL << order) * PAGE_SIZE /
 			sizeof(struct dn_rt_hash_bucket);
-		while(dn_rt_hash_mask & (dn_rt_hash_mask - 1))
+		while(!is_power_of_2(dn_rt_hash_mask))
 			dn_rt_hash_mask--;
 		dn_rt_hash_table = (struct dn_rt_hash_bucket *)
 			__get_free_pages(GFP_ATOMIC, order);
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