printk("Looping in ac_read. loopcount %d\n", loopcount); 
printk(KERN_DEBUG "Looping in ac_read. loopcount %d\n", loopcount); 
static ssize_t ac_read (struct file *filp, char __user *buf, size_t count, loff_t *ptr){	unsigned long flags;	unsigned int i;	unsigned char tmp;	int ret = 0;	DECLARE_WAITQUEUE(wait, current);#ifdef DEBUG	int loopcount=0;#endif	/* No need to ratelimit this. Only root can trigger it anyway */	if (count != sizeof(struct st_ram_io) + sizeof(struct mailbox)) {		printk( KERN_WARNING "Hmmm. read() of Applicom card, length %zd != expected %zd\n",			count,sizeof(struct st_ram_io) + sizeof(struct mailbox));		return -EINVAL;	}		while(1) {		/* Stick ourself on the wait queue */		set_current_state(TASK_INTERRUPTIBLE);		add_wait_queue(&FlagSleepRec, &wait);				/* Scan each board, looking for one which has a packet for us */		for (i=0; i < MAX_BOARD; i++) {			if (!apbs[i].RamIO)				continue;			spin_lock_irqsave(&apbs[i].mutex, flags);						tmp = readb(apbs[i].RamIO + DATA_TO_PC_READY);						if (tmp == 2) {				struct st_ram_io st_loc;				struct mailbox mailbox;				/* Got a packet for us */				ret = do_ac_read(i, buf, &st_loc, &mailbox);				spin_unlock_irqrestore(&apbs[i].mutex, flags);				set_current_state(TASK_RUNNING);				remove_wait_queue(&FlagSleepRec, &wait);				if (copy_to_user(buf, &st_loc, sizeof(st_loc)))					return -EFAULT;				if (copy_to_user(buf + sizeof(st_loc), &mailbox, sizeof(mailbox)))					return -EFAULT;				return tmp;			}						if (tmp > 2) {				/* Got an error */				Dummy = readb(apbs[i].RamIO + VERS);								spin_unlock_irqrestore(&apbs[i].mutex, flags);				set_current_state(TASK_RUNNING);				remove_wait_queue(&FlagSleepRec, &wait);								printk(KERN_WARNING "APPLICOM driver read error board %d, DataToPcReady = %d\n",				       i,(int)readb(apbs[i].RamIO + DATA_TO_PC_READY));				DeviceErrorCount++;				return -EIO;			}						/* Nothing for us. Try the next board */			Dummy = readb(apbs[i].RamIO + VERS);			spin_unlock_irqrestore(&apbs[i].mutex, flags);					} /* per board */		/* OK - No boards had data for us. Sleep now */		schedule();		remove_wait_queue(&FlagSleepRec, &wait);		if (signal_pending(current))			return -EINTR;#ifdef DEBUG		if (loopcount++ > 2) {			printk("Looping in ac_read. loopcount %d\n", loopcount);		}#endif	} }
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/56003191c466b8ef4b174da60f25ae58e92493f8/applicom.c/clean/drivers/char/applicom.c