]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] pcmcia/cs: fix possible missed wakeup
authorDaniel Ritz <daniel.ritz@gmx.ch>
Fri, 9 Sep 2005 20:03:23 +0000 (13:03 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 9 Sep 2005 20:57:47 +0000 (13:57 -0700)
- thread_done should only be completed when the wait_queue is installed.

- all wake up conditions should be checked before schedule()

this fixes a hang of rmmod in the sequence modprobe yenta_socket; rmmod
yenta_socket as reported by Andreas Steinmetz.  w/o this rmmod yenta_socket
can hang on wait_for_completion() in pcmcia_unregister_socket()

Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Cc: Dominik Brodowski <linux@brodo.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/pcmcia/cs.c

index e39178fc59d08efb74efe4eaf1e8ba80a6fbdace..fabd3529cebcb035e56769354986c99e561ecb08 100644 (file)
@@ -654,9 +654,10 @@ static int pccardd(void *__skt)
                skt->thread = NULL;
                complete_and_exit(&skt->thread_done, 0);
        }
-       complete(&skt->thread_done);
 
        add_wait_queue(&skt->thread_wait, &wait);
+       complete(&skt->thread_done);
+
        for (;;) {
                unsigned long flags;
                unsigned int events;
@@ -682,11 +683,11 @@ static int pccardd(void *__skt)
                        continue;
                }
 
-               schedule();
-               try_to_freeze();
-
                if (!skt->thread)
                        break;
+
+               schedule();
+               try_to_freeze();
        }
        remove_wait_queue(&skt->thread_wait, &wait);