while (card->ptype == ISDN_PTYPE_UNKNOWN) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(10); } set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(10); 
while (card->ptype == ISDN_PTYPE_UNKNOWN) schedule_timeout_interruptible(10); schedule_timeout_interruptible(10); 
isdnloop_command(isdn_ctrl * c, isdnloop_card * card){	ulong a;	int i;	char cbuf[60];	isdn_ctrl cmd;	isdnloop_cdef cdef;	switch (c->command) {		case ISDN_CMD_IOCTL:			memcpy(&a, c->parm.num, sizeof(ulong));			switch (c->arg) {				case ISDNLOOP_IOCTL_DEBUGVAR:					return (ulong) card;				case ISDNLOOP_IOCTL_STARTUP:					if (!access_ok(VERIFY_READ, (void *) a, sizeof(isdnloop_sdef)))						return -EFAULT;					return (isdnloop_start(card, (isdnloop_sdef *) a));					break;				case ISDNLOOP_IOCTL_ADDCARD:					if (copy_from_user((char *)&cdef,							   (char *)a,							   sizeof(cdef)))						return -EFAULT;					return (isdnloop_addcard(cdef.id1));					break;				case ISDNLOOP_IOCTL_LEASEDCFG:					if (a) {						if (!card->leased) {							card->leased = 1;							while (card->ptype == ISDN_PTYPE_UNKNOWN) {								set_current_state(TASK_INTERRUPTIBLE);								schedule_timeout(10);							}							set_current_state(TASK_INTERRUPTIBLE);							schedule_timeout(10);							sprintf(cbuf, "00;FV2ON\n01;EAZ1\n02;EAZ2\n");							i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);							printk(KERN_INFO							       "isdnloop: (%s) Leased-line mode enabled\n",							       CID);							cmd.command = ISDN_STAT_RUN;							cmd.driver = card->myid;							cmd.arg = 0;							card->interface.statcallb(&cmd);						}					} else {						if (card->leased) {							card->leased = 0;							sprintf(cbuf, "00;FV2OFF\n");							i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);							printk(KERN_INFO							       "isdnloop: (%s) Leased-line mode disabled\n",							       CID);							cmd.command = ISDN_STAT_RUN;							cmd.driver = card->myid;							cmd.arg = 0;							card->interface.statcallb(&cmd);						}					}					return 0;				default:					return -EINVAL;			}			break;		case ISDN_CMD_DIAL:			if (!card->flags & ISDNLOOP_FLAGS_RUNNING)				return -ENODEV;			if (card->leased)				break;			if ((c->arg & 255) < ISDNLOOP_BCH) {				char *p;				char dial[50];				char dcode[4];				a = c->arg;				p = c->parm.setup.phone;				if (*p == 's' || *p == 'S') {					/* Dial for SPV */					p++;					strcpy(dcode, "SCA");				} else					/* Normal Dial */					strcpy(dcode, "CAL");				strcpy(dial, p);				sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1),					dcode, dial, c->parm.setup.si1,				c->parm.setup.si2, c->parm.setup.eazmsn);				i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);			}			break;		case ISDN_CMD_ACCEPTD:			if (!card->flags & ISDNLOOP_FLAGS_RUNNING)				return -ENODEV;			if (c->arg < ISDNLOOP_BCH) {				a = c->arg + 1;				cbuf[0] = 0;				switch (card->l2_proto[a - 1]) {					case ISDN_PROTO_L2_X75I:						sprintf(cbuf, "%02d;BX75\n", (int) a);						break;#ifdef CONFIG_ISDN_X25					case ISDN_PROTO_L2_X25DTE:						sprintf(cbuf, "%02d;BX2T\n", (int) a);						break;					case ISDN_PROTO_L2_X25DCE:						sprintf(cbuf, "%02d;BX2C\n", (int) a);						break;#endif					case ISDN_PROTO_L2_HDLC:						sprintf(cbuf, "%02d;BTRA\n", (int) a);						break;				}				if (strlen(cbuf))					i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);				sprintf(cbuf, "%02d;DCON_R\n", (int) a);				i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);			}			break;		case ISDN_CMD_ACCEPTB:			if (!card->flags & ISDNLOOP_FLAGS_RUNNING)				return -ENODEV;			if (c->arg < ISDNLOOP_BCH) {				a = c->arg + 1;				switch (card->l2_proto[a - 1]) {					case ISDN_PROTO_L2_X75I:						sprintf(cbuf, "%02d;BCON_R,BX75\n", (int) a);						break;#ifdef CONFIG_ISDN_X25					case ISDN_PROTO_L2_X25DTE:						sprintf(cbuf, "%02d;BCON_R,BX2T\n", (int) a);						break;					case ISDN_PROTO_L2_X25DCE:						sprintf(cbuf, "%02d;BCON_R,BX2C\n", (int) a);						break;#endif					case ISDN_PROTO_L2_HDLC:						sprintf(cbuf, "%02d;BCON_R,BTRA\n", (int) a);						break;					default:						sprintf(cbuf, "%02d;BCON_R\n", (int) a);				}				printk(KERN_DEBUG "isdnloop writecmd '%s'\n", cbuf);				i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);				break;		case ISDN_CMD_HANGUP:				if (!card->flags & ISDNLOOP_FLAGS_RUNNING)					return -ENODEV;				if (c->arg < ISDNLOOP_BCH) {					a = c->arg + 1;					sprintf(cbuf, "%02d;BDIS_R\n%02d;DDIS_R\n", (int) a, (int) a);					i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);				}				break;		case ISDN_CMD_SETEAZ:				if (!card->flags & ISDNLOOP_FLAGS_RUNNING)					return -ENODEV;				if (card->leased)					break;				if (c->arg < ISDNLOOP_BCH) {					a = c->arg + 1;					if (card->ptype == ISDN_PTYPE_EURO) {						sprintf(cbuf, "%02d;MS%s%s\n", (int) a,							c->parm.num[0] ? "N" : "ALL", c->parm.num);					} else						sprintf(cbuf, "%02d;EAZ%s\n", (int) a,							c->parm.num[0] ? c->parm.num : (u_char *) "0123456789");					i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);				}				break;		case ISDN_CMD_CLREAZ:				if (!card->flags & ISDNLOOP_FLAGS_RUNNING)					return -ENODEV;				if (card->leased)					break;				if (c->arg < ISDNLOOP_BCH) {					a = c->arg + 1;					if (card->ptype == ISDN_PTYPE_EURO)						sprintf(cbuf, "%02d;MSNC\n", (int) a);					else						sprintf(cbuf, "%02d;EAZC\n", (int) a);					i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);				}				break;		case ISDN_CMD_SETL2:				if (!card->flags & ISDNLOOP_FLAGS_RUNNING)					return -ENODEV;				if ((c->arg & 255) < ISDNLOOP_BCH) {					a = c->arg;					switch (a >> 8) {						case ISDN_PROTO_L2_X75I:							sprintf(cbuf, "%02d;BX75\n", (int) (a & 255) + 1);							break;#ifdef CONFIG_ISDN_X25						case ISDN_PROTO_L2_X25DTE:							sprintf(cbuf, "%02d;BX2T\n", (int) (a & 255) + 1);							break;						case ISDN_PROTO_L2_X25DCE:							sprintf(cbuf, "%02d;BX2C\n", (int) (a & 255) + 1);							break;#endif						case ISDN_PROTO_L2_HDLC:							sprintf(cbuf, "%02d;BTRA\n", (int) (a & 255) + 1);							break;						case ISDN_PROTO_L2_TRANS:							sprintf(cbuf, "%02d;BTRA\n", (int) (a & 255) + 1);							break;						default:							return -EINVAL;					}					i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);					card->l2_proto[a & 255] = (a >> 8);				}				break;		case ISDN_CMD_SETL3:				if (!card->flags & ISDNLOOP_FLAGS_RUNNING)					return -ENODEV;				return 0;		default:				return -EINVAL;			}	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/24763c48a3c9cdf0a138038b51a7fca65859cd78/isdnloop.c/buggy/drivers/isdn/isdnloop/isdnloop.c