aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlge/qlge_mpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/qlge/qlge_mpi.c')
-rw-r--r--drivers/net/qlge/qlge_mpi.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c
index 80b68539c5aa..bac7b86f2129 100644
--- a/drivers/net/qlge/qlge_mpi.c
+++ b/drivers/net/qlge/qlge_mpi.c
@@ -454,7 +454,8 @@ end:
454 */ 454 */
455static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) 455static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
456{ 456{
457 int status, count; 457 int status;
458 unsigned long count;
458 459
459 460
460 /* Begin polled mode for MPI */ 461 /* Begin polled mode for MPI */
@@ -475,9 +476,9 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
475 /* Wait for the command to complete. We loop 476 /* Wait for the command to complete. We loop
476 * here because some AEN might arrive while 477 * here because some AEN might arrive while
477 * we're waiting for the mailbox command to 478 * we're waiting for the mailbox command to
478 * complete. If more than 5 arrive then we can 479 * complete. If more than 5 seconds expire we can
479 * assume something is wrong. */ 480 * assume something is wrong. */
480 count = 5; 481 count = jiffies + HZ * MAILBOX_TIMEOUT;
481 do { 482 do {
482 /* Wait for the interrupt to come in. */ 483 /* Wait for the interrupt to come in. */
483 status = ql_wait_mbx_cmd_cmplt(qdev); 484 status = ql_wait_mbx_cmd_cmplt(qdev);
@@ -501,15 +502,15 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
501 MB_CMD_STS_GOOD) || 502 MB_CMD_STS_GOOD) ||
502 ((mbcp->mbox_out[0] & 0x0000f000) == 503 ((mbcp->mbox_out[0] & 0x0000f000) ==
503 MB_CMD_STS_INTRMDT)) 504 MB_CMD_STS_INTRMDT))
504 break; 505 goto done;
505 } while (--count); 506 } while (time_before(jiffies, count));
506 507
507 if (!count) { 508 QPRINTK(qdev, DRV, ERR,
508 QPRINTK(qdev, DRV, ERR, 509 "Timed out waiting for mailbox complete.\n");
509 "Timed out waiting for mailbox complete.\n"); 510 status = -ETIMEDOUT;
510 status = -ETIMEDOUT; 511 goto end;
511 goto end; 512
512 } 513done:
513 514
514 /* Now we can clear the interrupt condition 515 /* Now we can clear the interrupt condition
515 * and look at our status. 516 * and look at our status.