aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3
diff options
context:
space:
mode:
authorvignesh babu <vignesh.babu@wipro.com>2007-07-09 14:50:22 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-10 12:22:30 -0400
commitd9da466a3ce2ac005e05bb649a0f2cfb5c3d5d45 (patch)
tree9707bfd17267f1c478196fabcb140c9fcf17f010 /drivers/net/cxgb3
parentde0d3dc0e8ecd80f602fac03feb8fd53d0c17a8c (diff)
use is_power_of_2() in cxgb3/cxgb3_main.c
Replace (n & (n-1)) 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: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 15defe4c4f05..6fd1e5241833 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -43,6 +43,7 @@
43#include <linux/proc_fs.h> 43#include <linux/proc_fs.h>
44#include <linux/rtnetlink.h> 44#include <linux/rtnetlink.h>
45#include <linux/firmware.h> 45#include <linux/firmware.h>
46#include <linux/log2.h>
46#include <asm/uaccess.h> 47#include <asm/uaccess.h>
47 48
48#include "common.h" 49#include "common.h"
@@ -1818,8 +1819,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1818 return -EBUSY; 1819 return -EBUSY;
1819 if (copy_from_user(&m, useraddr, sizeof(m))) 1820 if (copy_from_user(&m, useraddr, sizeof(m)))
1820 return -EFAULT; 1821 return -EFAULT;
1821 if (!m.rx_pg_sz || (m.rx_pg_sz & (m.rx_pg_sz - 1)) || 1822 if (!is_power_of_2(m.rx_pg_sz) ||
1822 !m.tx_pg_sz || (m.tx_pg_sz & (m.tx_pg_sz - 1))) 1823 !is_power_of_2(m.tx_pg_sz))
1823 return -EINVAL; /* not power of 2 */ 1824 return -EINVAL; /* not power of 2 */
1824 if (!(m.rx_pg_sz & 0x14000)) 1825 if (!(m.rx_pg_sz & 0x14000))
1825 return -EINVAL; /* not 16KB or 64KB */ 1826 return -EINVAL; /* not 16KB or 64KB */