diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 5292db69c426..367d45e03bee 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -626,8 +626,6 @@ static int pccardd(void *__skt) unsigned int events; unsigned int sysfs_events; - set_current_state(TASK_INTERRUPTIBLE); - spin_lock_irqsave(&skt->thread_lock, flags); events = skt->thread_events; skt->thread_events = 0; @@ -675,11 +673,15 @@ static int pccardd(void *__skt) if (kthread_should_stop()) break; + set_current_state(TASK_INTERRUPTIBLE); + schedule(); + + /* make sure we are running */ + __set_current_state(TASK_RUNNING); + try_to_freeze(); } - /* make sure we are running before we exit */ - set_current_state(TASK_RUNNING); /* shut down socket, if a device is still present */ if (skt->state & SOCKET_PRESENT) {