]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[NET]: is_power_of_2 in net/core/neighbour.c
authorvignesh babu <vignesh.babu@wipro.com>
Sat, 25 Aug 2007 05:27:55 +0000 (22:27 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 27 Aug 2007 01:35:37 +0000 (18:35 -0700)
Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)

Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/neighbour.c

index ca2a1533138a21dc6d19a8be243627774cbd2167..f7de8f24d8dd9a63b9d87bbdcd904333e6ba5b09 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/rtnetlink.h>
 #include <linux/random.h>
 #include <linux/string.h>
+#include <linux/log2.h>
 
 #define NEIGH_DEBUG 1
 
@@ -311,7 +312,7 @@ static void neigh_hash_grow(struct neigh_table *tbl, unsigned long new_entries)
 
        NEIGH_CACHE_STAT_INC(tbl, hash_grows);
 
-       BUG_ON(new_entries & (new_entries - 1));
+       BUG_ON(!is_power_of_2(new_entries));
        new_hash = neigh_hash_alloc(new_entries);
        if (!new_hash)
                return;