Commit f25b03a7 authored by Sathya Perla's avatar Sathya Perla Committed by David S. Miller

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: default avatarSathya Perla <sathyap@serverengines.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 889cd4b2
...@@ -186,7 +186,7 @@ static int be_mcc_notify_wait(struct be_adapter *adapter) ...@@ -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) static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
{ {
int cnt = 0, wait = 5; int msecs = 0;
u32 ready; u32 ready;
do { do {
...@@ -201,15 +201,14 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) ...@@ -201,15 +201,14 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
if (ready) if (ready)
break; break;
if (cnt > 4000000) { if (msecs > 4000) {
dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
return -1; return -1;
} }
if (cnt > 50) set_current_state(TASK_INTERRUPTIBLE);
wait = 200; schedule_timeout(msecs_to_jiffies(1));
cnt += wait; msecs++;
udelay(wait);
} while (true); } while (true);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment