is_power_of_2: ufs/super.c
authorvignesh babu <vignesh.babu@wipro.com>
Mon, 16 Jul 2007 06:41:36 +0000 (23:41 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 16 Jul 2007 16:05:50 +0000 (09:05 -0700)
Replace (n & (n-1)) with is_power_of_2

Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Acked-by: Evgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ufs/super.c

index 22ff6ed55ce9a2d685024bfadf3aabb1eed68fa5..2b3011689e89e4aff651b3f3f8ca05775d3d4a78 100644 (file)
@@ -87,6 +87,7 @@
 #include <linux/smp_lock.h>
 #include <linux/buffer_head.h>
 #include <linux/vfs.h>
+#include <linux/log2.h>
 
 #include "swab.h"
 #include "util.h"
@@ -854,7 +855,7 @@ magic_found:
        uspi->s_fmask = fs32_to_cpu(sb, usb1->fs_fmask);
        uspi->s_fshift = fs32_to_cpu(sb, usb1->fs_fshift);
 
-       if (uspi->s_fsize & (uspi->s_fsize - 1)) {
+       if (!is_power_of_2(uspi->s_fsize)) {
                printk(KERN_ERR "ufs_read_super: fragment size %u is not a power of 2\n",
                        uspi->s_fsize);
                        goto failed;
@@ -869,7 +870,7 @@ magic_found:
                        uspi->s_fsize);
                goto failed;
        }
-       if (uspi->s_bsize & (uspi->s_bsize - 1)) {
+       if (!is_power_of_2(uspi->s_bsize)) {
                printk(KERN_ERR "ufs_read_super: block size %u is not a power of 2\n",
                        uspi->s_bsize);
                goto failed;