From: vignesh babu Date: Mon, 9 Jul 2007 18:50:22 +0000 (-0700) Subject: use is_power_of_2() in cxgb3/cxgb3_main.c X-Git-Tag: MMI-PSA29.97-13-9~42340^2~26 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d9da466a3ce2ac005e05bb649a0f2cfb5c3d5d45;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git use is_power_of_2() in cxgb3/cxgb3_main.c Replace (n & (n-1)) with is_power_of_2() Signed-off-by: vignesh babu Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- 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 @@ #include #include #include +#include #include #include "common.h" @@ -1818,8 +1819,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) return -EBUSY; if (copy_from_user(&m, useraddr, sizeof(m))) return -EFAULT; - if (!m.rx_pg_sz || (m.rx_pg_sz & (m.rx_pg_sz - 1)) || - !m.tx_pg_sz || (m.tx_pg_sz & (m.tx_pg_sz - 1))) + if (!is_power_of_2(m.rx_pg_sz) || + !is_power_of_2(m.tx_pg_sz)) return -EINVAL; /* not power of 2 */ if (!(m.rx_pg_sz & 0x14000)) return -EINVAL; /* not 16KB or 64KB */