cnic: Convert cnic_local_flags to atomic ops.
authorMichael Chan <mchan@broadcom.com>
Tue, 18 May 2010 11:32:52 +0000 (11:32 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 May 2010 22:16:44 +0000 (15:16 -0700)
It is easier to expand the flags for other purposes because it does
not require a spin_lock.  The next bug fix patch needs a flag in
cnic_local_flags.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/cnic.c
drivers/net/cnic.h

index 4b08b18ca5d66acb2be1f41a9f41b59b24a3d228..7c6d325b880a4574a4f2a13d9c1d1cd83aaa4446 100644 (file)
@@ -1143,12 +1143,12 @@ static int cnic_submit_bnx2_kwqes(struct cnic_dev *dev, struct kwqe *wqes[],
 
        spin_lock_bh(&cp->cnic_ulp_lock);
        if (num_wqes > cnic_kwq_avail(cp) &&
-           !(cp->cnic_local_flags & CNIC_LCL_FL_KWQ_INIT)) {
+           !test_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags)) {
                spin_unlock_bh(&cp->cnic_ulp_lock);
                return -EAGAIN;
        }
 
-       cp->cnic_local_flags &= ~CNIC_LCL_FL_KWQ_INIT;
+       clear_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags);
 
        prod = cp->kwq_prod_idx;
        sw_prod = prod & MAX_KWQ_IDX;
@@ -3690,7 +3690,7 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
        cp->max_kwq_idx = MAX_KWQ_IDX;
        cp->kwq_prod_idx = 0;
        cp->kwq_con_idx = 0;
-       cp->cnic_local_flags |= CNIC_LCL_FL_KWQ_INIT;
+       set_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags);
 
        if (CHIP_NUM(cp) == CHIP_NUM_5706 || CHIP_NUM(cp) == CHIP_NUM_5708)
                cp->kwq_con_idx_ptr = &sblk->status_rx_quick_consumer_index15;
index a0d853dff983a31ab9a8a1fb235c18cae3f05169..4422497249d17c8f55cab6f3940cbb12fade1149 100644 (file)
@@ -179,9 +179,8 @@ struct cnic_local {
 #define ULP_F_CALL_PENDING     2
        struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE];
 
-       /* protected by ulp_lock */
-       u32 cnic_local_flags;
-#define        CNIC_LCL_FL_KWQ_INIT    0x00000001
+       unsigned long cnic_local_flags;
+#define        CNIC_LCL_FL_KWQ_INIT            0x0
 
        struct cnic_dev *dev;