diff options
author | Sathya Perla <sathyap@serverengines.com> | 2010-05-30 19:34:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-01 03:15:52 -0400 |
commit | f25b03a7bd260b939b1a6aa69ca518d9848bb63a (patch) | |
tree | 897afeebe32965882aa9b49c18bec5c8b271d201 /drivers | |
parent | 889cd4b2e529db4988525b0b3e6fb2c095760848 (diff) |
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) | |||
186 | 186 | ||
187 | static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) | 187 | static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) |
188 | { | 188 | { |
189 | int cnt = 0, wait = 5; | 189 | int msecs = 0; |
190 | u32 ready; | 190 | u32 ready; |
191 | 191 | ||
192 | do { | 192 | do { |
@@ -201,15 +201,14 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) | |||
201 | if (ready) | 201 | if (ready) |
202 | break; | 202 | break; |
203 | 203 | ||
204 | if (cnt > 4000000) { | 204 | if (msecs > 4000) { |
205 | dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); | 205 | dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); |
206 | return -1; | 206 | return -1; |
207 | } | 207 | } |
208 | 208 | ||
209 | if (cnt > 50) | 209 | set_current_state(TASK_INTERRUPTIBLE); |
210 | wait = 200; | 210 | schedule_timeout(msecs_to_jiffies(1)); |
211 | cnt += wait; | 211 | msecs++; |
212 | udelay(wait); | ||
213 | } while (true); | 212 | } while (true); |
214 | 213 | ||
215 | return 0; | 214 | return 0; |