[PATCH] pcmcia/cs: fix possible missed wakeup
[PATCH] pcmcia/cs: fix possible missed wakeup

- 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 <5621d580f157439350c842caca997afe7341e94a@gmx.ch>
Cc: Dominik Brodowski <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@brodo.de>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs