diff options
| author | vignesh babu <vignesh.babu@wipro.com> | 2007-07-16 02:41:34 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:50 -0400 |
| commit | f84d5a76c50d9752cdec64a6e536ee3901b267f6 (patch) | |
| tree | 3de21bf763be7a70a0c32f6d68d3c9ef8d2fc00f /kernel | |
| parent | cf99abace7e07dd8491e7093a9a9ef11d48838ed (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')
| -rw-r--r-- | kernel/kfifo.c | 3 |
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 @@ | |||
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
| 26 | #include <linux/kfifo.h> | 26 | #include <linux/kfifo.h> |
| 27 | #include <linux/log2.h> | ||
| 27 | 28 | ||
| 28 | /** | 29 | /** |
| 29 | * kfifo_init - allocates a new FIFO using a preallocated buffer | 30 | * kfifo_init - allocates a new FIFO using a preallocated buffer |
| @@ -41,7 +42,7 @@ struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, | |||
| 41 | struct kfifo *fifo; | 42 | struct kfifo *fifo; |
| 42 | 43 | ||
| 43 | /* size must be a power of 2 */ | 44 | /* size must be a power of 2 */ |
| 44 | BUG_ON(size & (size - 1)); | 45 | BUG_ON(!is_power_of_2(size)); |
| 45 | 46 | ||
| 46 | fifo = kmalloc(sizeof(struct kfifo), gfp_mask); | 47 | fifo = kmalloc(sizeof(struct kfifo), gfp_mask); |
| 47 | if (!fifo) | 48 | if (!fifo) |
