Lines Matching refs:card
57 icn_free_queue(icn_card *card, int channel) in icn_free_queue() argument
59 struct sk_buff_head *queue = &card->spqueue[channel]; in icn_free_queue()
63 card->xlen[channel] = 0; in icn_free_queue()
64 card->sndcount[channel] = 0; in icn_free_queue()
65 if ((skb = card->xskb[channel])) { in icn_free_queue()
66 card->xskb[channel] = NULL; in icn_free_queue()
96 icn_disable_ram(icn_card *card) in icn_disable_ram() argument
105 icn_enable_ram(icn_card *card) in icn_enable_ram() argument
116 icn_map_channel(icn_card *card, int channel) in icn_map_channel() argument
121 if ((channel == dev.channel) && (card == dev.mcard)) in icn_map_channel()
126 icn_enable_ram(card); in icn_map_channel()
127 dev.mcard = card; in icn_map_channel()
142 icn_lock_channel(icn_card *card, int channel) in icn_lock_channel() argument
149 if ((dev.channel == channel) && (card == dev.mcard)) { in icn_lock_channel()
197 icn_trymaplock_channel(icn_card *card, int channel) in icn_trymaplock_channel() argument
207 ((dev.channel == channel) && (dev.mcard == card))) { in icn_trymaplock_channel()
209 icn_map_channel(card, channel); in icn_trymaplock_channel()
228 icn_maprelease_channel(icn_card *card, int channel) in icn_maprelease_channel() argument
239 icn_map_channel(card, channel); in icn_maprelease_channel()
249 icn_pollbchan_receive(int channel, icn_card *card) in icn_pollbchan_receive() argument
251 int mch = channel + ((card->secondhalf) ? 2 : 0); in icn_pollbchan_receive()
256 if (icn_trymaplock_channel(card, mch)) { in icn_pollbchan_receive()
259 if ((card->rcvidx[channel] + cnt) > 4000) { in icn_pollbchan_receive()
264 card->rcvidx[channel] = 0; in icn_pollbchan_receive()
267 memcpy_fromio(&card->rcvbuf[channel][card->rcvidx[channel]], in icn_pollbchan_receive()
269 card->rcvidx[channel] += cnt; in icn_pollbchan_receive()
273 icn_maprelease_channel(card, mch & 2); in icn_pollbchan_receive()
275 if ((cnt = card->rcvidx[channel])) { in icn_pollbchan_receive()
280 memcpy(skb_put(skb, cnt), card->rcvbuf[channel], cnt); in icn_pollbchan_receive()
281 card->rcvidx[channel] = 0; in icn_pollbchan_receive()
282 card->interface.rcvcallb_skb(card->myid, channel, skb); in icn_pollbchan_receive()
285 if (!icn_trymaplock_channel(card, mch)) in icn_pollbchan_receive()
288 icn_maprelease_channel(card, mch & 2); in icn_pollbchan_receive()
300 icn_pollbchan_send(int channel, icn_card *card) in icn_pollbchan_send() argument
302 int mch = channel + ((card->secondhalf) ? 2 : 0); in icn_pollbchan_send()
308 if (!(card->sndcount[channel] || card->xskb[channel] || in icn_pollbchan_send()
309 !skb_queue_empty(&card->spqueue[channel]))) in icn_pollbchan_send()
311 if (icn_trymaplock_channel(card, mch)) { in icn_pollbchan_send()
313 (card->sndcount[channel] || in icn_pollbchan_send()
314 !skb_queue_empty(&card->spqueue[channel]) || in icn_pollbchan_send()
315 card->xskb[channel])) { in icn_pollbchan_send()
316 spin_lock_irqsave(&card->lock, flags); in icn_pollbchan_send()
317 if (card->xmit_lock[channel]) { in icn_pollbchan_send()
318 spin_unlock_irqrestore(&card->lock, flags); in icn_pollbchan_send()
321 card->xmit_lock[channel]++; in icn_pollbchan_send()
322 spin_unlock_irqrestore(&card->lock, flags); in icn_pollbchan_send()
323 skb = card->xskb[channel]; in icn_pollbchan_send()
325 skb = skb_dequeue(&card->spqueue[channel]); in icn_pollbchan_send()
331 card->xlen[channel] = skb->len; in icn_pollbchan_send()
333 card->xlen[channel] = 0; in icn_pollbchan_send()
349 icn_maprelease_channel(card, mch & 2); in icn_pollbchan_send()
350 spin_lock_irqsave(&card->lock, flags); in icn_pollbchan_send()
351 card->sndcount[channel] -= cnt; in icn_pollbchan_send()
353 if (card->xskb[channel]) in icn_pollbchan_send()
354 card->xskb[channel] = NULL; in icn_pollbchan_send()
355 card->xmit_lock[channel] = 0; in icn_pollbchan_send()
356 spin_unlock_irqrestore(&card->lock, flags); in icn_pollbchan_send()
358 if (card->xlen[channel]) { in icn_pollbchan_send()
360 cmd.driver = card->myid; in icn_pollbchan_send()
362 cmd.parm.length = card->xlen[channel]; in icn_pollbchan_send()
363 card->interface.statcallb(&cmd); in icn_pollbchan_send()
366 card->xskb[channel] = skb; in icn_pollbchan_send()
367 card->xmit_lock[channel] = 0; in icn_pollbchan_send()
368 spin_unlock_irqrestore(&card->lock, flags); in icn_pollbchan_send()
370 if (!icn_trymaplock_channel(card, mch)) in icn_pollbchan_send()
373 icn_maprelease_channel(card, mch & 2); in icn_pollbchan_send()
385 icn_card *card = (icn_card *) data; in icn_pollbchan() local
388 if (card->flags & ICN_FLAGS_B1ACTIVE) { in icn_pollbchan()
389 icn_pollbchan_receive(0, card); in icn_pollbchan()
390 icn_pollbchan_send(0, card); in icn_pollbchan()
392 if (card->flags & ICN_FLAGS_B2ACTIVE) { in icn_pollbchan()
393 icn_pollbchan_receive(1, card); in icn_pollbchan()
394 icn_pollbchan_send(1, card); in icn_pollbchan()
396 if (card->flags & (ICN_FLAGS_B1ACTIVE | ICN_FLAGS_B2ACTIVE)) { in icn_pollbchan()
398 spin_lock_irqsave(&card->lock, flags); in icn_pollbchan()
399 mod_timer(&card->rb_timer, jiffies + ICN_TIMER_BCREAD); in icn_pollbchan()
400 card->flags |= ICN_FLAGS_RBTIMER; in icn_pollbchan()
401 spin_unlock_irqrestore(&card->lock, flags); in icn_pollbchan()
403 card->flags &= ~ICN_FLAGS_RBTIMER; in icn_pollbchan()
448 icn_parse_status(u_char *status, int channel, icn_card *card) in icn_parse_status() argument
465 cmd.driver = card->myid; in icn_parse_status()
469 spin_lock_irqsave(&card->lock, flags); in icn_parse_status()
470 icn_free_queue(card, channel); in icn_parse_status()
471 card->rcvidx[channel] = 0; in icn_parse_status()
473 if (card->flags & in icn_parse_status()
478 card->flags &= ~((channel) ? in icn_parse_status()
483 ncmd.driver = card->myid; in icn_parse_status()
486 spin_unlock_irqrestore(&card->lock, flags); in icn_parse_status()
487 card->interface.statcallb(&cmd); in icn_parse_status()
489 spin_unlock_irqrestore(&card->lock, flags); in icn_parse_status()
492 spin_lock_irqsave(&card->lock, flags); in icn_parse_status()
493 icn_free_queue(card, channel); in icn_parse_status()
494 card->flags |= (channel) ? in icn_parse_status()
496 spin_unlock_irqrestore(&card->lock, flags); in icn_parse_status()
499 spin_lock_irqsave(&card->lock, flags); in icn_parse_status()
500 card->flags &= ~((channel) ? in icn_parse_status()
502 icn_free_queue(card, channel); in icn_parse_status()
503 card->rcvidx[channel] = 0; in icn_parse_status()
504 spin_unlock_irqrestore(&card->lock, flags); in icn_parse_status()
535 sprintf(cmd.parm.setup.phone, "LEASED%d", card->myid); in icn_parse_status()
558 spin_lock_irqsave(&card->lock, flags); in icn_parse_status()
559 card->flags &= ~ICN_FLAGS_B1ACTIVE; in icn_parse_status()
560 icn_free_queue(card, 0); in icn_parse_status()
561 card->rcvidx[0] = 0; in icn_parse_status()
562 spin_unlock_irqrestore(&card->lock, flags); in icn_parse_status()
564 cmd.driver = card->myid; in icn_parse_status()
565 card->interface.statcallb(&cmd); in icn_parse_status()
568 cmd.driver = card->myid; in icn_parse_status()
569 card->interface.statcallb(&cmd); in icn_parse_status()
571 spin_lock_irqsave(&card->lock, flags); in icn_parse_status()
572 card->flags &= ~ICN_FLAGS_B2ACTIVE; in icn_parse_status()
573 icn_free_queue(card, 1); in icn_parse_status()
574 card->rcvidx[1] = 0; in icn_parse_status()
575 spin_unlock_irqrestore(&card->lock, flags); in icn_parse_status()
577 cmd.driver = card->myid; in icn_parse_status()
578 card->interface.statcallb(&cmd); in icn_parse_status()
581 cmd.driver = card->myid; in icn_parse_status()
584 card->interface.statcallb(&cmd); in icn_parse_status()
589 icn_putmsg(icn_card *card, unsigned char c) in icn_putmsg() argument
593 spin_lock_irqsave(&card->lock, flags); in icn_putmsg()
594 *card->msg_buf_write++ = (c == 0xff) ? '\n' : c; in icn_putmsg()
595 if (card->msg_buf_write == card->msg_buf_read) { in icn_putmsg()
596 if (++card->msg_buf_read > card->msg_buf_end) in icn_putmsg()
597 card->msg_buf_read = card->msg_buf; in icn_putmsg()
599 if (card->msg_buf_write > card->msg_buf_end) in icn_putmsg()
600 card->msg_buf_write = card->msg_buf; in icn_putmsg()
601 spin_unlock_irqrestore(&card->lock, flags); in icn_putmsg()
607 icn_card *card = (icn_card *) data; in icn_polldchan() local
608 int mch = card->secondhalf ? 2 : 0; in icn_polldchan()
618 if (icn_trymaplock_channel(card, mch)) { in icn_polldchan()
622 icn_putmsg(card, c); in icn_polldchan()
624 card->imsg[card->iptr] = 0; in icn_polldchan()
625 card->iptr = 0; in icn_polldchan()
626 if (card->imsg[0] == '0' && card->imsg[1] >= '0' && in icn_polldchan()
627 card->imsg[1] <= '2' && card->imsg[2] == ';') { in icn_polldchan()
628 ch = (card->imsg[1] - '0') - 1; in icn_polldchan()
629 p = &card->imsg[3]; in icn_polldchan()
630 icn_parse_status(p, ch, card); in icn_polldchan()
632 p = card->imsg; in icn_polldchan()
639 card->ptype = ISDN_PTYPE_1TR6; in icn_polldchan()
640 card->interface.features |= ISDN_FEATURE_P_1TR6; in icn_polldchan()
645 card->ptype = ISDN_PTYPE_EURO; in icn_polldchan()
646 card->interface.features |= ISDN_FEATURE_P_EURO; in icn_polldchan()
650 p = strstr(card->imsg, "BRV") + 3; in icn_polldchan()
659 card->fw_rev = (int) simple_strtoul(vstr, NULL, 10); in icn_polldchan()
665 card->imsg[card->iptr] = c; in icn_polldchan()
666 if (card->iptr < 59) in icn_polldchan()
667 card->iptr++; in icn_polldchan()
675 cmd.driver = card->myid; in icn_polldchan()
677 card->interface.statcallb(&cmd); in icn_polldchan()
679 spin_lock_irqsave(&card->lock, flags); in icn_polldchan()
680 if (card->flags & (ICN_FLAGS_B1ACTIVE | ICN_FLAGS_B2ACTIVE)) in icn_polldchan()
681 if (!(card->flags & ICN_FLAGS_RBTIMER)) { in icn_polldchan()
683 card->flags |= ICN_FLAGS_RBTIMER; in icn_polldchan()
684 del_timer(&card->rb_timer); in icn_polldchan()
685 card->rb_timer.function = icn_pollbchan; in icn_polldchan()
686 card->rb_timer.data = (unsigned long) card; in icn_polldchan()
687 card->rb_timer.expires = jiffies + ICN_TIMER_BCREAD; in icn_polldchan()
688 add_timer(&card->rb_timer); in icn_polldchan()
691 mod_timer(&card->st_timer, jiffies + ICN_TIMER_DCREAD); in icn_polldchan()
692 spin_unlock_irqrestore(&card->lock, flags); in icn_polldchan()
705 icn_sendbuf(int channel, int ack, struct sk_buff *skb, icn_card *card) in icn_sendbuf() argument
717 if (!(card->flags & (channel) ? ICN_FLAGS_B2ACTIVE : ICN_FLAGS_B1ACTIVE)) in icn_sendbuf()
719 if (card->sndcount[channel] > ICN_MAX_SQUEUE) in icn_sendbuf()
728 skb_queue_tail(&card->spqueue[channel], nskb); in icn_sendbuf()
732 spin_lock_irqsave(&card->lock, flags); in icn_sendbuf()
733 card->sndcount[channel] += len; in icn_sendbuf()
734 spin_unlock_irqrestore(&card->lock, flags); in icn_sendbuf()
801 icn_loadboot(u_char __user *buffer, icn_card *card) in icn_loadboot() argument
819 if (!card->rvalid) { in icn_loadboot()
820 if (!request_region(card->port, ICN_PORTLEN, card->regname)) { in icn_loadboot()
824 card->port, in icn_loadboot()
825 card->port + ICN_PORTLEN); in icn_loadboot()
829 card->rvalid = 1; in icn_loadboot()
830 if (card->doubleS0) in icn_loadboot()
831 card->other->rvalid = 1; in icn_loadboot()
855 icn_map_channel(card, 0); /* Select Bank 0 */ in icn_loadboot()
856 icn_lock_channel(card, 0); /* Lock Bank 0 */ in icn_loadboot()
863 if (card->doubleS0) { in icn_loadboot()
870 icn_map_channel(card, 2); /* Select Bank 8 */ in icn_loadboot()
871 icn_lock_channel(card, 2); /* Lock Bank 8 */ in icn_loadboot()
881 if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1))) { in icn_loadboot()
884 if (!card->doubleS0) { in icn_loadboot()
893 icn_map_channel(card, 0); /* Select Bank 0 */ in icn_loadboot()
894 icn_lock_channel(card, 0); /* Lock Bank 0 */ in icn_loadboot()
906 icn_loadproto(u_char __user *buffer, icn_card *card) in icn_loadproto() argument
922 if (card->secondhalf) { in icn_loadproto()
923 icn_map_channel(card, 2); in icn_loadproto()
924 icn_lock_channel(card, 2); in icn_loadproto()
926 icn_map_channel(card, 0); in icn_loadproto()
927 icn_lock_channel(card, 0); in icn_loadproto()
936 icn_maprelease_channel(card, 0); in icn_loadproto()
949 icn_maprelease_channel(card, 0); in icn_loadproto()
969 icn_maprelease_channel(card, 0); in icn_loadproto()
977 if ((card->secondhalf) || (!card->doubleS0)) { in icn_loadproto()
980 card->secondhalf); in icn_loadproto()
982 spin_lock_irqsave(&card->lock, flags); in icn_loadproto()
983 init_timer(&card->st_timer); in icn_loadproto()
984 card->st_timer.expires = jiffies + ICN_TIMER_DCREAD; in icn_loadproto()
985 card->st_timer.function = icn_polldchan; in icn_loadproto()
986 card->st_timer.data = (unsigned long) card; in icn_loadproto()
987 add_timer(&card->st_timer); in icn_loadproto()
988 card->flags |= ICN_FLAGS_RUNNING; in icn_loadproto()
989 if (card->doubleS0) { in icn_loadproto()
990 init_timer(&card->other->st_timer); in icn_loadproto()
991 card->other->st_timer.expires = jiffies + ICN_TIMER_DCREAD; in icn_loadproto()
992 card->other->st_timer.function = icn_polldchan; in icn_loadproto()
993 card->other->st_timer.data = (unsigned long) card->other; in icn_loadproto()
994 add_timer(&card->other->st_timer); in icn_loadproto()
995 card->other->flags |= ICN_FLAGS_RUNNING; in icn_loadproto()
997 spin_unlock_irqrestore(&card->lock, flags); in icn_loadproto()
999 icn_maprelease_channel(card, 0); in icn_loadproto()
1007 icn_readstatus(u_char __user *buf, int len, icn_card *card) in icn_readstatus() argument
1013 if (card->msg_buf_read == card->msg_buf_write) in icn_readstatus()
1015 if (put_user(*card->msg_buf_read++, p)) in icn_readstatus()
1017 if (card->msg_buf_read > card->msg_buf_end) in icn_readstatus()
1018 card->msg_buf_read = card->msg_buf; in icn_readstatus()
1025 icn_writecmd(const u_char *buf, int len, int user, icn_card *card) in icn_writecmd() argument
1027 int mch = card->secondhalf ? 2 : 0; in icn_writecmd()
1056 icn_map_channel(card, mch); in icn_writecmd()
1058 icn_putmsg(card, '>'); in icn_writecmd()
1065 icn_putmsg(card, *p); in icn_writecmd()
1067 icn_putmsg(card, '>'); in icn_writecmd()
1086 cmd.driver = card->myid; in icn_writecmd()
1088 card->interface.statcallb(&cmd); in icn_writecmd()
1096 icn_stopcard(icn_card *card) in icn_stopcard() argument
1101 spin_lock_irqsave(&card->lock, flags); in icn_stopcard()
1102 if (card->flags & ICN_FLAGS_RUNNING) { in icn_stopcard()
1103 card->flags &= ~ICN_FLAGS_RUNNING; in icn_stopcard()
1104 del_timer(&card->st_timer); in icn_stopcard()
1105 del_timer(&card->rb_timer); in icn_stopcard()
1106 spin_unlock_irqrestore(&card->lock, flags); in icn_stopcard()
1108 cmd.driver = card->myid; in icn_stopcard()
1109 card->interface.statcallb(&cmd); in icn_stopcard()
1110 if (card->doubleS0) in icn_stopcard()
1111 icn_stopcard(card->other); in icn_stopcard()
1113 spin_unlock_irqrestore(&card->lock, flags); in icn_stopcard()
1134 icn_card *card = cards; in icn_disable_cards() local
1136 while (card) { in icn_disable_cards()
1137 if (!request_region(card->port, ICN_PORTLEN, "icn-isdn")) { in icn_disable_cards()
1141 card->port, in icn_disable_cards()
1142 card->port + ICN_PORTLEN); in icn_disable_cards()
1146 release_region(card->port, ICN_PORTLEN); in icn_disable_cards()
1148 card = card->next; in icn_disable_cards()
1153 icn_command(isdn_ctrl *c, icn_card *card) in icn_command() argument
1178 spin_lock_irqsave(&card->lock, flags); in icn_command()
1185 spin_unlock_irqrestore(&card->lock, flags); in icn_command()
1199 if (card->port != (unsigned short) a) { in icn_command()
1207 icn_stopcard(card); in icn_command()
1208 spin_lock_irqsave(&card->lock, flags); in icn_command()
1209 if (card->rvalid) in icn_command()
1210 release_region(card->port, ICN_PORTLEN); in icn_command()
1211 card->port = (unsigned short) a; in icn_command()
1212 card->rvalid = 0; in icn_command()
1213 if (card->doubleS0) { in icn_command()
1214 card->other->port = (unsigned short) a; in icn_command()
1215 card->other->rvalid = 0; in icn_command()
1217 spin_unlock_irqrestore(&card->lock, flags); in icn_command()
1220 CID, card->port); in icn_command()
1226 return (int) card->port; in icn_command()
1228 return (int) card->doubleS0; in icn_command()
1231 &card, in icn_command()
1248 icn_stopcard(card); in icn_command()
1249 return (icn_loadboot(arg, card)); in icn_command()
1251 icn_stopcard(card); in icn_command()
1252 if ((i = (icn_loadproto(arg, card)))) in icn_command()
1254 if (card->doubleS0) in icn_command()
1255 i = icn_loadproto(arg + ICN_CODE_STAGE2, card->other); in icn_command()
1269 if (!card->leased) { in icn_command()
1270 card->leased = 1; in icn_command()
1271 while (card->ptype == ISDN_PTYPE_UNKNOWN) { in icn_command()
1277 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); in icn_command()
1282 cmd.driver = card->myid; in icn_command()
1284 card->interface.statcallb(&cmd); in icn_command()
1287 if (card->leased) { in icn_command()
1288 card->leased = 0; in icn_command()
1290 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); in icn_command()
1295 cmd.driver = card->myid; in icn_command()
1297 card->interface.statcallb(&cmd); in icn_command()
1306 if (!(card->flags & ICN_FLAGS_RUNNING)) in icn_command()
1308 if (card->leased) in icn_command()
1327 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); in icn_command()
1331 if (!(card->flags & ICN_FLAGS_RUNNING)) in icn_command()
1335 if (card->fw_rev >= 300) { in icn_command()
1336 switch (card->l2_proto[a - 1]) { in icn_command()
1344 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); in icn_command()
1347 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); in icn_command()
1351 if (!(card->flags & ICN_FLAGS_RUNNING)) in icn_command()
1355 if (card->fw_rev >= 300) in icn_command()
1356 switch (card->l2_proto[a - 1]) { in icn_command()
1365 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); in icn_command()
1369 if (!(card->flags & ICN_FLAGS_RUNNING)) in icn_command()
1374 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); in icn_command()
1378 if (!(card->flags & ICN_FLAGS_RUNNING)) in icn_command()
1380 if (card->leased) in icn_command()
1384 if (card->ptype == ISDN_PTYPE_EURO) { in icn_command()
1390 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); in icn_command()
1394 if (!(card->flags & ICN_FLAGS_RUNNING)) in icn_command()
1396 if (card->leased) in icn_command()
1400 if (card->ptype == ISDN_PTYPE_EURO) in icn_command()
1404 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); in icn_command()
1408 if (!(card->flags & ICN_FLAGS_RUNNING)) in icn_command()
1422 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); in icn_command()
1423 card->l2_proto[a & 255] = (a >> 8); in icn_command()
1427 if (!(card->flags & ICN_FLAGS_RUNNING)) in icn_command()
1458 icn_card *card = icn_findcard(c->driver); in if_command() local
1460 if (card) in if_command()
1461 return (icn_command(c, card)); in if_command()
1471 icn_card *card = icn_findcard(id); in if_writecmd() local
1473 if (card) { in if_writecmd()
1474 if (!(card->flags & ICN_FLAGS_RUNNING)) in if_writecmd()
1476 return (icn_writecmd(buf, len, 1, card)); in if_writecmd()
1486 icn_card *card = icn_findcard(id); in if_readstatus() local
1488 if (card) { in if_readstatus()
1489 if (!(card->flags & ICN_FLAGS_RUNNING)) in if_readstatus()
1491 return (icn_readstatus(buf, len, card)); in if_readstatus()
1501 icn_card *card = icn_findcard(id); in if_sendbuf() local
1503 if (card) { in if_sendbuf()
1504 if (!(card->flags & ICN_FLAGS_RUNNING)) in if_sendbuf()
1506 return (icn_sendbuf(channel, ack, skb, card)); in if_sendbuf()
1520 icn_card *card; in icn_initcard() local
1523 if (!(card = kzalloc(sizeof(icn_card), GFP_KERNEL))) { in icn_initcard()
1528 spin_lock_init(&card->lock); in icn_initcard()
1529 card->port = port; in icn_initcard()
1530 card->interface.owner = THIS_MODULE; in icn_initcard()
1531 card->interface.hl_hdrlen = 1; in icn_initcard()
1532 card->interface.channels = ICN_BCH; in icn_initcard()
1533 card->interface.maxbufsize = 4000; in icn_initcard()
1534 card->interface.command = if_command; in icn_initcard()
1535 card->interface.writebuf_skb = if_sendbuf; in icn_initcard()
1536 card->interface.writecmd = if_writecmd; in icn_initcard()
1537 card->interface.readstat = if_readstatus; in icn_initcard()
1538 card->interface.features = ISDN_FEATURE_L2_X75I | in icn_initcard()
1542 card->ptype = ISDN_PTYPE_UNKNOWN; in icn_initcard()
1543 strlcpy(card->interface.id, id, sizeof(card->interface.id)); in icn_initcard()
1544 card->msg_buf_write = card->msg_buf; in icn_initcard()
1545 card->msg_buf_read = card->msg_buf; in icn_initcard()
1546 card->msg_buf_end = &card->msg_buf[sizeof(card->msg_buf) - 1]; in icn_initcard()
1548 card->l2_proto[i] = ISDN_PROTO_L2_X75I; in icn_initcard()
1549 skb_queue_head_init(&card->spqueue[i]); in icn_initcard()
1551 card->next = cards; in icn_initcard()
1552 cards = card; in icn_initcard()
1553 if (!register_isdn(&card->interface)) { in icn_initcard()
1557 kfree(card); in icn_initcard()
1560 card->myid = card->interface.channels; in icn_initcard()
1561 sprintf(card->regname, "icn-isdn (%s)", card->interface.id); in icn_initcard()
1562 return card; in icn_initcard()
1568 icn_card *card; in icn_addcard() local
1571 if (!(card = icn_initcard(port, id1))) { in icn_addcard()
1577 card->interface.id, port); in icn_addcard()
1585 card->doubleS0 = 1; in icn_addcard()
1586 card->secondhalf = 0; in icn_addcard()
1587 card->other = card2; in icn_addcard()
1590 card2->other = card; in icn_addcard()
1593 card->interface.id, card2->interface.id, port); in icn_addcard()
1653 icn_card *card = cards; in icn_exit() local
1659 while (card) { in icn_exit()
1661 cmd.driver = card->myid; in icn_exit()
1662 card->interface.statcallb(&cmd); in icn_exit()
1663 spin_lock_irqsave(&card->lock, flags); in icn_exit()
1664 if (card->rvalid) { in icn_exit()
1667 if (card->secondhalf || (!card->doubleS0)) { in icn_exit()
1668 release_region(card->port, ICN_PORTLEN); in icn_exit()
1669 card->rvalid = 0; in icn_exit()
1672 icn_free_queue(card, i); in icn_exit()
1674 tmpcard = card->next; in icn_exit()
1675 spin_unlock_irqrestore(&card->lock, flags); in icn_exit()
1676 card = tmpcard; in icn_exit()
1678 card = cards; in icn_exit()
1680 while (card) { in icn_exit()
1681 last = card; in icn_exit()
1682 card = card->next; in icn_exit()