[PATCH] cs: kill thread_wait

Christoph Hellwig hch at infradead.org
Sun Apr 22 08:55:36 EDT 2007


There is not reason to have a waitqueue if there it's always the same
thread that is waiting for it.  Just use wake_up_process instead.


Signed-off-by: Christoph Hellwig <hch at lst.de>

Index: linux-2.6/drivers/pcmcia/cs.c
===================================================================
--- linux-2.6.orig/drivers/pcmcia/cs.c	2007-04-22 13:19:17.000000000 +0200
+++ linux-2.6/drivers/pcmcia/cs.c	2007-04-22 13:21:05.000000000 +0200
@@ -238,7 +238,6 @@ int pcmcia_register_socket(struct pcmcia
 
 	init_completion(&socket->socket_released);
 	init_completion(&socket->thread_done);
-	init_waitqueue_head(&socket->thread_wait);
 	mutex_init(&socket->skt_mutex);
 	spin_lock_init(&socket->thread_lock);
 
@@ -277,10 +276,9 @@ void pcmcia_unregister_socket(struct pcm
 
 	cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops);
 
-	if (socket->thread) {
-		wake_up(&socket->thread_wait);
+	if (socket->thread)
 		kthread_stop(socket->thread);
-	}
+
 	release_cis_mem(socket);
 
 	/* remove from our own list */
@@ -649,7 +647,6 @@ static int pccardd(void *__skt)
 		return 0;
 	}
 
-	add_wait_queue(&skt->thread_wait, &wait);
 	complete(&skt->thread_done);
 
 	for (;;) {
@@ -686,8 +683,6 @@ static int pccardd(void *__skt)
 	/* make sure we are running before we exit */
 	set_current_state(TASK_RUNNING);
 
-	remove_wait_queue(&skt->thread_wait, &wait);
-
 	/* remove from the device core */
 	device_unregister(&skt->dev);
 
@@ -707,7 +702,7 @@ void pcmcia_parse_events(struct pcmcia_s
 		s->thread_events |= events;
 		spin_unlock_irqrestore(&s->thread_lock, flags);
 
-		wake_up(&s->thread_wait);
+		wake_up_process(s->thread);
 	}
 } /* pcmcia_parse_events */
 EXPORT_SYMBOL(pcmcia_parse_events);
Index: linux-2.6/include/pcmcia/ss.h
===================================================================
--- linux-2.6.orig/include/pcmcia/ss.h	2007-04-22 13:20:20.000000000 +0200
+++ linux-2.6/include/pcmcia/ss.h	2007-04-22 13:20:27.000000000 +0200
@@ -245,7 +245,6 @@ struct pcmcia_socket {
 
 	struct task_struct		*thread;
 	struct completion		thread_done;
-	wait_queue_head_t		thread_wait;
 	spinlock_t			thread_lock;	/* protects thread_events */
 	unsigned int			thread_events;
 



More information about the linux-pcmcia mailing list