use is_power_of_2() in cxgb3/cxgb3_main.c
Subsystems (2)
PATCH 5/7 use is_power_of_2() in cxgb3/cxgb3_main.c
From: vignesh babu <[email protected]>
Replace (n & (n-1)) with is_power_of_2()
Signed-off-by vignesh babu <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
drivers/net/cxgb3/cxgb3_main.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/cxgb3/cxgb3_main.c renamed from drivers/net/cxgb3/cxgb3_main.c~use-is_power_of_2-in-cxgb3-cxgb3_mainc +3 -2
@@ -43,6 +43,7 @@#include <linux/proc_fs.h> #include <linux/rtnetlink.h> #include <linux/firmware.h> +#include <linux/log2.h> #include <asm/uaccess.h> #include "common.h"
@@ -1818,8 +1819,8 @@ static int cxgb_extension_ioctl(struct nreturn -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 */
_