set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(10); 
schedule_timeout_interruptible(10); 
icn_loadproto(u_char __user * buffer, icn_card * card){	register u_char __user *p = buffer;	u_char codebuf[256];	uint left = ICN_CODE_STAGE2;	uint cnt;	int timer;	unsigned long flags;#ifdef BOOT_DEBUG	printk(KERN_DEBUG "icn_loadproto called\n");#endif	if (!access_ok(VERIFY_READ, buffer, ICN_CODE_STAGE2))		return -EFAULT;	timer = 0;	spin_lock_irqsave(&dev.devlock, flags);	if (card->secondhalf) {		icn_map_channel(card, 2);		icn_lock_channel(card, 2);	} else {		icn_map_channel(card, 0);		icn_lock_channel(card, 0);	}	spin_unlock_irqrestore(&dev.devlock, flags);	while (left) {		if (sbfree) {   /* If there is a free buffer...  */			cnt = left;			if (cnt > 256)				cnt = 256;			if (copy_from_user(codebuf, p, cnt)) {				icn_maprelease_channel(card, 0);				return -EFAULT;			}			memcpy_toio(&sbuf_l, codebuf, cnt);	/* copy data                     */			sbnext; /* switch to next buffer         */			p += cnt;			left -= cnt;			timer = 0;		} else {#ifdef BOOT_DEBUG			printk(KERN_DEBUG "boot 2 !sbfree\n");#endif			if (timer++ > 5) {				icn_maprelease_channel(card, 0);				return -EIO;			}			set_current_state(TASK_INTERRUPTIBLE);			schedule_timeout(10);		}	}	writeb(0x20, &sbuf_n);	timer = 0;	while (1) {		if (readb(&cmd_o) || readb(&cmd_i)) {#ifdef BOOT_DEBUG			printk(KERN_DEBUG "Proto?\n");#endif			if (timer++ > 5) {				printk(KERN_WARNING				       "icn: (%s) Protocol timed out.\n",				       CID);#ifdef BOOT_DEBUG				printk(KERN_DEBUG "Proto TO!\n");#endif				icn_maprelease_channel(card, 0);				return -EIO;			}#ifdef BOOT_DEBUG			printk(KERN_DEBUG "Proto TO?\n");#endif			msleep_interruptible(ICN_BOOT_TIMEOUT1);		} else {			if ((card->secondhalf) || (!card->doubleS0)) {#ifdef BOOT_DEBUG				printk(KERN_DEBUG "Proto loaded, install poll-timer %d\n",				       card->secondhalf);#endif				spin_lock_irqsave(&card->lock, flags);				init_timer(&card->st_timer);				card->st_timer.expires = jiffies + ICN_TIMER_DCREAD;				card->st_timer.function = icn_polldchan;				card->st_timer.data = (unsigned long) card;				add_timer(&card->st_timer);				card->flags |= ICN_FLAGS_RUNNING;				if (card->doubleS0) {					init_timer(&card->other->st_timer);					card->other->st_timer.expires = jiffies + ICN_TIMER_DCREAD;					card->other->st_timer.function = icn_polldchan;					card->other->st_timer.data = (unsigned long) card->other;					add_timer(&card->other->st_timer);					card->other->flags |= ICN_FLAGS_RUNNING;				}				spin_unlock_irqrestore(&card->lock, flags);			}			icn_maprelease_channel(card, 0);			return 0;		}	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/24763c48a3c9cdf0a138038b51a7fca65859cd78/icn.c/buggy/drivers/isdn/icn/icn.c