aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorVignesh Babu BM <vignesh.babu@wipro.com>2007-05-08 03:24:32 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:14:59 -0400
commit1368c4f2482c9e06bcb297217433818b171cc9e3 (patch)
tree0b9da8f7841e370cb44de9504843591a223b8c1d /fs/block_dev.c
parente1b5c1d3da05c91129120d045dfcdfc7761f44f1 (diff)
is_power_of_2 in fs/block_dev.c
Replace (n & (n-1)) in the context of power of 2 checks with is_power_of_2 Signed-off-by: vignesh babu <vignesh.babu@wipro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index f02b7bdd9864..742899240872 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -22,6 +22,7 @@
22#include <linux/mount.h> 22#include <linux/mount.h>
23#include <linux/uio.h> 23#include <linux/uio.h>
24#include <linux/namei.h> 24#include <linux/namei.h>
25#include <linux/log2.h>
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include "internal.h" 27#include "internal.h"
27 28
@@ -67,7 +68,7 @@ static void kill_bdev(struct block_device *bdev)
67int set_blocksize(struct block_device *bdev, int size) 68int set_blocksize(struct block_device *bdev, int size)
68{ 69{
69 /* Size must be a power of two, and between 512 and PAGE_SIZE */ 70 /* Size must be a power of two, and between 512 and PAGE_SIZE */
70 if (size > PAGE_SIZE || size < 512 || (size & (size-1))) 71 if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size))
71 return -EINVAL; 72 return -EINVAL;
72 73
73 /* Size cannot be smaller than the size supported by the device */ 74 /* Size cannot be smaller than the size supported by the device */