summaryrefslogtreecommitdiff
path: root/kernel/kfifo.c
diff options
context:
space:
mode:
authorvignesh babu <vignesh.babu@wipro.com>2007-07-15 23:41:34 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 09:05:50 -0700
commitf84d5a76c50d9752cdec64a6e536ee3901b267f6 (patch)
tree3de21bf763be7a70a0c32f6d68d3c9ef8d2fc00f /kernel/kfifo.c
parentcf99abace7e07dd8491e7093a9a9ef11d48838ed (diff)
is_power_of_2: kernel/kfifo.c
Replace (n & (n-1)) with is_power_of_2() Signed-off-by: vignesh babu <vignesh.babu@wipro.com> Acked-by: Stelian Pop <stelian@popies.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/kfifo.c')
-rw-r--r--kernel/kfifo.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/kfifo.c b/kernel/kfifo.c
index cee419143fd4..bc41ad0f24f8 100644
--- a/kernel/kfifo.c
+++ b/kernel/kfifo.c
@@ -24,6 +24,7 @@
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/kfifo.h>
+#include <linux/log2.h>
/**
* kfifo_init - allocates a new FIFO using a preallocated buffer
@@ -41,7 +42,7 @@ struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size,
struct kfifo *fifo;
/* size must be a power of 2 */
- BUG_ON(size & (size - 1));
+ BUG_ON(!is_power_of_2(size));
fifo = kmalloc(sizeof(struct kfifo), gfp_mask);
if (!fifo)