Skip to content

Commit

Permalink
bnx2x: semi-Semantic changes
Browse files Browse the repository at this point in the history
This patch includes a few changes that change the driver's flow without truly
changing anything in its functionality - use usleep_range for short sleeps
instead of msleep and initialize Tx consumer during initialization for better
information during errors.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yuval Mintz authored and David S. Miller committed Jun 3, 2013
1 parent 6bf07b8 commit 639d65b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ int bnx2x_acquire_hw_lock(struct bnx2x *bp, u32 resource)
if (lock_status & resource_bit)
return 0;

msleep(5);
usleep_range(5000, 10000);
}
BNX2X_ERR("Timeout\n");
return -EAGAIN;
Expand Down Expand Up @@ -3640,7 +3640,7 @@ static int bnx2x_acquire_alr(struct bnx2x *bp)
if (val & MCPR_ACCESS_LOCK_LOCK)
break;

msleep(5);
usleep_range(5000, 10000);
}
if (!(val & MCPR_ACCESS_LOCK_LOCK)) {
BNX2X_ERR("Cannot acquire MCP access lock register\n");
Expand Down Expand Up @@ -6078,6 +6078,8 @@ static void bnx2x_init_tx_ring_one(struct bnx2x_fp_txdata *txdata)
BCM_PAGE_SIZE*(i % NUM_TX_RINGS)));
}

*txdata->tx_cons_sb = cpu_to_le16(0);

SET_FLAG(txdata->tx_db.data.header.header, DOORBELL_HDR_DB_TYPE, 1);
txdata->tx_db.data.zero_fill1 = 0;
txdata->tx_db.data.prod = 0;
Expand Down Expand Up @@ -6329,7 +6331,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
if (val == 0x10)
break;

msleep(10);
usleep_range(10000, 20000);
count--;
}
if (val != 0x10) {
Expand All @@ -6344,7 +6346,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
if (val == 1)
break;

msleep(10);
usleep_range(10000, 20000);
count--;
}
if (val != 0x1) {
Expand Down Expand Up @@ -6385,7 +6387,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
if (val == 0xb0)
break;

msleep(10);
usleep_range(10000, 20000);
count--;
}
if (val != 0xb0) {
Expand Down Expand Up @@ -8500,7 +8502,7 @@ static void bnx2x_reset_func(struct bnx2x *bp)
* scan to complete
*/
for (i = 0; i < 200; i++) {
msleep(10);
usleep_range(10000, 20000);
if (!REG_RD(bp, TM_REG_LIN0_SCAN_ON + port*4))
break;
}
Expand Down

0 comments on commit 639d65b

Please sign in to comment.