BNX2X: Spatch ilog2 -> LOG2_UP
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 6 Feb 2015 23:25:39 +0000 (18:25 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 2 Mar 2015 16:59:09 +0000 (11:59 -0500)
kern/drivers/net/bnx2x/bnx2x.h
kern/drivers/net/bnx2x/bnx2x_main.c
kern/drivers/net/bnx2x/bnx2x_sriov.c
scripts/spatch/linux/funcs.cocci

index 1b540a8..fcc6960 100644 (file)
@@ -2198,7 +2198,7 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, uint8_t func,
                } \
        } while (0)
 
-#define ILOG2(x)       (ilog2((x)))
+#define ILOG2(x)       (LOG2_UP((x)))
 
 #define ILT_NUM_PAGE_ENTRIES   (3072)
 /* In 57710/11 we use whole table since we have 8 func
index a143c80..72175a9 100644 (file)
@@ -8483,7 +8483,7 @@ void bnx2x_ilt_set_info(struct bnx2x *bp)
           ilt_client->end,
           ilt_client->page_size,
           ilt_client->flags,
-          ilog2(ilt_client->page_size >> 12));
+          LOG2_UP(ilt_client->page_size >> 12));
 
        /* QM */
        if (QM_INIT(bp->qm_cid_count)) {
@@ -8505,7 +8505,7 @@ void bnx2x_ilt_set_info(struct bnx2x *bp)
                   ilt_client->end,
                   ilt_client->page_size,
                   ilt_client->flags,
-                  ilog2(ilt_client->page_size >> 12));
+                  LOG2_UP(ilt_client->page_size >> 12));
        }
 
        if (CNIC_SUPPORT(bp)) {
@@ -8524,7 +8524,7 @@ void bnx2x_ilt_set_info(struct bnx2x *bp)
                   ilt_client->end,
                   ilt_client->page_size,
                   ilt_client->flags,
-                  ilog2(ilt_client->page_size >> 12));
+                  LOG2_UP(ilt_client->page_size >> 12));
 
                /* TM */
                ilt_client = &ilt->clients[ILT_CLIENT_TM];
@@ -8541,7 +8541,7 @@ void bnx2x_ilt_set_info(struct bnx2x *bp)
                   ilt_client->end,
                   ilt_client->page_size,
                   ilt_client->flags,
-                  ilog2(ilt_client->page_size >> 12));
+                  LOG2_UP(ilt_client->page_size >> 12));
        }
 
        BUG_ON(line > ILT_MAX_LINES);
index 52fefb4..8a8fd42 100644 (file)
@@ -888,7 +888,7 @@ bnx2x_iov_static_resc(struct bnx2x *bp, struct bnx2x_virtf *vf)
        /* divvy up vlan rules */
        bnx2x_iov_re_set_vlan_filters(bp, vf, 0);
        vlan_count = bp->vlans_pool.check(&bp->vlans_pool);
-       vlan_count = 1 << ilog2(vlan_count);
+       vlan_count = 1 << LOG2_UP(vlan_count);
        bnx2x_iov_re_set_vlan_filters(bp, vf,
                                      vlan_count / BNX2X_NR_VIRTFN(bp));
 
@@ -1053,7 +1053,7 @@ void bnx2x_iov_init_dq(struct bnx2x *bp)
 
        /* Set the DQ such that the CID reflect the abs_vfid */
        REG_WR(bp, DORQ_REG_VF_NORM_VF_BASE, 0);
-       REG_WR(bp, DORQ_REG_MAX_RVFID_SIZE, ilog2(BNX2X_MAX_NUM_OF_VFS));
+       REG_WR(bp, DORQ_REG_MAX_RVFID_SIZE, LOG2_UP(BNX2X_MAX_NUM_OF_VFS));
 
        /* Set VFs starting CID. If its > 0 the preceding CIDs are belong to
         * the PF L2 queues
index 7d3983f..a3790b5 100644 (file)
@@ -123,3 +123,9 @@ expression E;
 @@
 -spin_unlock_irq(E)
 +spin_unlock_irqsave(E)
+
+@@
+expression E;
+@@
+-ilog2(E)
++LOG2_UP(E)