Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d9f88705a7ce2f9ef13d6656ee715493a663edfc
Commit:     d9f88705a7ce2f9ef13d6656ee715493a663edfc
Parent:     4ad36d780caf34630d1a4cc39f9bc11017f5b81d
Author:     David Woodhouse <[EMAIL PROTECTED]>
AuthorDate: Thu Dec 13 21:48:00 2007 -0500
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 15:07:26 2008 -0800

    libertas: don't exit worker thread until kthread_stop() is called
    
    The kthread code can't cope with a thread exiting of its own accord and
    then someone calling kthread_stop() for it. When the thread detects that
    it needs to die, make it wait for kthread_stop() to be called.
    
    Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/libertas/main.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/libertas/main.c 
b/drivers/net/wireless/libertas/main.c
index 5d2bf53..b51513f 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -662,8 +662,10 @@ static int lbs_thread(void *data)
                set_current_state(TASK_INTERRUPTIBLE);
                spin_lock_irq(&priv->driver_lock);
 
-               if (priv->surpriseremoved)
+               if (kthread_should_stop())
                        shouldsleep = 0;        /* Bye */
+               else if (priv->surpriseremoved)
+                       shouldsleep = 1;        /* We need to wait until we're 
_told_ to die */
                else if (priv->psstate == PS_STATE_SLEEP)
                        shouldsleep = 1;        /* Sleep mode. Nothing we can 
do till it wakes */
                else if (priv->intcounter)
@@ -699,12 +701,15 @@ static int lbs_thread(void *data)
                lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p 
dnld_sent=%d\n",
                               priv->intcounter, priv->currenttxskb, 
priv->dnld_sent);
 
-               if (kthread_should_stop() || priv->surpriseremoved) {
-                       lbs_deb_thread("main-thread: break from main thread: 
surpriseremoved=0x%x\n",
-                                      priv->surpriseremoved);
+               if (kthread_should_stop()) {
+                       lbs_deb_thread("main-thread: break from main thread\n");
                        break;
                }
 
+               if (priv->surpriseremoved) {
+                       lbs_deb_thread("adapter removed; waiting to die...\n");
+                       continue;
+               }
 
                spin_lock_irq(&priv->driver_lock);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to