diff options
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index e9c6b4ffd8e1..42b64b5ad083 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -722,6 +722,8 @@ static int lbs_thread(void *data) | |||
722 | set_freezable(); | 722 | set_freezable(); |
723 | 723 | ||
724 | for (;;) { | 724 | for (;;) { |
725 | int shouldsleep; | ||
726 | |||
725 | lbs_deb_thread( "main-thread 111: intcounter=%d currenttxskb=%p dnld_sent=%d\n", | 727 | lbs_deb_thread( "main-thread 111: intcounter=%d currenttxskb=%p dnld_sent=%d\n", |
726 | priv->intcounter, priv->currenttxskb, priv->dnld_sent); | 728 | priv->intcounter, priv->currenttxskb, priv->dnld_sent); |
727 | 729 | ||
@@ -729,8 +731,22 @@ static int lbs_thread(void *data) | |||
729 | set_current_state(TASK_INTERRUPTIBLE); | 731 | set_current_state(TASK_INTERRUPTIBLE); |
730 | spin_lock_irq(&priv->driver_lock); | 732 | spin_lock_irq(&priv->driver_lock); |
731 | 733 | ||
732 | if ((priv->psstate == PS_STATE_SLEEP) || | 734 | if (priv->surpriseremoved) |
733 | (!priv->intcounter && (priv->dnld_sent || priv->cur_cmd || list_empty(&priv->cmdpendingq)))) { | 735 | shouldsleep = 0; /* Bye */ |
736 | else if (priv->psstate == PS_STATE_SLEEP) | ||
737 | shouldsleep = 1; /* Sleep mode. Nothing we can do till it wakes */ | ||
738 | else if (priv->intcounter) | ||
739 | shouldsleep = 0; /* Interrupt pending. Deal with it now */ | ||
740 | else if (priv->dnld_sent) | ||
741 | shouldsleep = 1; /* Something is en route to the device already */ | ||
742 | else if (priv->cur_cmd) | ||
743 | shouldsleep = 1; /* Can't send a command; one already running */ | ||
744 | else if (!list_empty(&priv->cmdpendingq)) | ||
745 | shouldsleep = 0; /* We have a command to send */ | ||
746 | else | ||
747 | shouldsleep = 1; /* No command */ | ||
748 | |||
749 | if (shouldsleep) { | ||
734 | lbs_deb_thread("main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", | 750 | lbs_deb_thread("main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", |
735 | priv->connect_status, priv->intcounter, | 751 | priv->connect_status, priv->intcounter, |
736 | priv->psmode, priv->psstate); | 752 | priv->psmode, priv->psstate); |