diff options
author | Sathya Perla <sathya.perla@emulex.com> | 2011-05-12 15:32:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-13 14:41:34 -0400 |
commit | 6ed35eea3b96977d76d61b5862a3209044cb4b1f (patch) | |
tree | adec1550204379d90bd35a1aedf681d488b4267e /drivers/net/benet/be_cmds.c | |
parent | 29dd54b72ba8c5ad0dd6dd33584449b5953f700b (diff) |
be2net: handle signal reception while waiting for POST
If waiting on POST returns prematurely (due to a signal), abort polling and return an error.
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_cmds.c')
-rw-r--r-- | drivers/net/benet/be_cmds.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 0dbb4cbc07b6..d558b9088d7e 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -376,23 +376,25 @@ int be_cmd_POST(struct be_adapter *adapter) | |||
376 | { | 376 | { |
377 | u16 stage; | 377 | u16 stage; |
378 | int status, timeout = 0; | 378 | int status, timeout = 0; |
379 | struct device *dev = &adapter->pdev->dev; | ||
379 | 380 | ||
380 | do { | 381 | do { |
381 | status = be_POST_stage_get(adapter, &stage); | 382 | status = be_POST_stage_get(adapter, &stage); |
382 | if (status) { | 383 | if (status) { |
383 | dev_err(&adapter->pdev->dev, "POST error; stage=0x%x\n", | 384 | dev_err(dev, "POST error; stage=0x%x\n", stage); |
384 | stage); | ||
385 | return -1; | 385 | return -1; |
386 | } else if (stage != POST_STAGE_ARMFW_RDY) { | 386 | } else if (stage != POST_STAGE_ARMFW_RDY) { |
387 | set_current_state(TASK_INTERRUPTIBLE); | 387 | if (msleep_interruptible(2000)) { |
388 | schedule_timeout(2 * HZ); | 388 | dev_err(dev, "Waiting for POST aborted\n"); |
389 | return -EINTR; | ||
390 | } | ||
389 | timeout += 2; | 391 | timeout += 2; |
390 | } else { | 392 | } else { |
391 | return 0; | 393 | return 0; |
392 | } | 394 | } |
393 | } while (timeout < 40); | 395 | } while (timeout < 40); |
394 | 396 | ||
395 | dev_err(&adapter->pdev->dev, "POST timeout; stage=0x%x\n", stage); | 397 | dev_err(dev, "POST timeout; stage=0x%x\n", stage); |
396 | return -1; | 398 | return -1; |
397 | } | 399 | } |
398 | 400 | ||