 if (!skt->thread) break; 
static int pccardd(void *__skt){	struct pcmcia_socket *skt = __skt;	DECLARE_WAITQUEUE(wait, current);	int ret;	daemonize("pccardd");	skt->thread = current;	skt->socket = dead_socket;	skt->ops->init(skt);	skt->ops->set_socket(skt, &skt->socket);	/* register with the device core */	ret = class_device_register(&skt->dev);	if (ret) {		printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n",			skt);		skt->thread = NULL;		complete_and_exit(&skt->thread_done, 0);	}	complete(&skt->thread_done);	add_wait_queue(&skt->thread_wait, &wait);	for (;;) {		unsigned long flags;		unsigned int events;		set_current_state(TASK_INTERRUPTIBLE);		spin_lock_irqsave(&skt->thread_lock, flags);		events = skt->thread_events;		skt->thread_events = 0;		spin_unlock_irqrestore(&skt->thread_lock, flags);		if (events) {			down(&skt->skt_sem);			if (events & SS_DETECT)				socket_detect_change(skt);			if (events & SS_BATDEAD)				send_event(skt, CS_EVENT_BATTERY_DEAD, CS_EVENT_PRI_LOW);			if (events & SS_BATWARN)				send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW);			if (events & SS_READY)				send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW);			up(&skt->skt_sem);			continue;		}		schedule();		try_to_freeze();		if (!skt->thread)			break;	}	remove_wait_queue(&skt->thread_wait, &wait);	/* remove from the device core */	class_device_unregister(&skt->dev);	complete_and_exit(&skt->thread_done, 0);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/bf4de6f2db79f3c396bd884f546cd2ea91a686f2/cs.c/buggy/drivers/pcmcia/cs.c