diff options
author | Sathya Perla <sathyap@serverengines.com> | 2010-05-30 23:34:14 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-01 00:15:52 -0700 |
commit | f25b03a7bd260b939b1a6aa69ca518d9848bb63a (patch) | |
tree | 897afeebe32965882aa9b49c18bec5c8b271d201 /drivers | |
parent | 889cd4b2e529db4988525b0b3e6fb2c095760848 (diff) | |
download | linux-f25b03a7bd260b939b1a6aa69ca518d9848bb63a.tar.gz linux-f25b03a7bd260b939b1a6aa69ca518d9848bb63a.tar.bz2 linux-f25b03a7bd260b939b1a6aa69ca518d9848bb63a.zip |
be2net: replace udelay() with schedule_timeout() in mbox polling
As mbox polling is done only in process context, it is better to
use schedule_timeout() instead of udelay().
Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/benet/be_cmds.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 9e305d7fb4bd..ce437b639cf8 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -186,7 +186,7 @@ static int be_mcc_notify_wait(struct be_adapter *adapter) static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) { - int cnt = 0, wait = 5; + int msecs = 0; u32 ready; do { @@ -201,15 +201,14 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) if (ready) break; - if (cnt > 4000000) { + if (msecs > 4000) { dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); return -1; } - if (cnt > 50) - wait = 200; - cnt += wait; - udelay(wait); + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(msecs_to_jiffies(1)); + msecs++; } while (true); return 0; |