aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSerge E. Hallyn <serue@us.ibm.com>2006-06-14 09:01:26 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2006-06-30 16:09:13 -0400
commit1da9ab7389b8a0789a1b3ad43d3efe80b4c57c03 (patch)
tree44964d5151b6a7b825517480ce0fdbf19bd348f1 /drivers
parent66005216074337e3925514456175b202f17e23ef (diff)
[PATCH] pcmcia: convert pcmcia_cs to kthread
Convert pcmcia_cs to use kthread instead of the deprecated kernel_thread. Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pcmcia/cs.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 3162998579c1..06e2cda4e07b 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -28,6 +28,7 @@
28#include <linux/pm.h> 28#include <linux/pm.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/kthread.h>
31#include <asm/system.h> 32#include <asm/system.h>
32#include <asm/irq.h> 33#include <asm/irq.h>
33 34
@@ -176,6 +177,7 @@ static int pccardd(void *__skt);
176 */ 177 */
177int pcmcia_register_socket(struct pcmcia_socket *socket) 178int pcmcia_register_socket(struct pcmcia_socket *socket)
178{ 179{
180 struct task_struct *tsk;
179 int ret; 181 int ret;
180 182
181 if (!socket || !socket->ops || !socket->dev.dev || !socket->resource_ops) 183 if (!socket || !socket->ops || !socket->dev.dev || !socket->resource_ops)
@@ -239,15 +241,18 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
239 mutex_init(&socket->skt_mutex); 241 mutex_init(&socket->skt_mutex);
240 spin_lock_init(&socket->thread_lock); 242 spin_lock_init(&socket->thread_lock);
241 243
242 ret = kernel_thread(pccardd, socket, CLONE_KERNEL); 244 tsk = kthread_run(pccardd, socket, "pccardd");
243 if (ret < 0) 245 if (IS_ERR(tsk)) {
246 ret = PTR_ERR(tsk);
244 goto err; 247 goto err;
248 }
245 249
246 wait_for_completion(&socket->thread_done); 250 wait_for_completion(&socket->thread_done);
247 if(!socket->thread) { 251 if (!socket->thread) {
248 printk(KERN_WARNING "PCMCIA: warning: socket thread for socket %p did not start\n", socket); 252 printk(KERN_WARNING "PCMCIA: warning: socket thread for socket %p did not start\n", socket);
249 return -EIO; 253 return -EIO;
250 } 254 }
255
251 pcmcia_parse_events(socket, SS_DETECT); 256 pcmcia_parse_events(socket, SS_DETECT);
252 257
253 return 0; 258 return 0;
@@ -272,10 +277,8 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket)
272 cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops); 277 cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops);
273 278
274 if (socket->thread) { 279 if (socket->thread) {
275 init_completion(&socket->thread_done);
276 socket->thread = NULL;
277 wake_up(&socket->thread_wait); 280 wake_up(&socket->thread_wait);
278 wait_for_completion(&socket->thread_done); 281 kthread_stop(socket->thread);
279 } 282 }
280 release_cis_mem(socket); 283 release_cis_mem(socket);
281 284
@@ -630,8 +633,6 @@ static int pccardd(void *__skt)
630 DECLARE_WAITQUEUE(wait, current); 633 DECLARE_WAITQUEUE(wait, current);
631 int ret; 634 int ret;
632 635
633 daemonize("pccardd");
634
635 skt->thread = current; 636 skt->thread = current;
636 skt->socket = dead_socket; 637 skt->socket = dead_socket;
637 skt->ops->init(skt); 638 skt->ops->init(skt);
@@ -643,7 +644,8 @@ static int pccardd(void *__skt)
643 printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n", 644 printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n",
644 skt); 645 skt);
645 skt->thread = NULL; 646 skt->thread = NULL;
646 complete_and_exit(&skt->thread_done, 0); 647 complete(&skt->thread_done);
648 return 0;
647 } 649 }
648 650
649 add_wait_queue(&skt->thread_wait, &wait); 651 add_wait_queue(&skt->thread_wait, &wait);
@@ -674,7 +676,7 @@ static int pccardd(void *__skt)
674 continue; 676 continue;
675 } 677 }
676 678
677 if (!skt->thread) 679 if (kthread_should_stop())
678 break; 680 break;
679 681
680 schedule(); 682 schedule();
@@ -688,7 +690,7 @@ static int pccardd(void *__skt)
688 /* remove from the device core */ 690 /* remove from the device core */
689 class_device_unregister(&skt->dev); 691 class_device_unregister(&skt->dev);
690 692
691 complete_and_exit(&skt->thread_done, 0); 693 return 0;
692} 694}
693 695
694/* 696/*