summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/i40iw/i40iw_cm.c
diff options
context:
space:
mode:
authorShiraz Saleem <shiraz.saleem@intel.com>2017-12-22 09:46:55 -0600
committerJason Gunthorpe <jgg@mellanox.com>2017-12-22 13:37:51 -0700
commit8758768ad8aa9fc0d56417315dec65b610fc3a21 (patch)
tree1116f92251be999cd39cfc5e9dd856feabd02484 /drivers/infiniband/hw/i40iw/i40iw_cm.c
parentf32b766cf787bba1bea111f43edac3f32b45a4e9 (diff)
downloadlinux-stable-8758768ad8aa9fc0d56417315dec65b610fc3a21.tar.gz
linux-stable-8758768ad8aa9fc0d56417315dec65b610fc3a21.tar.bz2
linux-stable-8758768ad8aa9fc0d56417315dec65b610fc3a21.zip
i40iw: Use utility function roundup_pow_of_two()
Consolidate all power of 2 round calculations to use kernel utility function roundup_pow_of_two(). Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/i40iw/i40iw_cm.c')
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_cm.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c
index 493d6ef3d2d5..03e6fc67d955 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
@@ -92,14 +92,9 @@ void i40iw_free_sqbuf(struct i40iw_sc_vsi *vsi, void *bufp)
static u8 i40iw_derive_hw_ird_setting(u16 cm_ird)
{
u8 encoded_ird_size;
- u8 pof2_cm_ird = 1;
-
- /* round-off to next powerof2 */
- while (pof2_cm_ird < cm_ird)
- pof2_cm_ird *= 2;
/* ird_size field is encoded in qp_ctx */
- switch (pof2_cm_ird) {
+ switch (cm_ird ? roundup_pow_of_two(cm_ird) : 0) {
case I40IW_HW_IRD_SETTING_64:
encoded_ird_size = 3;
break;