det = jiffies + (hertz / 50); while (time_before(jiffies, det)) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); } 
msleep(20); 
static int ixj_hookstate(IXJ *j){	unsigned long det;	int fOffHook = 0;	switch (j->cardtype) {	case QTI_PHONEJACK:		ixj_gpio_read(j);		fOffHook = j->gpio.bits.gpio3read ? 1 : 0;		break;	case QTI_LINEJACK:	case QTI_PHONEJACK_LITE:	case QTI_PHONEJACK_PCI:		SLIC_GetState(j);		if(j->cardtype == QTI_LINEJACK && j->flags.pots_pstn == 1 && (j->readers || j->writers)) {			fOffHook = j->pld_slicr.bits.potspstn ? 1 : 0;			if(fOffHook != j->p_hook) {				if(!j->checkwait) {					j->checkwait = jiffies;				} 				if(time_before(jiffies, j->checkwait + 2)) {					fOffHook ^= 1;				} else {					j->checkwait = 0;				}				j->p_hook = fOffHook;	 			printk("IXJ : /dev/phone%d pots-pstn hookstate check %d at %ld\n", j->board, fOffHook, jiffies);			}		} else {			if (j->pld_slicr.bits.state == PLD_SLIC_STATE_ACTIVE ||			    j->pld_slicr.bits.state == PLD_SLIC_STATE_STANDBY) {				if (j->flags.ringing || j->flags.cringing) {					if (!in_interrupt()) {						det = jiffies + (hertz / 50);						while (time_before(jiffies, det)) {							set_current_state(TASK_INTERRUPTIBLE);							schedule_timeout(1);						}					}					SLIC_GetState(j);					if (j->pld_slicr.bits.state == PLD_SLIC_STATE_RINGING) {						ixj_ring_on(j);					}				}				if (j->cardtype == QTI_PHONEJACK_PCI) {					j->pld_scrr.byte = inb_p(j->XILINXbase);					fOffHook = j->pld_scrr.pcib.det ? 1 : 0;				} else					fOffHook = j->pld_slicr.bits.det ? 1 : 0;			}		}		break;	case QTI_PHONECARD:		fOffHook = ixj_pcmcia_cable_check(j);		break;	}	if (j->r_hook != fOffHook) {		j->r_hook = fOffHook;		if (j->port == PORT_SPEAKER || j->port == PORT_HANDSET) { // || (j->port == PORT_PSTN && j->flags.pots_pstn == 0)) {			j->ex.bits.hookstate = 1;			ixj_kill_fasync(j, SIG_HOOKSTATE, POLL_IN);		} else if (!fOffHook) {			j->flash_end = jiffies + ((60 * hertz) / 100);		}	}	if (fOffHook) {		if(time_before(jiffies, j->flash_end)) {			j->ex.bits.flash = 1;			j->flash_end = 0;			ixj_kill_fasync(j, SIG_FLASH, POLL_IN);		}	} else {		if(time_before(jiffies, j->flash_end)) {			fOffHook = 1;		}	}	if (j->port == PORT_PSTN && j->daa_mode == SOP_PU_CONVERSATION)		fOffHook |= 2;	if (j->port == PORT_SPEAKER) {		if(j->cardtype == QTI_PHONECARD) {			if(j->flags.pcmciascp && j->flags.pcmciasct) {				fOffHook |= 2;			}		} else {			fOffHook |= 2;		}	}	if (j->port == PORT_HANDSET)		fOffHook |= 2;	return fOffHook;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/f4c9925ccc185da68c2d42230711d017f222e420/ixj.c/buggy/drivers/telephony/ixj.c