aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/capi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 00:04:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 00:04:47 -0400
commit3b59bf081622b6446db77ad06c93fe23677bc533 (patch)
tree3f4bb5a27c90cc86994a1f6d3c53fbf9208003cb /drivers/isdn/capi
parente45836fafe157df137a837093037f741ad8f4c90 (diff)
parentbbdb32cb5b73597386913d052165423b9d736145 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking merge from David Miller: "1) Move ixgbe driver over to purely page based buffering on receive. From Alexander Duyck. 2) Add receive packet steering support to e1000e, from Bruce Allan. 3) Convert TCP MD5 support over to RCU, from Eric Dumazet. 4) Reduce cpu usage in handling out-of-order TCP packets on modern systems, also from Eric Dumazet. 5) Support the IP{,V6}_UNICAST_IF socket options, making the wine folks happy, from Erich Hoover. 6) Support VLAN trunking from guests in hyperv driver, from Haiyang Zhang. 7) Support byte-queue-limtis in r8169, from Igor Maravic. 8) Outline code intended for IP_RECVTOS in IP_PKTOPTIONS existed but was never properly implemented, Jiri Benc fixed that. 9) 64-bit statistics support in r8169 and 8139too, from Junchang Wang. 10) Support kernel side dump filtering by ctmark in netfilter ctnetlink, from Pablo Neira Ayuso. 11) Support byte-queue-limits in gianfar driver, from Paul Gortmaker. 12) Add new peek socket options to assist with socket migration, from Pavel Emelyanov. 13) Add sch_plug packet scheduler whose queue is controlled by userland daemons using explicit freeze and release commands. From Shriram Rajagopalan. 14) Fix FCOE checksum offload handling on transmit, from Yi Zou." * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1846 commits) Fix pppol2tp getsockname() Remove printk from rds_sendmsg ipv6: fix incorrent ipv6 ipsec packet fragment cpsw: Hook up default ndo_change_mtu. net: qmi_wwan: fix build error due to cdc-wdm dependecy netdev: driver: ethernet: Add TI CPSW driver netdev: driver: ethernet: add cpsw address lookup engine support phy: add am79c874 PHY support mlx4_core: fix race on comm channel bonding: send igmp report for its master fs_enet: Add MPC5125 FEC support and PHY interface selection net: bpf_jit: fix BPF_S_LDX_B_MSH compilation net: update the usage of CHECKSUM_UNNECESSARY fcoe: use CHECKSUM_UNNECESSARY instead of CHECKSUM_PARTIAL on tx net: do not do gso for CHECKSUM_UNNECESSARY in netif_needs_gso ixgbe: Fix issues with SR-IOV loopback when flow control is disabled net/hyperv: Fix the code handling tx busy ixgbe: fix namespace issues when FCoE/DCB is not enabled rtlwifi: Remove unused ETH_ADDR_LEN defines igbvf: Use ETH_ALEN ... Fix up fairly trivial conflicts in drivers/isdn/gigaset/interface.c and drivers/net/usb/{Kconfig,qmi_wwan.c} as per David.
Diffstat (limited to 'drivers/isdn/capi')
-rw-r--r--drivers/isdn/capi/capi.c180
-rw-r--r--drivers/isdn/capi/capidrv.c956
-rw-r--r--drivers/isdn/capi/capidrv.h42
-rw-r--r--drivers/isdn/capi/capilib.c16
-rw-r--r--drivers/isdn/capi/capiutil.c628
-rw-r--r--drivers/isdn/capi/kcapi.c116
-rw-r--r--drivers/isdn/capi/kcapi.h11
-rw-r--r--drivers/isdn/capi/kcapi_proc.c14
8 files changed, 981 insertions, 982 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 3a7905b06e53..b902794bbf07 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -25,7 +25,7 @@
25#include <linux/tty.h> 25#include <linux/tty.h>
26#include <linux/netdevice.h> 26#include <linux/netdevice.h>
27#include <linux/ppp_defs.h> 27#include <linux/ppp_defs.h>
28#include <linux/if_ppp.h> 28#include <linux/ppp-ioctl.h>
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
31#include <linux/seq_file.h> 31#include <linux/seq_file.h>
@@ -164,7 +164,7 @@ static int capiminor_del_ack(struct capiminor *mp, u16 datahandle)
164 164
165 spin_lock_bh(&mp->ackqlock); 165 spin_lock_bh(&mp->ackqlock);
166 list_for_each_entry_safe(p, tmp, &mp->ackqueue, list) { 166 list_for_each_entry_safe(p, tmp, &mp->ackqueue, list) {
167 if (p->datahandle == datahandle) { 167 if (p->datahandle == datahandle) {
168 list_del(&p->list); 168 list_del(&p->list);
169 mp->nack--; 169 mp->nack--;
170 spin_unlock_bh(&mp->ackqlock); 170 spin_unlock_bh(&mp->ackqlock);
@@ -199,8 +199,8 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
199 unsigned int minor; 199 unsigned int minor;
200 200
201 mp = kzalloc(sizeof(*mp), GFP_KERNEL); 201 mp = kzalloc(sizeof(*mp), GFP_KERNEL);
202 if (!mp) { 202 if (!mp) {
203 printk(KERN_ERR "capi: can't alloc capiminor\n"); 203 printk(KERN_ERR "capi: can't alloc capiminor\n");
204 return NULL; 204 return NULL;
205 } 205 }
206 206
@@ -391,7 +391,7 @@ gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb)
391 struct sk_buff *nskb; 391 struct sk_buff *nskb;
392 nskb = alloc_skb(CAPI_DATA_B3_RESP_LEN, GFP_KERNEL); 392 nskb = alloc_skb(CAPI_DATA_B3_RESP_LEN, GFP_KERNEL);
393 if (nskb) { 393 if (nskb) {
394 u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2); 394 u16 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 4 + 2);
395 unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN); 395 unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN);
396 capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN); 396 capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN);
397 capimsg_setu16(s, 2, mp->ap->applid); 397 capimsg_setu16(s, 2, mp->ap->applid);
@@ -418,7 +418,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
418 pr_debug("capi: currently no receiver\n"); 418 pr_debug("capi: currently no receiver\n");
419 return -1; 419 return -1;
420 } 420 }
421 421
422 ld = tty_ldisc_ref(tty); 422 ld = tty_ldisc_ref(tty);
423 if (!ld) { 423 if (!ld) {
424 /* fatal error, do not requeue */ 424 /* fatal error, do not requeue */
@@ -459,7 +459,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
459 ld->ops->receive_buf(tty, skb->data, NULL, skb->len); 459 ld->ops->receive_buf(tty, skb->data, NULL, skb->len);
460 } else { 460 } else {
461 printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n", 461 printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n",
462 errcode); 462 errcode);
463 kfree_skb(nskb); 463 kfree_skb(nskb);
464 464
465 if (errcode == CAPI_SENDQUEUEFULL) 465 if (errcode == CAPI_SENDQUEUEFULL)
@@ -618,7 +618,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
618 goto unlock_out; 618 goto unlock_out;
619 } 619 }
620 if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) { 620 if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) {
621 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+4+2); 621 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 4 + 2);
622 pr_debug("capi_signal: DATA_B3_IND %u len=%d\n", 622 pr_debug("capi_signal: DATA_B3_IND %u len=%d\n",
623 datahandle, skb->len-CAPIMSG_LEN(skb->data)); 623 datahandle, skb->len-CAPIMSG_LEN(skb->data));
624 skb_queue_tail(&mp->inqueue, skb); 624 skb_queue_tail(&mp->inqueue, skb);
@@ -627,10 +627,10 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
627 627
628 } else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) { 628 } else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) {
629 629
630 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4); 630 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4);
631 pr_debug("capi_signal: DATA_B3_CONF %u 0x%x\n", 631 pr_debug("capi_signal: DATA_B3_CONF %u 0x%x\n",
632 datahandle, 632 datahandle,
633 CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2)); 633 CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 2));
634 kfree_skb(skb); 634 kfree_skb(skb);
635 capiminor_del_ack(mp, datahandle); 635 capiminor_del_ack(mp, datahandle);
636 tty = tty_port_tty_get(&mp->port); 636 tty = tty_port_tty_get(&mp->port);
@@ -669,7 +669,7 @@ capi_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
669 if (file->f_flags & O_NONBLOCK) 669 if (file->f_flags & O_NONBLOCK)
670 return -EAGAIN; 670 return -EAGAIN;
671 err = wait_event_interruptible(cdev->recvwait, 671 err = wait_event_interruptible(cdev->recvwait,
672 (skb = skb_dequeue(&cdev->recvqueue))); 672 (skb = skb_dequeue(&cdev->recvqueue)));
673 if (err) 673 if (err)
674 return err; 674 return err;
675 } 675 }
@@ -736,7 +736,7 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos
736} 736}
737 737
738static unsigned int 738static unsigned int
739capi_poll(struct file *file, poll_table * wait) 739capi_poll(struct file *file, poll_table *wait)
740{ 740{
741 struct capidev *cdev = file->private_data; 741 struct capidev *cdev = file->private_data;
742 unsigned int mask = 0; 742 unsigned int mask = 0;
@@ -786,75 +786,75 @@ register_out:
786 return retval; 786 return retval;
787 787
788 case CAPI_GET_VERSION: 788 case CAPI_GET_VERSION:
789 { 789 {
790 if (copy_from_user(&data.contr, argp, 790 if (copy_from_user(&data.contr, argp,
791 sizeof(data.contr))) 791 sizeof(data.contr)))
792 return -EFAULT; 792 return -EFAULT;
793 cdev->errcode = capi20_get_version(data.contr, &data.version); 793 cdev->errcode = capi20_get_version(data.contr, &data.version);
794 if (cdev->errcode) 794 if (cdev->errcode)
795 return -EIO; 795 return -EIO;
796 if (copy_to_user(argp, &data.version, 796 if (copy_to_user(argp, &data.version,
797 sizeof(data.version))) 797 sizeof(data.version)))
798 return -EFAULT; 798 return -EFAULT;
799 } 799 }
800 return 0; 800 return 0;
801 801
802 case CAPI_GET_SERIAL: 802 case CAPI_GET_SERIAL:
803 { 803 {
804 if (copy_from_user(&data.contr, argp, 804 if (copy_from_user(&data.contr, argp,
805 sizeof(data.contr))) 805 sizeof(data.contr)))
806 return -EFAULT; 806 return -EFAULT;
807 cdev->errcode = capi20_get_serial (data.contr, data.serial); 807 cdev->errcode = capi20_get_serial(data.contr, data.serial);
808 if (cdev->errcode) 808 if (cdev->errcode)
809 return -EIO; 809 return -EIO;
810 if (copy_to_user(argp, data.serial, 810 if (copy_to_user(argp, data.serial,
811 sizeof(data.serial))) 811 sizeof(data.serial)))
812 return -EFAULT; 812 return -EFAULT;
813 } 813 }
814 return 0; 814 return 0;
815 case CAPI_GET_PROFILE: 815 case CAPI_GET_PROFILE:
816 { 816 {
817 if (copy_from_user(&data.contr, argp, 817 if (copy_from_user(&data.contr, argp,
818 sizeof(data.contr))) 818 sizeof(data.contr)))
819 return -EFAULT; 819 return -EFAULT;
820 820
821 if (data.contr == 0) { 821 if (data.contr == 0) {
822 cdev->errcode = capi20_get_profile(data.contr, &data.profile); 822 cdev->errcode = capi20_get_profile(data.contr, &data.profile);
823 if (cdev->errcode) 823 if (cdev->errcode)
824 return -EIO; 824 return -EIO;
825 825
826 retval = copy_to_user(argp, 826 retval = copy_to_user(argp,
827 &data.profile.ncontroller, 827 &data.profile.ncontroller,
828 sizeof(data.profile.ncontroller)); 828 sizeof(data.profile.ncontroller));
829 829
830 } else { 830 } else {
831 cdev->errcode = capi20_get_profile(data.contr, &data.profile); 831 cdev->errcode = capi20_get_profile(data.contr, &data.profile);
832 if (cdev->errcode) 832 if (cdev->errcode)
833 return -EIO; 833 return -EIO;
834 834
835 retval = copy_to_user(argp, &data.profile, 835 retval = copy_to_user(argp, &data.profile,
836 sizeof(data.profile)); 836 sizeof(data.profile));
837 }
838 if (retval)
839 return -EFAULT;
840 } 837 }
841 return 0; 838 if (retval)
839 return -EFAULT;
840 }
841 return 0;
842 842
843 case CAPI_GET_MANUFACTURER: 843 case CAPI_GET_MANUFACTURER:
844 { 844 {
845 if (copy_from_user(&data.contr, argp, 845 if (copy_from_user(&data.contr, argp,
846 sizeof(data.contr))) 846 sizeof(data.contr)))
847 return -EFAULT; 847 return -EFAULT;
848 cdev->errcode = capi20_get_manufacturer(data.contr, data.manufacturer); 848 cdev->errcode = capi20_get_manufacturer(data.contr, data.manufacturer);
849 if (cdev->errcode) 849 if (cdev->errcode)
850 return -EIO; 850 return -EIO;
851 851
852 if (copy_to_user(argp, data.manufacturer, 852 if (copy_to_user(argp, data.manufacturer,
853 sizeof(data.manufacturer))) 853 sizeof(data.manufacturer)))
854 return -EFAULT; 854 return -EFAULT;
855 855
856 } 856 }
857 return 0; 857 return 0;
858 case CAPI_GET_ERRCODE: 858 case CAPI_GET_ERRCODE:
859 data.errcode = cdev->errcode; 859 data.errcode = cdev->errcode;
860 cdev->errcode = CAPI_NOERROR; 860 cdev->errcode = CAPI_NOERROR;
@@ -871,15 +871,15 @@ register_out:
871 return -ENXIO; 871 return -ENXIO;
872 872
873 case CAPI_MANUFACTURER_CMD: 873 case CAPI_MANUFACTURER_CMD:
874 { 874 {
875 struct capi_manufacturer_cmd mcmd; 875 struct capi_manufacturer_cmd mcmd;
876 if (!capable(CAP_SYS_ADMIN)) 876 if (!capable(CAP_SYS_ADMIN))
877 return -EPERM; 877 return -EPERM;
878 if (copy_from_user(&mcmd, argp, sizeof(mcmd))) 878 if (copy_from_user(&mcmd, argp, sizeof(mcmd)))
879 return -EFAULT; 879 return -EFAULT;
880 return capi20_manufacturer(mcmd.cmd, mcmd.data); 880 return capi20_manufacturer(mcmd.cmd, mcmd.data);
881 } 881 }
882 return 0; 882 return 0;
883 883
884 case CAPI_SET_FLAGS: 884 case CAPI_SET_FLAGS:
885 case CAPI_CLR_FLAGS: { 885 case CAPI_CLR_FLAGS: {
@@ -1066,7 +1066,7 @@ static int capinc_tty_write(struct tty_struct *tty,
1066 mp->outbytes += skb->len; 1066 mp->outbytes += skb->len;
1067 } 1067 }
1068 1068
1069 skb = alloc_skb(CAPI_DATA_B3_REQ_LEN+count, GFP_ATOMIC); 1069 skb = alloc_skb(CAPI_DATA_B3_REQ_LEN + count, GFP_ATOMIC);
1070 if (!skb) { 1070 if (!skb) {
1071 printk(KERN_ERR "capinc_tty_write: alloc_skb failed\n"); 1071 printk(KERN_ERR "capinc_tty_write: alloc_skb failed\n");
1072 spin_unlock_bh(&mp->outlock); 1072 spin_unlock_bh(&mp->outlock);
@@ -1107,7 +1107,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
1107 invoke_send = true; 1107 invoke_send = true;
1108 } 1108 }
1109 1109
1110 skb = alloc_skb(CAPI_DATA_B3_REQ_LEN+CAPI_MAX_BLKSIZE, GFP_ATOMIC); 1110 skb = alloc_skb(CAPI_DATA_B3_REQ_LEN + CAPI_MAX_BLKSIZE, GFP_ATOMIC);
1111 if (skb) { 1111 if (skb) {
1112 skb_reserve(skb, CAPI_DATA_B3_REQ_LEN); 1112 skb_reserve(skb, CAPI_DATA_B3_REQ_LEN);
1113 *(skb_put(skb, 1)) = ch; 1113 *(skb_put(skb, 1)) = ch;
@@ -1171,12 +1171,12 @@ static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
1171} 1171}
1172 1172
1173static int capinc_tty_ioctl(struct tty_struct *tty, 1173static int capinc_tty_ioctl(struct tty_struct *tty,
1174 unsigned int cmd, unsigned long arg) 1174 unsigned int cmd, unsigned long arg)
1175{ 1175{
1176 return -ENOIOCTLCMD; 1176 return -ENOIOCTLCMD;
1177} 1177}
1178 1178
1179static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old) 1179static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
1180{ 1180{
1181 pr_debug("capinc_tty_set_termios\n"); 1181 pr_debug("capinc_tty_set_termios\n");
1182} 1182}
@@ -1339,18 +1339,18 @@ static inline void capinc_tty_exit(void) { }
1339 */ 1339 */
1340static int capi20_proc_show(struct seq_file *m, void *v) 1340static int capi20_proc_show(struct seq_file *m, void *v)
1341{ 1341{
1342 struct capidev *cdev; 1342 struct capidev *cdev;
1343 struct list_head *l; 1343 struct list_head *l;
1344 1344
1345 mutex_lock(&capidev_list_lock); 1345 mutex_lock(&capidev_list_lock);
1346 list_for_each(l, &capidev_list) { 1346 list_for_each(l, &capidev_list) {
1347 cdev = list_entry(l, struct capidev, list); 1347 cdev = list_entry(l, struct capidev, list);
1348 seq_printf(m, "0 %d %lu %lu %lu %lu\n", 1348 seq_printf(m, "0 %d %lu %lu %lu %lu\n",
1349 cdev->ap.applid, 1349 cdev->ap.applid,
1350 cdev->ap.nrecvctlpkt, 1350 cdev->ap.nrecvctlpkt,
1351 cdev->ap.nrecvdatapkt, 1351 cdev->ap.nrecvdatapkt,
1352 cdev->ap.nsentctlpkt, 1352 cdev->ap.nsentctlpkt,
1353 cdev->ap.nsentdatapkt); 1353 cdev->ap.nsentdatapkt);
1354 } 1354 }
1355 mutex_unlock(&capidev_list_lock); 1355 mutex_unlock(&capidev_list_lock);
1356 return 0; 1356 return 0;
@@ -1445,9 +1445,9 @@ static int __init capi_init(void)
1445 proc_init(); 1445 proc_init();
1446 1446
1447#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE 1447#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1448 compileinfo = " (middleware)"; 1448 compileinfo = " (middleware)";
1449#else 1449#else
1450 compileinfo = " (no middleware)"; 1450 compileinfo = " (no middleware)";
1451#endif 1451#endif
1452 printk(KERN_NOTICE "CAPI 2.0 started up with major %d%s\n", 1452 printk(KERN_NOTICE "CAPI 2.0 started up with major %d%s\n",
1453 capi_major, compileinfo); 1453 capi_major, compileinfo);
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index 92607ed25e2e..6f5016b479f8 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -40,7 +40,7 @@ static int debugmode = 0;
40MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux"); 40MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux");
41MODULE_AUTHOR("Carsten Paeth"); 41MODULE_AUTHOR("Carsten Paeth");
42MODULE_LICENSE("GPL"); 42MODULE_LICENSE("GPL");
43module_param(debugmode, uint, S_IRUGO|S_IWUSR); 43module_param(debugmode, uint, S_IRUGO | S_IWUSR);
44 44
45/* -------- type definitions ----------------------------------------- */ 45/* -------- type definitions ----------------------------------------- */
46 46
@@ -64,7 +64,7 @@ struct capidrv_contr {
64 int state; 64 int state;
65 u32 cipmask; 65 u32 cipmask;
66 u32 cipmask2; 66 u32 cipmask2;
67 struct timer_list listentimer; 67 struct timer_list listentimer;
68 68
69 /* 69 /*
70 * ID of capi message sent 70 * ID of capi message sent
@@ -105,9 +105,9 @@ struct capidrv_contr {
105 /* */ 105 /* */
106 u16 datahandle; 106 u16 datahandle;
107 struct ncci_datahandle_queue { 107 struct ncci_datahandle_queue {
108 struct ncci_datahandle_queue *next; 108 struct ncci_datahandle_queue *next;
109 u16 datahandle; 109 u16 datahandle;
110 int len; 110 int len;
111 } *ackqueue; 111 } *ackqueue;
112 } *ncci_list; 112 } *ncci_list;
113 } *plcip; 113 } *plcip;
@@ -142,7 +142,7 @@ static capidrv_data global;
142static DEFINE_SPINLOCK(global_lock); 142static DEFINE_SPINLOCK(global_lock);
143 143
144static void handle_dtrace_data(capidrv_contr *card, 144static void handle_dtrace_data(capidrv_contr *card,
145 int send, int level2, u8 *data, u16 len); 145 int send, int level2, u8 *data, u16 len);
146 146
147/* -------- convert functions ---------------------------------------- */ 147/* -------- convert functions ---------------------------------------- */
148 148
@@ -158,11 +158,11 @@ static inline u32 b1prot(int l2, int l3)
158 return 0; 158 return 0;
159 case ISDN_PROTO_L2_TRANS: 159 case ISDN_PROTO_L2_TRANS:
160 return 1; 160 return 1;
161 case ISDN_PROTO_L2_V11096: 161 case ISDN_PROTO_L2_V11096:
162 case ISDN_PROTO_L2_V11019: 162 case ISDN_PROTO_L2_V11019:
163 case ISDN_PROTO_L2_V11038: 163 case ISDN_PROTO_L2_V11038:
164 return 2; 164 return 2;
165 case ISDN_PROTO_L2_FAX: 165 case ISDN_PROTO_L2_FAX:
166 return 4; 166 return 4;
167 case ISDN_PROTO_L2_MODEM: 167 case ISDN_PROTO_L2_MODEM:
168 return 8; 168 return 8;
@@ -179,12 +179,12 @@ static inline u32 b2prot(int l2, int l3)
179 return 0; 179 return 0;
180 case ISDN_PROTO_L2_HDLC: 180 case ISDN_PROTO_L2_HDLC:
181 case ISDN_PROTO_L2_TRANS: 181 case ISDN_PROTO_L2_TRANS:
182 case ISDN_PROTO_L2_V11096: 182 case ISDN_PROTO_L2_V11096:
183 case ISDN_PROTO_L2_V11019: 183 case ISDN_PROTO_L2_V11019:
184 case ISDN_PROTO_L2_V11038: 184 case ISDN_PROTO_L2_V11038:
185 case ISDN_PROTO_L2_MODEM: 185 case ISDN_PROTO_L2_MODEM:
186 return 1; 186 return 1;
187 case ISDN_PROTO_L2_FAX: 187 case ISDN_PROTO_L2_FAX:
188 return 4; 188 return 4;
189 } 189 }
190} 190}
@@ -197,13 +197,13 @@ static inline u32 b3prot(int l2, int l3)
197 case ISDN_PROTO_L2_X75BUI: 197 case ISDN_PROTO_L2_X75BUI:
198 case ISDN_PROTO_L2_HDLC: 198 case ISDN_PROTO_L2_HDLC:
199 case ISDN_PROTO_L2_TRANS: 199 case ISDN_PROTO_L2_TRANS:
200 case ISDN_PROTO_L2_V11096: 200 case ISDN_PROTO_L2_V11096:
201 case ISDN_PROTO_L2_V11019: 201 case ISDN_PROTO_L2_V11019:
202 case ISDN_PROTO_L2_V11038: 202 case ISDN_PROTO_L2_V11038:
203 case ISDN_PROTO_L2_MODEM: 203 case ISDN_PROTO_L2_MODEM:
204 default: 204 default:
205 return 0; 205 return 0;
206 case ISDN_PROTO_L2_FAX: 206 case ISDN_PROTO_L2_FAX:
207 return 4; 207 return 4;
208 } 208 }
209} 209}
@@ -231,38 +231,38 @@ static _cstruct b1config(int l2, int l3)
231 case ISDN_PROTO_L2_TRANS: 231 case ISDN_PROTO_L2_TRANS:
232 default: 232 default:
233 return NULL; 233 return NULL;
234 case ISDN_PROTO_L2_V11096: 234 case ISDN_PROTO_L2_V11096:
235 return b1config_async_v110(9600); 235 return b1config_async_v110(9600);
236 case ISDN_PROTO_L2_V11019: 236 case ISDN_PROTO_L2_V11019:
237 return b1config_async_v110(19200); 237 return b1config_async_v110(19200);
238 case ISDN_PROTO_L2_V11038: 238 case ISDN_PROTO_L2_V11038:
239 return b1config_async_v110(38400); 239 return b1config_async_v110(38400);
240 } 240 }
241} 241}
242 242
243static inline u16 si2cip(u8 si1, u8 si2) 243static inline u16 si2cip(u8 si1, u8 si2)
244{ 244{
245 static const u8 cip[17][5] = 245 static const u8 cip[17][5] =
246 { 246 {
247 /* 0 1 2 3 4 */ 247 /* 0 1 2 3 4 */
248 {0, 0, 0, 0, 0}, /*0 */ 248 {0, 0, 0, 0, 0}, /*0 */
249 {16, 16, 4, 26, 16}, /*1 */ 249 {16, 16, 4, 26, 16}, /*1 */
250 {17, 17, 17, 4, 4}, /*2 */ 250 {17, 17, 17, 4, 4}, /*2 */
251 {2, 2, 2, 2, 2}, /*3 */ 251 {2, 2, 2, 2, 2}, /*3 */
252 {18, 18, 18, 18, 18}, /*4 */ 252 {18, 18, 18, 18, 18}, /*4 */
253 {2, 2, 2, 2, 2}, /*5 */ 253 {2, 2, 2, 2, 2}, /*5 */
254 {0, 0, 0, 0, 0}, /*6 */ 254 {0, 0, 0, 0, 0}, /*6 */
255 {2, 2, 2, 2, 2}, /*7 */ 255 {2, 2, 2, 2, 2}, /*7 */
256 {2, 2, 2, 2, 2}, /*8 */ 256 {2, 2, 2, 2, 2}, /*8 */
257 {21, 21, 21, 21, 21}, /*9 */ 257 {21, 21, 21, 21, 21}, /*9 */
258 {19, 19, 19, 19, 19}, /*10 */ 258 {19, 19, 19, 19, 19}, /*10 */
259 {0, 0, 0, 0, 0}, /*11 */ 259 {0, 0, 0, 0, 0}, /*11 */
260 {0, 0, 0, 0, 0}, /*12 */ 260 {0, 0, 0, 0, 0}, /*12 */
261 {0, 0, 0, 0, 0}, /*13 */ 261 {0, 0, 0, 0, 0}, /*13 */
262 {0, 0, 0, 0, 0}, /*14 */ 262 {0, 0, 0, 0, 0}, /*14 */
263 {22, 22, 22, 22, 22}, /*15 */ 263 {22, 22, 22, 22, 22}, /*15 */
264 {27, 27, 27, 28, 27} /*16 */ 264 {27, 27, 27, 28, 27} /*16 */
265 }; 265 };
266 if (si1 > 16) 266 if (si1 > 16)
267 si1 = 0; 267 si1 = 0;
268 if (si2 > 4) 268 if (si2 > 4)
@@ -274,10 +274,10 @@ static inline u16 si2cip(u8 si1, u8 si2)
274static inline u8 cip2si1(u16 cipval) 274static inline u8 cip2si1(u16 cipval)
275{ 275{
276 static const u8 si[32] = 276 static const u8 si[32] =
277 {7, 1, 7, 7, 1, 1, 7, 7, /*0-7 */ 277 {7, 1, 7, 7, 1, 1, 7, 7, /*0-7 */
278 7, 1, 0, 0, 0, 0, 0, 0, /*8-15 */ 278 7, 1, 0, 0, 0, 0, 0, 0, /*8-15 */
279 1, 2, 4, 10, 9, 9, 15, 7, /*16-23 */ 279 1, 2, 4, 10, 9, 9, 15, 7, /*16-23 */
280 7, 7, 1, 16, 16, 0, 0, 0}; /*24-31 */ 280 7, 7, 1, 16, 16, 0, 0, 0}; /*24-31 */
281 281
282 if (cipval > 31) 282 if (cipval > 31)
283 cipval = 0; /* .... */ 283 cipval = 0; /* .... */
@@ -287,10 +287,10 @@ static inline u8 cip2si1(u16 cipval)
287static inline u8 cip2si2(u16 cipval) 287static inline u8 cip2si2(u16 cipval)
288{ 288{
289 static const u8 si[32] = 289 static const u8 si[32] =
290 {0, 0, 0, 0, 2, 3, 0, 0, /*0-7 */ 290 {0, 0, 0, 0, 2, 3, 0, 0, /*0-7 */
291 0, 3, 0, 0, 0, 0, 0, 0, /*8-15 */ 291 0, 3, 0, 0, 0, 0, 0, 0, /*8-15 */
292 1, 2, 0, 0, 9, 0, 0, 0, /*16-23 */ 292 1, 2, 0, 0, 9, 0, 0, 0, /*16-23 */
293 0, 0, 3, 2, 3, 0, 0, 0}; /*24-31 */ 293 0, 0, 3, 2, 3, 0, 0, 0}; /*24-31 */
294 294
295 if (cipval > 31) 295 if (cipval > 31)
296 cipval = 0; /* .... */ 296 cipval = 0; /* .... */
@@ -302,7 +302,7 @@ static inline u8 cip2si2(u16 cipval)
302 302
303static inline capidrv_contr *findcontrbydriverid(int driverid) 303static inline capidrv_contr *findcontrbydriverid(int driverid)
304{ 304{
305 unsigned long flags; 305 unsigned long flags;
306 capidrv_contr *p; 306 capidrv_contr *p;
307 307
308 spin_lock_irqsave(&global_lock, flags); 308 spin_lock_irqsave(&global_lock, flags);
@@ -329,7 +329,7 @@ static capidrv_contr *findcontrbynumber(u32 contr)
329 329
330/* -------- plci management ------------------------------------------ */ 330/* -------- plci management ------------------------------------------ */
331 331
332static capidrv_plci *new_plci(capidrv_contr * card, int chan) 332static capidrv_plci *new_plci(capidrv_contr *card, int chan)
333{ 333{
334 capidrv_plci *plcip; 334 capidrv_plci *plcip;
335 335
@@ -349,7 +349,7 @@ static capidrv_plci *new_plci(capidrv_contr * card, int chan)
349 return plcip; 349 return plcip;
350} 350}
351 351
352static capidrv_plci *find_plci_by_plci(capidrv_contr * card, u32 plci) 352static capidrv_plci *find_plci_by_plci(capidrv_contr *card, u32 plci)
353{ 353{
354 capidrv_plci *p; 354 capidrv_plci *p;
355 for (p = card->plci_list; p; p = p->next) 355 for (p = card->plci_list; p; p = p->next)
@@ -358,7 +358,7 @@ static capidrv_plci *find_plci_by_plci(capidrv_contr * card, u32 plci)
358 return NULL; 358 return NULL;
359} 359}
360 360
361static capidrv_plci *find_plci_by_msgid(capidrv_contr * card, u16 msgid) 361static capidrv_plci *find_plci_by_msgid(capidrv_contr *card, u16 msgid)
362{ 362{
363 capidrv_plci *p; 363 capidrv_plci *p;
364 for (p = card->plci_list; p; p = p->next) 364 for (p = card->plci_list; p; p = p->next)
@@ -367,7 +367,7 @@ static capidrv_plci *find_plci_by_msgid(capidrv_contr * card, u16 msgid)
367 return NULL; 367 return NULL;
368} 368}
369 369
370static capidrv_plci *find_plci_by_ncci(capidrv_contr * card, u32 ncci) 370static capidrv_plci *find_plci_by_ncci(capidrv_contr *card, u32 ncci)
371{ 371{
372 capidrv_plci *p; 372 capidrv_plci *p;
373 for (p = card->plci_list; p; p = p->next) 373 for (p = card->plci_list; p; p = p->next)
@@ -376,7 +376,7 @@ static capidrv_plci *find_plci_by_ncci(capidrv_contr * card, u32 ncci)
376 return NULL; 376 return NULL;
377} 377}
378 378
379static void free_plci(capidrv_contr * card, capidrv_plci * plcip) 379static void free_plci(capidrv_contr *card, capidrv_plci *plcip)
380{ 380{
381 capidrv_plci **pp; 381 capidrv_plci **pp;
382 382
@@ -396,8 +396,8 @@ static void free_plci(capidrv_contr * card, capidrv_plci * plcip)
396 396
397/* -------- ncci management ------------------------------------------ */ 397/* -------- ncci management ------------------------------------------ */
398 398
399static inline capidrv_ncci *new_ncci(capidrv_contr * card, 399static inline capidrv_ncci *new_ncci(capidrv_contr *card,
400 capidrv_plci * plcip, 400 capidrv_plci *plcip,
401 u32 ncci) 401 u32 ncci)
402{ 402{
403 capidrv_ncci *nccip; 403 capidrv_ncci *nccip;
@@ -421,7 +421,7 @@ static inline capidrv_ncci *new_ncci(capidrv_contr * card,
421 return nccip; 421 return nccip;
422} 422}
423 423
424static inline capidrv_ncci *find_ncci(capidrv_contr * card, u32 ncci) 424static inline capidrv_ncci *find_ncci(capidrv_contr *card, u32 ncci)
425{ 425{
426 capidrv_plci *plcip; 426 capidrv_plci *plcip;
427 capidrv_ncci *p; 427 capidrv_ncci *p;
@@ -435,7 +435,7 @@ static inline capidrv_ncci *find_ncci(capidrv_contr * card, u32 ncci)
435 return NULL; 435 return NULL;
436} 436}
437 437
438static inline capidrv_ncci *find_ncci_by_msgid(capidrv_contr * card, 438static inline capidrv_ncci *find_ncci_by_msgid(capidrv_contr *card,
439 u32 ncci, u16 msgid) 439 u32 ncci, u16 msgid)
440{ 440{
441 capidrv_plci *plcip; 441 capidrv_plci *plcip;
@@ -450,7 +450,7 @@ static inline capidrv_ncci *find_ncci_by_msgid(capidrv_contr * card,
450 return NULL; 450 return NULL;
451} 451}
452 452
453static void free_ncci(capidrv_contr * card, struct capidrv_ncci *nccip) 453static void free_ncci(capidrv_contr *card, struct capidrv_ncci *nccip)
454{ 454{
455 struct capidrv_ncci **pp; 455 struct capidrv_ncci **pp;
456 456
@@ -465,20 +465,20 @@ static void free_ncci(capidrv_contr * card, struct capidrv_ncci *nccip)
465} 465}
466 466
467static int capidrv_add_ack(struct capidrv_ncci *nccip, 467static int capidrv_add_ack(struct capidrv_ncci *nccip,
468 u16 datahandle, int len) 468 u16 datahandle, int len)
469{ 469{
470 struct ncci_datahandle_queue *n, **pp; 470 struct ncci_datahandle_queue *n, **pp;
471 471
472 n = (struct ncci_datahandle_queue *) 472 n = (struct ncci_datahandle_queue *)
473 kmalloc(sizeof(struct ncci_datahandle_queue), GFP_ATOMIC); 473 kmalloc(sizeof(struct ncci_datahandle_queue), GFP_ATOMIC);
474 if (!n) { 474 if (!n) {
475 printk(KERN_ERR "capidrv: kmalloc ncci_datahandle failed\n"); 475 printk(KERN_ERR "capidrv: kmalloc ncci_datahandle failed\n");
476 return -1; 476 return -1;
477 } 477 }
478 n->next = NULL; 478 n->next = NULL;
479 n->datahandle = datahandle; 479 n->datahandle = datahandle;
480 n->len = len; 480 n->len = len;
481 for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) ; 481 for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next);
482 *pp = n; 482 *pp = n;
483 return 0; 483 return 0;
484} 484}
@@ -489,11 +489,11 @@ static int capidrv_del_ack(struct capidrv_ncci *nccip, u16 datahandle)
489 int len; 489 int len;
490 490
491 for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) { 491 for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) {
492 if ((*pp)->datahandle == datahandle) { 492 if ((*pp)->datahandle == datahandle) {
493 p = *pp; 493 p = *pp;
494 len = p->len; 494 len = p->len;
495 *pp = (*pp)->next; 495 *pp = (*pp)->next;
496 kfree(p); 496 kfree(p);
497 return len; 497 return len;
498 } 498 }
499 } 499 }
@@ -502,7 +502,7 @@ static int capidrv_del_ack(struct capidrv_ncci *nccip, u16 datahandle)
502 502
503/* -------- convert and send capi message ---------------------------- */ 503/* -------- convert and send capi message ---------------------------- */
504 504
505static void send_message(capidrv_contr * card, _cmsg * cmsg) 505static void send_message(capidrv_contr *card, _cmsg *cmsg)
506{ 506{
507 struct sk_buff *skb; 507 struct sk_buff *skb;
508 size_t len; 508 size_t len;
@@ -529,18 +529,18 @@ struct listenstatechange {
529 529
530static struct listenstatechange listentable[] = 530static struct listenstatechange listentable[] =
531{ 531{
532 {ST_LISTEN_NONE, ST_LISTEN_WAIT_CONF, EV_LISTEN_REQ}, 532 {ST_LISTEN_NONE, ST_LISTEN_WAIT_CONF, EV_LISTEN_REQ},
533 {ST_LISTEN_ACTIVE, ST_LISTEN_ACTIVE_WAIT_CONF, EV_LISTEN_REQ}, 533 {ST_LISTEN_ACTIVE, ST_LISTEN_ACTIVE_WAIT_CONF, EV_LISTEN_REQ},
534 {ST_LISTEN_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_ERROR}, 534 {ST_LISTEN_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_ERROR},
535 {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_ERROR}, 535 {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_ERROR},
536 {ST_LISTEN_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_EMPTY}, 536 {ST_LISTEN_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_EMPTY},
537 {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_EMPTY}, 537 {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_NONE, EV_LISTEN_CONF_EMPTY},
538 {ST_LISTEN_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_OK}, 538 {ST_LISTEN_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_OK},
539 {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_OK}, 539 {ST_LISTEN_ACTIVE_WAIT_CONF, ST_LISTEN_ACTIVE, EV_LISTEN_CONF_OK},
540 {}, 540 {},
541}; 541};
542 542
543static void listen_change_state(capidrv_contr * card, int event) 543static void listen_change_state(capidrv_contr *card, int event)
544{ 544{
545 struct listenstatechange *p = listentable; 545 struct listenstatechange *p = listentable;
546 while (p->event) { 546 while (p->event) {
@@ -560,7 +560,7 @@ static void listen_change_state(capidrv_contr * card, int event)
560 560
561/* ------------------------------------------------------------------ */ 561/* ------------------------------------------------------------------ */
562 562
563static void p0(capidrv_contr * card, capidrv_plci * plci) 563static void p0(capidrv_contr *card, capidrv_plci *plci)
564{ 564{
565 isdn_ctrl cmd; 565 isdn_ctrl cmd;
566 566
@@ -578,71 +578,71 @@ struct plcistatechange {
578 int actstate; 578 int actstate;
579 int nextstate; 579 int nextstate;
580 int event; 580 int event;
581 void (*changefunc) (capidrv_contr * card, capidrv_plci * plci); 581 void (*changefunc)(capidrv_contr *card, capidrv_plci *plci);
582}; 582};
583 583
584static struct plcistatechange plcitable[] = 584static struct plcistatechange plcitable[] =
585{ 585{
586 /* P-0 */ 586 /* P-0 */
587 {ST_PLCI_NONE, ST_PLCI_OUTGOING, EV_PLCI_CONNECT_REQ, NULL}, 587 {ST_PLCI_NONE, ST_PLCI_OUTGOING, EV_PLCI_CONNECT_REQ, NULL},
588 {ST_PLCI_NONE, ST_PLCI_ALLOCATED, EV_PLCI_FACILITY_IND_UP, NULL}, 588 {ST_PLCI_NONE, ST_PLCI_ALLOCATED, EV_PLCI_FACILITY_IND_UP, NULL},
589 {ST_PLCI_NONE, ST_PLCI_INCOMING, EV_PLCI_CONNECT_IND, NULL}, 589 {ST_PLCI_NONE, ST_PLCI_INCOMING, EV_PLCI_CONNECT_IND, NULL},
590 {ST_PLCI_NONE, ST_PLCI_RESUMEING, EV_PLCI_RESUME_REQ, NULL}, 590 {ST_PLCI_NONE, ST_PLCI_RESUMEING, EV_PLCI_RESUME_REQ, NULL},
591 /* P-0.1 */ 591 /* P-0.1 */
592 {ST_PLCI_OUTGOING, ST_PLCI_NONE, EV_PLCI_CONNECT_CONF_ERROR, p0}, 592 {ST_PLCI_OUTGOING, ST_PLCI_NONE, EV_PLCI_CONNECT_CONF_ERROR, p0},
593 {ST_PLCI_OUTGOING, ST_PLCI_ALLOCATED, EV_PLCI_CONNECT_CONF_OK, NULL}, 593 {ST_PLCI_OUTGOING, ST_PLCI_ALLOCATED, EV_PLCI_CONNECT_CONF_OK, NULL},
594 /* P-1 */ 594 /* P-1 */
595 {ST_PLCI_ALLOCATED, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, NULL}, 595 {ST_PLCI_ALLOCATED, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, NULL},
596 {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, 596 {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL},
597 {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, 597 {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL},
598 {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, 598 {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
599 /* P-ACT */ 599 /* P-ACT */
600 {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, 600 {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL},
601 {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, 601 {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL},
602 {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, 602 {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
603 {ST_PLCI_ACTIVE, ST_PLCI_HELD, EV_PLCI_HOLD_IND, NULL}, 603 {ST_PLCI_ACTIVE, ST_PLCI_HELD, EV_PLCI_HOLD_IND, NULL},
604 {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_SUSPEND_IND, NULL}, 604 {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_SUSPEND_IND, NULL},
605 /* P-2 */ 605 /* P-2 */
606 {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, NULL}, 606 {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, NULL},
607 {ST_PLCI_INCOMING, ST_PLCI_FACILITY_IND, EV_PLCI_FACILITY_IND_UP, NULL}, 607 {ST_PLCI_INCOMING, ST_PLCI_FACILITY_IND, EV_PLCI_FACILITY_IND_UP, NULL},
608 {ST_PLCI_INCOMING, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_RESP, NULL}, 608 {ST_PLCI_INCOMING, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_RESP, NULL},
609 {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, 609 {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL},
610 {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, 610 {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL},
611 {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, 611 {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
612 {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CD_IND, NULL}, 612 {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CD_IND, NULL},
613 /* P-3 */ 613 /* P-3 */
614 {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, NULL}, 614 {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, NULL},
615 {ST_PLCI_FACILITY_IND, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_ACTIVE_IND, NULL}, 615 {ST_PLCI_FACILITY_IND, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_ACTIVE_IND, NULL},
616 {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, 616 {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL},
617 {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, 617 {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL},
618 {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, 618 {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
619 /* P-4 */ 619 /* P-4 */
620 {ST_PLCI_ACCEPTING, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, NULL}, 620 {ST_PLCI_ACCEPTING, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, NULL},
621 {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL}, 621 {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL},
622 {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL}, 622 {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL},
623 {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, 623 {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
624 /* P-5 */ 624 /* P-5 */
625 {ST_PLCI_DISCONNECTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL}, 625 {ST_PLCI_DISCONNECTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
626 /* P-6 */ 626 /* P-6 */
627 {ST_PLCI_DISCONNECTED, ST_PLCI_NONE, EV_PLCI_DISCONNECT_RESP, p0}, 627 {ST_PLCI_DISCONNECTED, ST_PLCI_NONE, EV_PLCI_DISCONNECT_RESP, p0},
628 /* P-0.Res */ 628 /* P-0.Res */
629 {ST_PLCI_RESUMEING, ST_PLCI_NONE, EV_PLCI_RESUME_CONF_ERROR, p0}, 629 {ST_PLCI_RESUMEING, ST_PLCI_NONE, EV_PLCI_RESUME_CONF_ERROR, p0},
630 {ST_PLCI_RESUMEING, ST_PLCI_RESUME, EV_PLCI_RESUME_CONF_OK, NULL}, 630 {ST_PLCI_RESUMEING, ST_PLCI_RESUME, EV_PLCI_RESUME_CONF_OK, NULL},
631 /* P-RES */ 631 /* P-RES */
632 {ST_PLCI_RESUME, ST_PLCI_ACTIVE, EV_PLCI_RESUME_IND, NULL}, 632 {ST_PLCI_RESUME, ST_PLCI_ACTIVE, EV_PLCI_RESUME_IND, NULL},
633 /* P-HELD */ 633 /* P-HELD */
634 {ST_PLCI_HELD, ST_PLCI_ACTIVE, EV_PLCI_RETRIEVE_IND, NULL}, 634 {ST_PLCI_HELD, ST_PLCI_ACTIVE, EV_PLCI_RETRIEVE_IND, NULL},
635 {}, 635 {},
636}; 636};
637 637
638static void plci_change_state(capidrv_contr * card, capidrv_plci * plci, int event) 638static void plci_change_state(capidrv_contr *card, capidrv_plci *plci, int event)
639{ 639{
640 struct plcistatechange *p = plcitable; 640 struct plcistatechange *p = plcitable;
641 while (p->event) { 641 while (p->event) {
642 if (plci->state == p->actstate && p->event == event) { 642 if (plci->state == p->actstate && p->event == event) {
643 if (debugmode) 643 if (debugmode)
644 printk(KERN_DEBUG "capidrv-%d: plci_change_state:0x%x %d -> %d\n", 644 printk(KERN_DEBUG "capidrv-%d: plci_change_state:0x%x %d -> %d\n",
645 card->contrnr, plci->plci, plci->state, p->nextstate); 645 card->contrnr, plci->plci, plci->state, p->nextstate);
646 plci->state = p->nextstate; 646 plci->state = p->nextstate;
647 if (p->changefunc) 647 if (p->changefunc)
648 p->changefunc(card, plci); 648 p->changefunc(card, plci);
@@ -658,7 +658,7 @@ static void plci_change_state(capidrv_contr * card, capidrv_plci * plci, int eve
658 658
659static _cmsg cmsg; 659static _cmsg cmsg;
660 660
661static void n0(capidrv_contr * card, capidrv_ncci * ncci) 661static void n0(capidrv_contr *card, capidrv_ncci *ncci)
662{ 662{
663 isdn_ctrl cmd; 663 isdn_ctrl cmd;
664 664
@@ -670,7 +670,7 @@ static void n0(capidrv_contr * card, capidrv_ncci * ncci)
670 NULL, /* Keypadfacility */ 670 NULL, /* Keypadfacility */
671 NULL, /* Useruserdata */ /* $$$$ */ 671 NULL, /* Useruserdata */ /* $$$$ */
672 NULL /* Facilitydataarray */ 672 NULL /* Facilitydataarray */
673 ); 673 );
674 plci_change_state(card, ncci->plcip, EV_PLCI_DISCONNECT_REQ); 674 plci_change_state(card, ncci->plcip, EV_PLCI_DISCONNECT_REQ);
675 send_message(card, &cmsg); 675 send_message(card, &cmsg);
676 676
@@ -687,51 +687,51 @@ struct nccistatechange {
687 int actstate; 687 int actstate;
688 int nextstate; 688 int nextstate;
689 int event; 689 int event;
690 void (*changefunc) (capidrv_contr * card, capidrv_ncci * ncci); 690 void (*changefunc)(capidrv_contr *card, capidrv_ncci *ncci);
691}; 691};
692 692
693static struct nccistatechange nccitable[] = 693static struct nccistatechange nccitable[] =
694{ 694{
695 /* N-0 */ 695 /* N-0 */
696 {ST_NCCI_NONE, ST_NCCI_OUTGOING, EV_NCCI_CONNECT_B3_REQ, NULL}, 696 {ST_NCCI_NONE, ST_NCCI_OUTGOING, EV_NCCI_CONNECT_B3_REQ, NULL},
697 {ST_NCCI_NONE, ST_NCCI_INCOMING, EV_NCCI_CONNECT_B3_IND, NULL}, 697 {ST_NCCI_NONE, ST_NCCI_INCOMING, EV_NCCI_CONNECT_B3_IND, NULL},
698 /* N-0.1 */ 698 /* N-0.1 */
699 {ST_NCCI_OUTGOING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_CONF_OK, NULL}, 699 {ST_NCCI_OUTGOING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_CONF_OK, NULL},
700 {ST_NCCI_OUTGOING, ST_NCCI_NONE, EV_NCCI_CONNECT_B3_CONF_ERROR, n0}, 700 {ST_NCCI_OUTGOING, ST_NCCI_NONE, EV_NCCI_CONNECT_B3_CONF_ERROR, n0},
701 /* N-1 */ 701 /* N-1 */
702 {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_CONNECT_B3_REJECT, NULL}, 702 {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_CONNECT_B3_REJECT, NULL},
703 {ST_NCCI_INCOMING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_RESP, NULL}, 703 {ST_NCCI_INCOMING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_RESP, NULL},
704 {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, 704 {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL},
705 {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, 705 {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL},
706 /* N-2 */ 706 /* N-2 */
707 {ST_NCCI_ALLOCATED, ST_NCCI_ACTIVE, EV_NCCI_CONNECT_B3_ACTIVE_IND, NULL}, 707 {ST_NCCI_ALLOCATED, ST_NCCI_ACTIVE, EV_NCCI_CONNECT_B3_ACTIVE_IND, NULL},
708 {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, 708 {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL},
709 {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, 709 {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL},
710 /* N-ACT */ 710 /* N-ACT */
711 {ST_NCCI_ACTIVE, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, NULL}, 711 {ST_NCCI_ACTIVE, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, NULL},
712 {ST_NCCI_ACTIVE, ST_NCCI_RESETING, EV_NCCI_RESET_B3_REQ, NULL}, 712 {ST_NCCI_ACTIVE, ST_NCCI_RESETING, EV_NCCI_RESET_B3_REQ, NULL},
713 {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, 713 {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL},
714 {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, 714 {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL},
715 /* N-3 */ 715 /* N-3 */
716 {ST_NCCI_RESETING, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, NULL}, 716 {ST_NCCI_RESETING, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, NULL},
717 {ST_NCCI_RESETING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, 717 {ST_NCCI_RESETING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL},
718 {ST_NCCI_RESETING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL}, 718 {ST_NCCI_RESETING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL},
719 /* N-4 */ 719 /* N-4 */
720 {ST_NCCI_DISCONNECTING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL}, 720 {ST_NCCI_DISCONNECTING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL},
721 {ST_NCCI_DISCONNECTING, ST_NCCI_PREVIOUS, EV_NCCI_DISCONNECT_B3_CONF_ERROR,NULL}, 721 {ST_NCCI_DISCONNECTING, ST_NCCI_PREVIOUS, EV_NCCI_DISCONNECT_B3_CONF_ERROR, NULL},
722 /* N-5 */ 722 /* N-5 */
723 {ST_NCCI_DISCONNECTED, ST_NCCI_NONE, EV_NCCI_DISCONNECT_B3_RESP, n0}, 723 {ST_NCCI_DISCONNECTED, ST_NCCI_NONE, EV_NCCI_DISCONNECT_B3_RESP, n0},
724 {}, 724 {},
725}; 725};
726 726
727static void ncci_change_state(capidrv_contr * card, capidrv_ncci * ncci, int event) 727static void ncci_change_state(capidrv_contr *card, capidrv_ncci *ncci, int event)
728{ 728{
729 struct nccistatechange *p = nccitable; 729 struct nccistatechange *p = nccitable;
730 while (p->event) { 730 while (p->event) {
731 if (ncci->state == p->actstate && p->event == event) { 731 if (ncci->state == p->actstate && p->event == event) {
732 if (debugmode) 732 if (debugmode)
733 printk(KERN_DEBUG "capidrv-%d: ncci_change_state:0x%x %d -> %d\n", 733 printk(KERN_DEBUG "capidrv-%d: ncci_change_state:0x%x %d -> %d\n",
734 card->contrnr, ncci->ncci, ncci->state, p->nextstate); 734 card->contrnr, ncci->ncci, ncci->state, p->nextstate);
735 if (p->nextstate == ST_NCCI_PREVIOUS) { 735 if (p->nextstate == ST_NCCI_PREVIOUS) {
736 ncci->state = ncci->oldstate; 736 ncci->state = ncci->oldstate;
737 ncci->oldstate = p->actstate; 737 ncci->oldstate = p->actstate;
@@ -751,7 +751,7 @@ static void ncci_change_state(capidrv_contr * card, capidrv_ncci * ncci, int eve
751 751
752/* ------------------------------------------------------------------- */ 752/* ------------------------------------------------------------------- */
753 753
754static inline int new_bchan(capidrv_contr * card) 754static inline int new_bchan(capidrv_contr *card)
755{ 755{
756 int i; 756 int i;
757 for (i = 0; i < card->nbchan; i++) { 757 for (i = 0; i < card->nbchan; i++) {
@@ -765,7 +765,7 @@ static inline int new_bchan(capidrv_contr * card)
765 765
766/* ------------------------------------------------------------------- */ 766/* ------------------------------------------------------------------- */
767 767
768static void handle_controller(_cmsg * cmsg) 768static void handle_controller(_cmsg *cmsg)
769{ 769{
770 capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); 770 capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f);
771 771
@@ -791,54 +791,54 @@ static void handle_controller(_cmsg * cmsg)
791 break; 791 break;
792 792
793 case CAPI_MANUFACTURER_IND: /* Controller */ 793 case CAPI_MANUFACTURER_IND: /* Controller */
794 if ( cmsg->ManuID == 0x214D5641 794 if (cmsg->ManuID == 0x214D5641
795 && cmsg->Class == 0 795 && cmsg->Class == 0
796 && cmsg->Function == 1) { 796 && cmsg->Function == 1) {
797 u8 *data = cmsg->ManuData+3; 797 u8 *data = cmsg->ManuData + 3;
798 u16 len = cmsg->ManuData[0]; 798 u16 len = cmsg->ManuData[0];
799 u16 layer; 799 u16 layer;
800 int direction; 800 int direction;
801 if (len == 255) { 801 if (len == 255) {
802 len = (cmsg->ManuData[1] | (cmsg->ManuData[2] << 8)); 802 len = (cmsg->ManuData[1] | (cmsg->ManuData[2] << 8));
803 data += 2; 803 data += 2;
804 } 804 }
805 len -= 2; 805 len -= 2;
806 layer = ((*(data-1)) << 8) | *(data-2); 806 layer = ((*(data - 1)) << 8) | *(data - 2);
807 if (layer & 0x300) 807 if (layer & 0x300)
808 direction = (layer & 0x200) ? 0 : 1; 808 direction = (layer & 0x200) ? 0 : 1;
809 else direction = (layer & 0x800) ? 0 : 1; 809 else direction = (layer & 0x800) ? 0 : 1;
810 if (layer & 0x0C00) { 810 if (layer & 0x0C00) {
811 if ((layer & 0xff) == 0x80) { 811 if ((layer & 0xff) == 0x80) {
812 handle_dtrace_data(card, direction, 1, data, len); 812 handle_dtrace_data(card, direction, 1, data, len);
813 break; 813 break;
814 } 814 }
815 } else if ((layer & 0xff) < 0x80) { 815 } else if ((layer & 0xff) < 0x80) {
816 handle_dtrace_data(card, direction, 0, data, len); 816 handle_dtrace_data(card, direction, 0, data, len);
817 break; 817 break;
818 } 818 }
819 printk(KERN_INFO "capidrv-%d: %s from controller 0x%x layer 0x%x, ignored\n", 819 printk(KERN_INFO "capidrv-%d: %s from controller 0x%x layer 0x%x, ignored\n",
820 card->contrnr, 820 card->contrnr,
821 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 821 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
822 cmsg->adr.adrController, layer); 822 cmsg->adr.adrController, layer);
823 break; 823 break;
824 } 824 }
825 goto ignored; 825 goto ignored;
826 case CAPI_MANUFACTURER_CONF: /* Controller */ 826 case CAPI_MANUFACTURER_CONF: /* Controller */
827 if (cmsg->ManuID == 0x214D5641) { 827 if (cmsg->ManuID == 0x214D5641) {
828 char *s = NULL; 828 char *s = NULL;
829 switch (cmsg->Class) { 829 switch (cmsg->Class) {
830 case 0: break; 830 case 0: break;
831 case 1: s = "unknown class"; break; 831 case 1: s = "unknown class"; break;
832 case 2: s = "unknown function"; break; 832 case 2: s = "unknown function"; break;
833 default: s = "unknown error"; break; 833 default: s = "unknown error"; break;
834 } 834 }
835 if (s) 835 if (s)
836 printk(KERN_INFO "capidrv-%d: %s from controller 0x%x function %d: %s\n", 836 printk(KERN_INFO "capidrv-%d: %s from controller 0x%x function %d: %s\n",
837 card->contrnr, 837 card->contrnr,
838 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 838 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
839 cmsg->adr.adrController, 839 cmsg->adr.adrController,
840 cmsg->Function, s); 840 cmsg->Function, s);
841 break; 841 break;
842 } 842 }
843 goto ignored; 843 goto ignored;
844 case CAPI_FACILITY_IND: /* Controller/plci/ncci */ 844 case CAPI_FACILITY_IND: /* Controller/plci/ncci */
@@ -858,14 +858,14 @@ static void handle_controller(_cmsg * cmsg)
858 } 858 }
859 return; 859 return;
860 860
861 ignored: 861ignored:
862 printk(KERN_INFO "capidrv-%d: %s from controller 0x%x ignored\n", 862 printk(KERN_INFO "capidrv-%d: %s from controller 0x%x ignored\n",
863 card->contrnr, 863 card->contrnr,
864 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 864 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
865 cmsg->adr.adrController); 865 cmsg->adr.adrController);
866} 866}
867 867
868static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) 868static void handle_incoming_call(capidrv_contr *card, _cmsg *cmsg)
869{ 869{
870 capidrv_plci *plcip; 870 capidrv_plci *plcip;
871 capidrv_bchan *bchan; 871 capidrv_bchan *bchan;
@@ -890,27 +890,27 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg)
890 cmd.arg = chan; 890 cmd.arg = chan;
891 memset(&cmd.parm.setup, 0, sizeof(cmd.parm.setup)); 891 memset(&cmd.parm.setup, 0, sizeof(cmd.parm.setup));
892 strncpy(cmd.parm.setup.phone, 892 strncpy(cmd.parm.setup.phone,
893 cmsg->CallingPartyNumber + 3, 893 cmsg->CallingPartyNumber + 3,
894 cmsg->CallingPartyNumber[0] - 2); 894 cmsg->CallingPartyNumber[0] - 2);
895 strncpy(cmd.parm.setup.eazmsn, 895 strncpy(cmd.parm.setup.eazmsn,
896 cmsg->CalledPartyNumber + 2, 896 cmsg->CalledPartyNumber + 2,
897 cmsg->CalledPartyNumber[0] - 1); 897 cmsg->CalledPartyNumber[0] - 1);
898 cmd.parm.setup.si1 = cip2si1(cmsg->CIPValue); 898 cmd.parm.setup.si1 = cip2si1(cmsg->CIPValue);
899 cmd.parm.setup.si2 = cip2si2(cmsg->CIPValue); 899 cmd.parm.setup.si2 = cip2si2(cmsg->CIPValue);
900 cmd.parm.setup.plan = cmsg->CallingPartyNumber[1]; 900 cmd.parm.setup.plan = cmsg->CallingPartyNumber[1];
901 cmd.parm.setup.screen = cmsg->CallingPartyNumber[2]; 901 cmd.parm.setup.screen = cmsg->CallingPartyNumber[2];
902 902
903 printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s\n", 903 printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s\n",
904 card->contrnr, 904 card->contrnr,
905 cmd.parm.setup.phone, 905 cmd.parm.setup.phone,
906 cmd.parm.setup.si1, 906 cmd.parm.setup.si1,
907 cmd.parm.setup.si2, 907 cmd.parm.setup.si2,
908 cmd.parm.setup.eazmsn); 908 cmd.parm.setup.eazmsn);
909 909
910 if (cmd.parm.setup.si1 == 1 && cmd.parm.setup.si2 != 0) { 910 if (cmd.parm.setup.si1 == 1 && cmd.parm.setup.si2 != 0) {
911 printk(KERN_INFO "capidrv-%d: patching si2=%d to 0 for VBOX\n", 911 printk(KERN_INFO "capidrv-%d: patching si2=%d to 0 for VBOX\n",
912 card->contrnr, 912 card->contrnr,
913 cmd.parm.setup.si2); 913 cmd.parm.setup.si2);
914 cmd.parm.setup.si2 = 0; 914 cmd.parm.setup.si2 = 0;
915 } 915 }
916 916
@@ -927,11 +927,11 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg)
927 plci_change_state(card, plcip, EV_PLCI_CONNECT_REJECT); 927 plci_change_state(card, plcip, EV_PLCI_CONNECT_REJECT);
928 send_message(card, cmsg); 928 send_message(card, cmsg);
929 printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s ignored\n", 929 printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s ignored\n",
930 card->contrnr, 930 card->contrnr,
931 cmd.parm.setup.phone, 931 cmd.parm.setup.phone,
932 cmd.parm.setup.si1, 932 cmd.parm.setup.si1,
933 cmd.parm.setup.si2, 933 cmd.parm.setup.si2,
934 cmd.parm.setup.eazmsn); 934 cmd.parm.setup.eazmsn);
935 break; 935 break;
936 case 1: 936 case 1:
937 /* At least one device matching this call (RING on ttyI) 937 /* At least one device matching this call (RING on ttyI)
@@ -945,11 +945,11 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg)
945 */ 945 */
946 if (plcip->state == ST_PLCI_INCOMING) { 946 if (plcip->state == ST_PLCI_INCOMING) {
947 printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s tty alerting\n", 947 printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s tty alerting\n",
948 card->contrnr, 948 card->contrnr,
949 cmd.parm.setup.phone, 949 cmd.parm.setup.phone,
950 cmd.parm.setup.si1, 950 cmd.parm.setup.si1,
951 cmd.parm.setup.si2, 951 cmd.parm.setup.si2,
952 cmd.parm.setup.eazmsn); 952 cmd.parm.setup.eazmsn);
953 capi_fill_ALERT_REQ(cmsg, 953 capi_fill_ALERT_REQ(cmsg,
954 global.ap.applid, 954 global.ap.applid,
955 card->msgid++, 955 card->msgid++,
@@ -958,16 +958,16 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg)
958 NULL,/* Keypadfacility */ 958 NULL,/* Keypadfacility */
959 NULL,/* Useruserdata */ 959 NULL,/* Useruserdata */
960 NULL /* Facilitydataarray */ 960 NULL /* Facilitydataarray */
961 ); 961 );
962 plcip->msgid = cmsg->Messagenumber; 962 plcip->msgid = cmsg->Messagenumber;
963 send_message(card, cmsg); 963 send_message(card, cmsg);
964 } else { 964 } else {
965 printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s on netdev\n", 965 printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s on netdev\n",
966 card->contrnr, 966 card->contrnr,
967 cmd.parm.setup.phone, 967 cmd.parm.setup.phone,
968 cmd.parm.setup.si1, 968 cmd.parm.setup.si1,
969 cmd.parm.setup.si2, 969 cmd.parm.setup.si2,
970 cmd.parm.setup.eazmsn); 970 cmd.parm.setup.eazmsn);
971 } 971 }
972 break; 972 break;
973 973
@@ -990,7 +990,7 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg)
990 return; 990 return;
991} 991}
992 992
993static void handle_plci(_cmsg * cmsg) 993static void handle_plci(_cmsg *cmsg)
994{ 994{
995 capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); 995 capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f);
996 capidrv_plci *plcip; 996 capidrv_plci *plcip;
@@ -1008,8 +1008,8 @@ static void handle_plci(_cmsg * cmsg)
1008 case CAPI_DISCONNECT_IND: /* plci */ 1008 case CAPI_DISCONNECT_IND: /* plci */
1009 if (cmsg->Reason) { 1009 if (cmsg->Reason) {
1010 printk(KERN_INFO "capidrv-%d: %s reason 0x%x (%s) for plci 0x%x\n", 1010 printk(KERN_INFO "capidrv-%d: %s reason 0x%x (%s) for plci 0x%x\n",
1011 card->contrnr, 1011 card->contrnr,
1012 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1012 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
1013 cmsg->Reason, capi_info2str(cmsg->Reason), cmsg->adr.adrPLCI); 1013 cmsg->Reason, capi_info2str(cmsg->Reason), cmsg->adr.adrPLCI);
1014 } 1014 }
1015 if (!(plcip = find_plci_by_plci(card, cmsg->adr.adrPLCI))) { 1015 if (!(plcip = find_plci_by_plci(card, cmsg->adr.adrPLCI))) {
@@ -1027,9 +1027,9 @@ static void handle_plci(_cmsg * cmsg)
1027 case CAPI_DISCONNECT_CONF: /* plci */ 1027 case CAPI_DISCONNECT_CONF: /* plci */
1028 if (cmsg->Info) { 1028 if (cmsg->Info) {
1029 printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n", 1029 printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n",
1030 card->contrnr, 1030 card->contrnr,
1031 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1031 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
1032 cmsg->Info, capi_info2str(cmsg->Info), 1032 cmsg->Info, capi_info2str(cmsg->Info),
1033 cmsg->adr.adrPLCI); 1033 cmsg->adr.adrPLCI);
1034 } 1034 }
1035 if (!(plcip = find_plci_by_plci(card, cmsg->adr.adrPLCI))) 1035 if (!(plcip = find_plci_by_plci(card, cmsg->adr.adrPLCI)))
@@ -1041,9 +1041,9 @@ static void handle_plci(_cmsg * cmsg)
1041 case CAPI_ALERT_CONF: /* plci */ 1041 case CAPI_ALERT_CONF: /* plci */
1042 if (cmsg->Info) { 1042 if (cmsg->Info) {
1043 printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n", 1043 printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n",
1044 card->contrnr, 1044 card->contrnr,
1045 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1045 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
1046 cmsg->Info, capi_info2str(cmsg->Info), 1046 cmsg->Info, capi_info2str(cmsg->Info),
1047 cmsg->adr.adrPLCI); 1047 cmsg->adr.adrPLCI);
1048 } 1048 }
1049 break; 1049 break;
@@ -1055,9 +1055,9 @@ static void handle_plci(_cmsg * cmsg)
1055 case CAPI_CONNECT_CONF: /* plci */ 1055 case CAPI_CONNECT_CONF: /* plci */
1056 if (cmsg->Info) { 1056 if (cmsg->Info) {
1057 printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n", 1057 printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for plci 0x%x\n",
1058 card->contrnr, 1058 card->contrnr,
1059 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1059 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
1060 cmsg->Info, capi_info2str(cmsg->Info), 1060 cmsg->Info, capi_info2str(cmsg->Info),
1061 cmsg->adr.adrPLCI); 1061 cmsg->adr.adrPLCI);
1062 } 1062 }
1063 if (!(plcip = find_plci_by_msgid(card, cmsg->Messagenumber))) 1063 if (!(plcip = find_plci_by_msgid(card, cmsg->Messagenumber)))
@@ -1096,7 +1096,7 @@ static void handle_plci(_cmsg * cmsg)
1096 card->msgid++, 1096 card->msgid++,
1097 plcip->plci, /* adr */ 1097 plcip->plci, /* adr */
1098 NULL /* NCPI */ 1098 NULL /* NCPI */
1099 ); 1099 );
1100 nccip->msgid = cmsg->Messagenumber; 1100 nccip->msgid = cmsg->Messagenumber;
1101 plci_change_state(card, plcip, 1101 plci_change_state(card, plcip,
1102 EV_PLCI_CONNECT_ACTIVE_IND); 1102 EV_PLCI_CONNECT_ACTIVE_IND);
@@ -1122,8 +1122,8 @@ static void handle_plci(_cmsg * cmsg)
1122 sprintf(cmd.parm.num, "%lu", 1122 sprintf(cmd.parm.num, "%lu",
1123 (unsigned long) 1123 (unsigned long)
1124 ((u32) cmsg->InfoElement[1] 1124 ((u32) cmsg->InfoElement[1]
1125 | ((u32) (cmsg->InfoElement[2]) << 8) 1125 | ((u32) (cmsg->InfoElement[2]) << 8)
1126 | ((u32) (cmsg->InfoElement[3]) << 16) 1126 | ((u32) (cmsg->InfoElement[3]) << 16)
1127 | ((u32) (cmsg->InfoElement[4]) << 24))); 1127 | ((u32) (cmsg->InfoElement[4]) << 24)));
1128 card->interface.statcallb(&cmd); 1128 card->interface.statcallb(&cmd);
1129 break; 1129 break;
@@ -1132,11 +1132,11 @@ static void handle_plci(_cmsg * cmsg)
1132 cdb = capi_cmsg2str(cmsg); 1132 cdb = capi_cmsg2str(cmsg);
1133 if (cdb) { 1133 if (cdb) {
1134 printk(KERN_WARNING "capidrv-%d: %s\n", 1134 printk(KERN_WARNING "capidrv-%d: %s\n",
1135 card->contrnr, cdb->buf); 1135 card->contrnr, cdb->buf);
1136 cdebbuf_free(cdb); 1136 cdebbuf_free(cdb);
1137 } else 1137 } else
1138 printk(KERN_WARNING "capidrv-%d: CAPI_INFO_IND InfoNumber %x not handled\n", 1138 printk(KERN_WARNING "capidrv-%d: CAPI_INFO_IND InfoNumber %x not handled\n",
1139 card->contrnr, cmsg->InfoNumber); 1139 card->contrnr, cmsg->InfoNumber);
1140 1140
1141 break; 1141 break;
1142 1142
@@ -1159,13 +1159,13 @@ static void handle_plci(_cmsg * cmsg)
1159 cmsg->adr.adrPLCI); 1159 cmsg->adr.adrPLCI);
1160 } 1160 }
1161 return; 1161 return;
1162 ignored: 1162ignored:
1163 printk(KERN_INFO "capidrv-%d: %s for plci 0x%x ignored\n", 1163 printk(KERN_INFO "capidrv-%d: %s for plci 0x%x ignored\n",
1164 card->contrnr, 1164 card->contrnr,
1165 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1165 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
1166 cmsg->adr.adrPLCI); 1166 cmsg->adr.adrPLCI);
1167 return; 1167 return;
1168 notfound: 1168notfound:
1169 printk(KERN_ERR "capidrv-%d: %s: plci 0x%x not found\n", 1169 printk(KERN_ERR "capidrv-%d: %s: plci 0x%x not found\n",
1170 card->contrnr, 1170 card->contrnr,
1171 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1171 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
@@ -1173,7 +1173,7 @@ static void handle_plci(_cmsg * cmsg)
1173 return; 1173 return;
1174} 1174}
1175 1175
1176static void handle_ncci(_cmsg * cmsg) 1176static void handle_ncci(_cmsg *cmsg)
1177{ 1177{
1178 capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); 1178 capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f);
1179 capidrv_plci *plcip; 1179 capidrv_plci *plcip;
@@ -1222,7 +1222,7 @@ static void handle_ncci(_cmsg * cmsg)
1222 nccip->ncci, /* adr */ 1222 nccip->ncci, /* adr */
1223 0, /* Reject */ 1223 0, /* Reject */
1224 NULL /* NCPI */ 1224 NULL /* NCPI */
1225 ); 1225 );
1226 ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_RESP); 1226 ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_RESP);
1227 send_message(card, cmsg); 1227 send_message(card, cmsg);
1228 break; 1228 break;
@@ -1230,8 +1230,8 @@ static void handle_ncci(_cmsg * cmsg)
1230 printk(KERN_ERR "capidrv-%d: no mem for ncci, sorry\n", card->contrnr); 1230 printk(KERN_ERR "capidrv-%d: no mem for ncci, sorry\n", card->contrnr);
1231 } else { 1231 } else {
1232 printk(KERN_ERR "capidrv-%d: %s: plci for ncci 0x%x not found\n", 1232 printk(KERN_ERR "capidrv-%d: %s: plci for ncci 0x%x not found\n",
1233 card->contrnr, 1233 card->contrnr,
1234 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1234 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
1235 cmsg->adr.adrNCCI); 1235 cmsg->adr.adrNCCI);
1236 } 1236 }
1237 capi_fill_CONNECT_B3_RESP(cmsg, 1237 capi_fill_CONNECT_B3_RESP(cmsg,
@@ -1240,7 +1240,7 @@ static void handle_ncci(_cmsg * cmsg)
1240 cmsg->adr.adrNCCI, 1240 cmsg->adr.adrNCCI,
1241 2, /* Reject */ 1241 2, /* Reject */
1242 NULL /* NCPI */ 1242 NULL /* NCPI */
1243 ); 1243 );
1244 send_message(card, cmsg); 1244 send_message(card, cmsg);
1245 break; 1245 break;
1246 1246
@@ -1254,9 +1254,9 @@ static void handle_ncci(_cmsg * cmsg)
1254 nccip->ncci = cmsg->adr.adrNCCI; 1254 nccip->ncci = cmsg->adr.adrNCCI;
1255 if (cmsg->Info) { 1255 if (cmsg->Info) {
1256 printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for ncci 0x%x\n", 1256 printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for ncci 0x%x\n",
1257 card->contrnr, 1257 card->contrnr,
1258 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1258 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
1259 cmsg->Info, capi_info2str(cmsg->Info), 1259 cmsg->Info, capi_info2str(cmsg->Info),
1260 cmsg->adr.adrNCCI); 1260 cmsg->adr.adrNCCI);
1261 } 1261 }
1262 1262
@@ -1278,7 +1278,7 @@ static void handle_ncci(_cmsg * cmsg)
1278 case CAPI_DATA_B3_CONF: /* ncci */ 1278 case CAPI_DATA_B3_CONF: /* ncci */
1279 if (cmsg->Info) { 1279 if (cmsg->Info) {
1280 printk(KERN_WARNING "CAPI_DATA_B3_CONF: Info %x - %s\n", 1280 printk(KERN_WARNING "CAPI_DATA_B3_CONF: Info %x - %s\n",
1281 cmsg->Info, capi_info2str(cmsg->Info)); 1281 cmsg->Info, capi_info2str(cmsg->Info));
1282 } 1282 }
1283 if (!(nccip = find_ncci(card, cmsg->adr.adrNCCI))) 1283 if (!(nccip = find_ncci(card, cmsg->adr.adrNCCI)))
1284 goto notfound; 1284 goto notfound;
@@ -1286,11 +1286,11 @@ static void handle_ncci(_cmsg * cmsg)
1286 len = capidrv_del_ack(nccip, cmsg->DataHandle); 1286 len = capidrv_del_ack(nccip, cmsg->DataHandle);
1287 if (len < 0) 1287 if (len < 0)
1288 break; 1288 break;
1289 cmd.command = ISDN_STAT_BSENT; 1289 cmd.command = ISDN_STAT_BSENT;
1290 cmd.driver = card->myid; 1290 cmd.driver = card->myid;
1291 cmd.arg = nccip->chan; 1291 cmd.arg = nccip->chan;
1292 cmd.parm.length = len; 1292 cmd.parm.length = len;
1293 card->interface.statcallb(&cmd); 1293 card->interface.statcallb(&cmd);
1294 break; 1294 break;
1295 1295
1296 case CAPI_DISCONNECT_B3_IND: /* ncci */ 1296 case CAPI_DISCONNECT_B3_IND: /* ncci */
@@ -1309,9 +1309,9 @@ static void handle_ncci(_cmsg * cmsg)
1309 goto notfound; 1309 goto notfound;
1310 if (cmsg->Info) { 1310 if (cmsg->Info) {
1311 printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for ncci 0x%x\n", 1311 printk(KERN_INFO "capidrv-%d: %s info 0x%x (%s) for ncci 0x%x\n",
1312 card->contrnr, 1312 card->contrnr,
1313 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1313 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
1314 cmsg->Info, capi_info2str(cmsg->Info), 1314 cmsg->Info, capi_info2str(cmsg->Info),
1315 cmsg->adr.adrNCCI); 1315 cmsg->adr.adrNCCI);
1316 ncci_change_state(card, nccip, EV_NCCI_DISCONNECT_B3_CONF_ERROR); 1316 ncci_change_state(card, nccip, EV_NCCI_DISCONNECT_B3_CONF_ERROR);
1317 } 1317 }
@@ -1340,13 +1340,13 @@ static void handle_ncci(_cmsg * cmsg)
1340 cmsg->adr.adrNCCI); 1340 cmsg->adr.adrNCCI);
1341 } 1341 }
1342 return; 1342 return;
1343 ignored: 1343ignored:
1344 printk(KERN_INFO "capidrv-%d: %s for ncci 0x%x ignored\n", 1344 printk(KERN_INFO "capidrv-%d: %s for ncci 0x%x ignored\n",
1345 card->contrnr, 1345 card->contrnr,
1346 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1346 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
1347 cmsg->adr.adrNCCI); 1347 cmsg->adr.adrNCCI);
1348 return; 1348 return;
1349 notfound: 1349notfound:
1350 printk(KERN_ERR "capidrv-%d: %s: ncci 0x%x not found\n", 1350 printk(KERN_ERR "capidrv-%d: %s: ncci 0x%x not found\n",
1351 card->contrnr, 1351 card->contrnr,
1352 capi_cmd2str(cmsg->Command, cmsg->Subcommand), 1352 capi_cmd2str(cmsg->Command, cmsg->Subcommand),
@@ -1354,7 +1354,7 @@ static void handle_ncci(_cmsg * cmsg)
1354} 1354}
1355 1355
1356 1356
1357static void handle_data(_cmsg * cmsg, struct sk_buff *skb) 1357static void handle_data(_cmsg *cmsg, struct sk_buff *skb)
1358{ 1358{
1359 capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); 1359 capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f);
1360 capidrv_ncci *nccip; 1360 capidrv_ncci *nccip;
@@ -1390,12 +1390,12 @@ static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
1390 1390
1391 if (cdb) { 1391 if (cdb) {
1392 printk(KERN_DEBUG "%s: applid=%d %s\n", __func__, 1392 printk(KERN_DEBUG "%s: applid=%d %s\n", __func__,
1393 ap->applid, cdb->buf); 1393 ap->applid, cdb->buf);
1394 cdebbuf_free(cdb); 1394 cdebbuf_free(cdb);
1395 } else 1395 } else
1396 printk(KERN_DEBUG "%s: applid=%d %s not traced\n", 1396 printk(KERN_DEBUG "%s: applid=%d %s not traced\n",
1397 __func__, ap->applid, 1397 __func__, ap->applid,
1398 capi_cmd2str(s_cmsg.Command, s_cmsg.Subcommand)); 1398 capi_cmd2str(s_cmsg.Command, s_cmsg.Subcommand));
1399 } 1399 }
1400 if (s_cmsg.Command == CAPI_DATA_B3 1400 if (s_cmsg.Command == CAPI_DATA_B3
1401 && s_cmsg.Subcommand == CAPI_IND) { 1401 && s_cmsg.Subcommand == CAPI_IND) {
@@ -1418,38 +1418,38 @@ static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
1418 1418
1419/* ------------------------------------------------------------------- */ 1419/* ------------------------------------------------------------------- */
1420 1420
1421#define PUTBYTE_TO_STATUS(card, byte) \ 1421#define PUTBYTE_TO_STATUS(card, byte) \
1422 do { \ 1422 do { \
1423 *(card)->q931_write++ = (byte); \ 1423 *(card)->q931_write++ = (byte); \
1424 if ((card)->q931_write > (card)->q931_end) \ 1424 if ((card)->q931_write > (card)->q931_end) \
1425 (card)->q931_write = (card)->q931_buf; \ 1425 (card)->q931_write = (card)->q931_buf; \
1426 } while (0) 1426 } while (0)
1427 1427
1428static void handle_dtrace_data(capidrv_contr *card, 1428static void handle_dtrace_data(capidrv_contr *card,
1429 int send, int level2, u8 *data, u16 len) 1429 int send, int level2, u8 *data, u16 len)
1430{ 1430{
1431 u8 *p, *end; 1431 u8 *p, *end;
1432 isdn_ctrl cmd; 1432 isdn_ctrl cmd;
1433 1433
1434 if (!len) { 1434 if (!len) {
1435 printk(KERN_DEBUG "capidrv-%d: avmb1_q931_data: len == %d\n", 1435 printk(KERN_DEBUG "capidrv-%d: avmb1_q931_data: len == %d\n",
1436 card->contrnr, len); 1436 card->contrnr, len);
1437 return; 1437 return;
1438 } 1438 }
1439 1439
1440 if (level2) { 1440 if (level2) {
1441 PUTBYTE_TO_STATUS(card, 'D'); 1441 PUTBYTE_TO_STATUS(card, 'D');
1442 PUTBYTE_TO_STATUS(card, '2'); 1442 PUTBYTE_TO_STATUS(card, '2');
1443 PUTBYTE_TO_STATUS(card, send ? '>' : '<'); 1443 PUTBYTE_TO_STATUS(card, send ? '>' : '<');
1444 PUTBYTE_TO_STATUS(card, ':'); 1444 PUTBYTE_TO_STATUS(card, ':');
1445 } else { 1445 } else {
1446 PUTBYTE_TO_STATUS(card, 'D'); 1446 PUTBYTE_TO_STATUS(card, 'D');
1447 PUTBYTE_TO_STATUS(card, '3'); 1447 PUTBYTE_TO_STATUS(card, '3');
1448 PUTBYTE_TO_STATUS(card, send ? '>' : '<'); 1448 PUTBYTE_TO_STATUS(card, send ? '>' : '<');
1449 PUTBYTE_TO_STATUS(card, ':'); 1449 PUTBYTE_TO_STATUS(card, ':');
1450 } 1450 }
1451 1451
1452 for (p = data, end = data+len; p < end; p++) { 1452 for (p = data, end = data + len; p < end; p++) {
1453 PUTBYTE_TO_STATUS(card, ' '); 1453 PUTBYTE_TO_STATUS(card, ' ');
1454 PUTBYTE_TO_STATUS(card, hex_asc_hi(*p)); 1454 PUTBYTE_TO_STATUS(card, hex_asc_hi(*p));
1455 PUTBYTE_TO_STATUS(card, hex_asc_lo(*p)); 1455 PUTBYTE_TO_STATUS(card, hex_asc_lo(*p));
@@ -1458,7 +1458,7 @@ static void handle_dtrace_data(capidrv_contr *card,
1458 1458
1459 cmd.command = ISDN_STAT_STAVAIL; 1459 cmd.command = ISDN_STAT_STAVAIL;
1460 cmd.driver = card->myid; 1460 cmd.driver = card->myid;
1461 cmd.arg = len*3+5; 1461 cmd.arg = len * 3 + 5;
1462 card->interface.statcallb(&cmd); 1462 card->interface.statcallb(&cmd);
1463} 1463}
1464 1464
@@ -1466,17 +1466,17 @@ static void handle_dtrace_data(capidrv_contr *card,
1466 1466
1467static _cmsg cmdcmsg; 1467static _cmsg cmdcmsg;
1468 1468
1469static int capidrv_ioctl(isdn_ctrl * c, capidrv_contr * card) 1469static int capidrv_ioctl(isdn_ctrl *c, capidrv_contr *card)
1470{ 1470{
1471 switch (c->arg) { 1471 switch (c->arg) {
1472 case 1: 1472 case 1:
1473 debugmode = (int)(*((unsigned int *)c->parm.num)); 1473 debugmode = (int)(*((unsigned int *)c->parm.num));
1474 printk(KERN_DEBUG "capidrv-%d: debugmode=%d\n", 1474 printk(KERN_DEBUG "capidrv-%d: debugmode=%d\n",
1475 card->contrnr, debugmode); 1475 card->contrnr, debugmode);
1476 return 0; 1476 return 0;
1477 default: 1477 default:
1478 printk(KERN_DEBUG "capidrv-%d: capidrv_ioctl(%ld) called ??\n", 1478 printk(KERN_DEBUG "capidrv-%d: capidrv_ioctl(%ld) called ??\n",
1479 card->contrnr, c->arg); 1479 card->contrnr, c->arg);
1480 return -EINVAL; 1480 return -EINVAL;
1481 } 1481 }
1482 return -EINVAL; 1482 return -EINVAL;
@@ -1487,9 +1487,9 @@ static int capidrv_ioctl(isdn_ctrl * c, capidrv_contr * card)
1487 */ 1487 */
1488 1488
1489struct internal_bchannelinfo { 1489struct internal_bchannelinfo {
1490 unsigned short channelalloc; 1490 unsigned short channelalloc;
1491 unsigned short operation; 1491 unsigned short operation;
1492 unsigned char cmask[31]; 1492 unsigned char cmask[31];
1493}; 1493};
1494 1494
1495static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) 1495static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep)
@@ -1540,10 +1540,10 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep)
1540 if (digit2 <= 0 || digit2 > 30) return -4; 1540 if (digit2 <= 0 || digit2 > 30) return -4;
1541 if (*s == 0 || *s == ',' || *s == ' ') { 1541 if (*s == 0 || *s == ',' || *s == ' ') {
1542 if (digit1 > digit2) 1542 if (digit1 > digit2)
1543 for (i = digit2; i <= digit1 ; i++) 1543 for (i = digit2; i <= digit1; i++)
1544 bmask |= (1 << i); 1544 bmask |= (1 << i);
1545 else 1545 else
1546 for (i = digit1; i <= digit2 ; i++) 1546 for (i = digit1; i <= digit2; i++)
1547 bmask |= (1 << i); 1547 bmask |= (1 << i);
1548 digit1 = digit2 = 0; 1548 digit1 = digit2 = 0;
1549 if (*s) s++; 1549 if (*s) s++;
@@ -1556,131 +1556,131 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep)
1556 return 0; 1556 return 0;
1557} 1557}
1558 1558
1559static int FVteln2capi20(char *teln, u8 AdditionalInfo[1+2+2+31]) 1559static int FVteln2capi20(char *teln, u8 AdditionalInfo[1 + 2 + 2 + 31])
1560{ 1560{
1561 unsigned long bmask; 1561 unsigned long bmask;
1562 int active; 1562 int active;
1563 int rc, i; 1563 int rc, i;
1564 1564
1565 rc = decodeFVteln(teln, &bmask, &active); 1565 rc = decodeFVteln(teln, &bmask, &active);
1566 if (rc) return rc; 1566 if (rc) return rc;
1567 /* Length */ 1567 /* Length */
1568 AdditionalInfo[0] = 2+2+31; 1568 AdditionalInfo[0] = 2 + 2 + 31;
1569 /* Channel: 3 => use channel allocation */ 1569 /* Channel: 3 => use channel allocation */
1570 AdditionalInfo[1] = 3; AdditionalInfo[2] = 0; 1570 AdditionalInfo[1] = 3; AdditionalInfo[2] = 0;
1571 /* Operation: 0 => DTE mode, 1 => DCE mode */ 1571 /* Operation: 0 => DTE mode, 1 => DCE mode */
1572 if (active) { 1572 if (active) {
1573 AdditionalInfo[3] = 0; AdditionalInfo[4] = 0; 1573 AdditionalInfo[3] = 0; AdditionalInfo[4] = 0;
1574 } else { 1574 } else {
1575 AdditionalInfo[3] = 1; AdditionalInfo[4] = 0; 1575 AdditionalInfo[3] = 1; AdditionalInfo[4] = 0;
1576 } 1576 }
1577 /* Channel mask array */ 1577 /* Channel mask array */
1578 AdditionalInfo[5] = 0; /* no D-Channel */ 1578 AdditionalInfo[5] = 0; /* no D-Channel */
1579 for (i=1; i <= 30; i++) 1579 for (i = 1; i <= 30; i++)
1580 AdditionalInfo[5+i] = (bmask & (1 << i)) ? 0xff : 0; 1580 AdditionalInfo[5 + i] = (bmask & (1 << i)) ? 0xff : 0;
1581 return 0; 1581 return 0;
1582} 1582}
1583 1583
1584static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) 1584static int capidrv_command(isdn_ctrl *c, capidrv_contr *card)
1585{ 1585{
1586 isdn_ctrl cmd; 1586 isdn_ctrl cmd;
1587 struct capidrv_bchan *bchan; 1587 struct capidrv_bchan *bchan;
1588 struct capidrv_plci *plcip; 1588 struct capidrv_plci *plcip;
1589 u8 AdditionalInfo[1+2+2+31]; 1589 u8 AdditionalInfo[1 + 2 + 2 + 31];
1590 int rc, isleasedline = 0; 1590 int rc, isleasedline = 0;
1591 1591
1592 if (c->command == ISDN_CMD_IOCTL) 1592 if (c->command == ISDN_CMD_IOCTL)
1593 return capidrv_ioctl(c, card); 1593 return capidrv_ioctl(c, card);
1594 1594
1595 switch (c->command) { 1595 switch (c->command) {
1596 case ISDN_CMD_DIAL:{ 1596 case ISDN_CMD_DIAL:{
1597 u8 calling[ISDN_MSNLEN + 3]; 1597 u8 calling[ISDN_MSNLEN + 3];
1598 u8 called[ISDN_MSNLEN + 2]; 1598 u8 called[ISDN_MSNLEN + 2];
1599 1599
1600 if (debugmode) 1600 if (debugmode)
1601 printk(KERN_DEBUG "capidrv-%d: ISDN_CMD_DIAL(ch=%ld,\"%s,%d,%d,%s\")\n", 1601 printk(KERN_DEBUG "capidrv-%d: ISDN_CMD_DIAL(ch=%ld,\"%s,%d,%d,%s\")\n",
1602 card->contrnr, 1602 card->contrnr,
1603 c->arg, 1603 c->arg,
1604 c->parm.setup.phone, 1604 c->parm.setup.phone,
1605 c->parm.setup.si1, 1605 c->parm.setup.si1,
1606 c->parm.setup.si2, 1606 c->parm.setup.si2,
1607 c->parm.setup.eazmsn); 1607 c->parm.setup.eazmsn);
1608
1609 bchan = &card->bchans[c->arg % card->nbchan];
1610
1611 if (bchan->plcip) {
1612 printk(KERN_ERR "capidrv-%d: dail ch=%ld,\"%s,%d,%d,%s\" in use (plci=0x%x)\n",
1613 card->contrnr,
1614 c->arg,
1615 c->parm.setup.phone,
1616 c->parm.setup.si1,
1617 c->parm.setup.si2,
1618 c->parm.setup.eazmsn,
1619 bchan->plcip->plci);
1620 return 0;
1621 }
1622 bchan->si1 = c->parm.setup.si1;
1623 bchan->si2 = c->parm.setup.si2;
1624
1625 strncpy(bchan->num, c->parm.setup.phone, sizeof(bchan->num));
1626 strncpy(bchan->mynum, c->parm.setup.eazmsn, sizeof(bchan->mynum));
1627 rc = FVteln2capi20(bchan->num, AdditionalInfo);
1628 isleasedline = (rc == 0);
1629 if (rc < 0)
1630 printk(KERN_ERR "capidrv-%d: WARNING: invalid leased linedefinition \"%s\"\n", card->contrnr, bchan->num);
1631
1632 if (isleasedline) {
1633 calling[0] = 0;
1634 called[0] = 0;
1635 if (debugmode)
1636 printk(KERN_DEBUG "capidrv-%d: connecting leased line\n", card->contrnr);
1637 } else {
1638 calling[0] = strlen(bchan->mynum) + 2;
1639 calling[1] = 0;
1640 calling[2] = 0x80;
1641 strncpy(calling + 3, bchan->mynum, ISDN_MSNLEN);
1642 called[0] = strlen(bchan->num) + 1;
1643 called[1] = 0x80;
1644 strncpy(called + 2, bchan->num, ISDN_MSNLEN);
1645 }
1646 1608
1647 capi_fill_CONNECT_REQ(&cmdcmsg, 1609 bchan = &card->bchans[c->arg % card->nbchan];
1648 global.ap.applid, 1610
1649 card->msgid++, 1611 if (bchan->plcip) {
1650 card->contrnr, /* adr */ 1612 printk(KERN_ERR "capidrv-%d: dail ch=%ld,\"%s,%d,%d,%s\" in use (plci=0x%x)\n",
1651 si2cip(bchan->si1, bchan->si2), /* cipvalue */ 1613 card->contrnr,
1652 called, /* CalledPartyNumber */ 1614 c->arg,
1653 calling, /* CallingPartyNumber */ 1615 c->parm.setup.phone,
1654 NULL, /* CalledPartySubaddress */ 1616 c->parm.setup.si1,
1655 NULL, /* CallingPartySubaddress */ 1617 c->parm.setup.si2,
1656 b1prot(bchan->l2, bchan->l3), /* B1protocol */ 1618 c->parm.setup.eazmsn,
1657 b2prot(bchan->l2, bchan->l3), /* B2protocol */ 1619 bchan->plcip->plci);
1658 b3prot(bchan->l2, bchan->l3), /* B3protocol */
1659 b1config(bchan->l2, bchan->l3), /* B1configuration */
1660 NULL, /* B2configuration */
1661 NULL, /* B3configuration */
1662 NULL, /* BC */
1663 NULL, /* LLC */
1664 NULL, /* HLC */
1665 /* BChannelinformation */
1666 isleasedline ? AdditionalInfo : NULL,
1667 NULL, /* Keypadfacility */
1668 NULL, /* Useruserdata */
1669 NULL /* Facilitydataarray */
1670 );
1671 if ((plcip = new_plci(card, (c->arg % card->nbchan))) == NULL) {
1672 cmd.command = ISDN_STAT_DHUP;
1673 cmd.driver = card->myid;
1674 cmd.arg = (c->arg % card->nbchan);
1675 card->interface.statcallb(&cmd);
1676 return -1;
1677 }
1678 plcip->msgid = cmdcmsg.Messagenumber;
1679 plcip->leasedline = isleasedline;
1680 plci_change_state(card, plcip, EV_PLCI_CONNECT_REQ);
1681 send_message(card, &cmdcmsg);
1682 return 0; 1620 return 0;
1683 } 1621 }
1622 bchan->si1 = c->parm.setup.si1;
1623 bchan->si2 = c->parm.setup.si2;
1624
1625 strncpy(bchan->num, c->parm.setup.phone, sizeof(bchan->num));
1626 strncpy(bchan->mynum, c->parm.setup.eazmsn, sizeof(bchan->mynum));
1627 rc = FVteln2capi20(bchan->num, AdditionalInfo);
1628 isleasedline = (rc == 0);
1629 if (rc < 0)
1630 printk(KERN_ERR "capidrv-%d: WARNING: invalid leased linedefinition \"%s\"\n", card->contrnr, bchan->num);
1631
1632 if (isleasedline) {
1633 calling[0] = 0;
1634 called[0] = 0;
1635 if (debugmode)
1636 printk(KERN_DEBUG "capidrv-%d: connecting leased line\n", card->contrnr);
1637 } else {
1638 calling[0] = strlen(bchan->mynum) + 2;
1639 calling[1] = 0;
1640 calling[2] = 0x80;
1641 strncpy(calling + 3, bchan->mynum, ISDN_MSNLEN);
1642 called[0] = strlen(bchan->num) + 1;
1643 called[1] = 0x80;
1644 strncpy(called + 2, bchan->num, ISDN_MSNLEN);
1645 }
1646
1647 capi_fill_CONNECT_REQ(&cmdcmsg,
1648 global.ap.applid,
1649 card->msgid++,
1650 card->contrnr, /* adr */
1651 si2cip(bchan->si1, bchan->si2), /* cipvalue */
1652 called, /* CalledPartyNumber */
1653 calling, /* CallingPartyNumber */
1654 NULL, /* CalledPartySubaddress */
1655 NULL, /* CallingPartySubaddress */
1656 b1prot(bchan->l2, bchan->l3), /* B1protocol */
1657 b2prot(bchan->l2, bchan->l3), /* B2protocol */
1658 b3prot(bchan->l2, bchan->l3), /* B3protocol */
1659 b1config(bchan->l2, bchan->l3), /* B1configuration */
1660 NULL, /* B2configuration */
1661 NULL, /* B3configuration */
1662 NULL, /* BC */
1663 NULL, /* LLC */
1664 NULL, /* HLC */
1665 /* BChannelinformation */
1666 isleasedline ? AdditionalInfo : NULL,
1667 NULL, /* Keypadfacility */
1668 NULL, /* Useruserdata */
1669 NULL /* Facilitydataarray */
1670 );
1671 if ((plcip = new_plci(card, (c->arg % card->nbchan))) == NULL) {
1672 cmd.command = ISDN_STAT_DHUP;
1673 cmd.driver = card->myid;
1674 cmd.arg = (c->arg % card->nbchan);
1675 card->interface.statcallb(&cmd);
1676 return -1;
1677 }
1678 plcip->msgid = cmdcmsg.Messagenumber;
1679 plcip->leasedline = isleasedline;
1680 plci_change_state(card, plcip, EV_PLCI_CONNECT_REQ);
1681 send_message(card, &cmdcmsg);
1682 return 0;
1683 }
1684 1684
1685 case ISDN_CMD_ACCEPTD: 1685 case ISDN_CMD_ACCEPTD:
1686 1686
@@ -1708,7 +1708,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
1708 NULL, /* Keypadfacility */ 1708 NULL, /* Keypadfacility */
1709 NULL, /* Useruserdata */ 1709 NULL, /* Useruserdata */
1710 NULL /* Facilitydataarray */ 1710 NULL /* Facilitydataarray */
1711 ); 1711 );
1712 capi_cmsg2message(&cmdcmsg, cmdcmsg.buf); 1712 capi_cmsg2message(&cmdcmsg, cmdcmsg.buf);
1713 plci_change_state(card, bchan->plcip, EV_PLCI_CONNECT_RESP); 1713 plci_change_state(card, bchan->plcip, EV_PLCI_CONNECT_RESP);
1714 send_message(card, &cmdcmsg); 1714 send_message(card, &cmdcmsg);
@@ -1742,7 +1742,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
1742 card->msgid++, 1742 card->msgid++,
1743 bchan->nccip->ncci, 1743 bchan->nccip->ncci,
1744 NULL /* NCPI */ 1744 NULL /* NCPI */
1745 ); 1745 );
1746 ncci_change_state(card, bchan->nccip, EV_NCCI_DISCONNECT_B3_REQ); 1746 ncci_change_state(card, bchan->nccip, EV_NCCI_DISCONNECT_B3_REQ);
1747 send_message(card, &cmdcmsg); 1747 send_message(card, &cmdcmsg);
1748 return 0; 1748 return 0;
@@ -1761,12 +1761,12 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
1761 capi_fill_DISCONNECT_REQ(&cmdcmsg, 1761 capi_fill_DISCONNECT_REQ(&cmdcmsg,
1762 global.ap.applid, 1762 global.ap.applid,
1763 card->msgid++, 1763 card->msgid++,
1764 bchan->plcip->plci, 1764 bchan->plcip->plci,
1765 NULL, /* BChannelinformation */ 1765 NULL, /* BChannelinformation */
1766 NULL, /* Keypadfacility */ 1766 NULL, /* Keypadfacility */
1767 NULL, /* Useruserdata */ 1767 NULL, /* Useruserdata */
1768 NULL /* Facilitydataarray */ 1768 NULL /* Facilitydataarray */
1769 ); 1769 );
1770 plci_change_state(card, bchan->plcip, EV_PLCI_DISCONNECT_REQ); 1770 plci_change_state(card, bchan->plcip, EV_PLCI_DISCONNECT_REQ);
1771 send_message(card, &cmdcmsg); 1771 send_message(card, &cmdcmsg);
1772 return 0; 1772 return 0;
@@ -1778,8 +1778,8 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
1778 } 1778 }
1779 } 1779 }
1780 printk(KERN_ERR "capidrv-%d: chan %ld disconnect request on free channel\n", 1780 printk(KERN_ERR "capidrv-%d: chan %ld disconnect request on free channel\n",
1781 card->contrnr, 1781 card->contrnr,
1782 c->arg); 1782 c->arg);
1783 return -EINVAL; 1783 return -EINVAL;
1784/* ready */ 1784/* ready */
1785 1785
@@ -1813,20 +1813,20 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
1813 case ISDN_CMD_CLREAZ: 1813 case ISDN_CMD_CLREAZ:
1814 if (debugmode) 1814 if (debugmode)
1815 printk(KERN_DEBUG "capidrv-%d: clearing EAZ on chan %ld\n", 1815 printk(KERN_DEBUG "capidrv-%d: clearing EAZ on chan %ld\n",
1816 card->contrnr, c->arg); 1816 card->contrnr, c->arg);
1817 bchan = &card->bchans[c->arg % card->nbchan]; 1817 bchan = &card->bchans[c->arg % card->nbchan];
1818 bchan->msn[0] = 0; 1818 bchan->msn[0] = 0;
1819 return 0; 1819 return 0;
1820 1820
1821 default: 1821 default:
1822 printk(KERN_ERR "capidrv-%d: ISDN_CMD_%d, Huh?\n", 1822 printk(KERN_ERR "capidrv-%d: ISDN_CMD_%d, Huh?\n",
1823 card->contrnr, c->command); 1823 card->contrnr, c->command);
1824 return -EINVAL; 1824 return -EINVAL;
1825 } 1825 }
1826 return 0; 1826 return 0;
1827} 1827}
1828 1828
1829static int if_command(isdn_ctrl * c) 1829static int if_command(isdn_ctrl *c)
1830{ 1830{
1831 capidrv_contr *card = findcontrbydriverid(c->driver); 1831 capidrv_contr *card = findcontrbydriverid(c->driver);
1832 1832
@@ -1834,8 +1834,8 @@ static int if_command(isdn_ctrl * c)
1834 return capidrv_command(c, card); 1834 return capidrv_command(c, card);
1835 1835
1836 printk(KERN_ERR 1836 printk(KERN_ERR
1837 "capidrv: if_command %d called with invalid driverId %d!\n", 1837 "capidrv: if_command %d called with invalid driverId %d!\n",
1838 c->command, c->driver); 1838 c->command, c->driver);
1839 return -ENODEV; 1839 return -ENODEV;
1840} 1840}
1841 1841
@@ -1859,7 +1859,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
1859 } 1859 }
1860 if (debugmode > 4) 1860 if (debugmode > 4)
1861 printk(KERN_DEBUG "capidrv-%d: sendbuf len=%d skb=%p doack=%d\n", 1861 printk(KERN_DEBUG "capidrv-%d: sendbuf len=%d skb=%p doack=%d\n",
1862 card->contrnr, len, skb, doack); 1862 card->contrnr, len, skb, doack);
1863 bchan = &card->bchans[channel % card->nbchan]; 1863 bchan = &card->bchans[channel % card->nbchan];
1864 nccip = bchan->nccip; 1864 nccip = bchan->nccip;
1865 if (!nccip || nccip->state != ST_NCCI_ACTIVE) { 1865 if (!nccip || nccip->state != ST_NCCI_ACTIVE) {
@@ -1891,10 +1891,10 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
1891 skb->len, /* DataLength */ 1891 skb->len, /* DataLength */
1892 datahandle, /* DataHandle */ 1892 datahandle, /* DataHandle */
1893 0 /* Flags */ 1893 0 /* Flags */
1894 ); 1894 );
1895 1895
1896 if (capidrv_add_ack(nccip, datahandle, doack ? (int)skb->len : -1) < 0) 1896 if (capidrv_add_ack(nccip, datahandle, doack ? (int)skb->len : -1) < 0)
1897 return 0; 1897 return 0;
1898 1898
1899 capi_cmsg2message(&sendcmsg, sendcmsg.buf); 1899 capi_cmsg2message(&sendcmsg, sendcmsg.buf);
1900 msglen = CAPIMSG_LEN(sendcmsg.buf); 1900 msglen = CAPIMSG_LEN(sendcmsg.buf);
@@ -1902,8 +1902,8 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
1902 struct sk_buff *nskb = skb_realloc_headroom(skb, msglen); 1902 struct sk_buff *nskb = skb_realloc_headroom(skb, msglen);
1903 if (!nskb) { 1903 if (!nskb) {
1904 printk(KERN_ERR "capidrv-%d: if_sendbuf: no memory\n", 1904 printk(KERN_ERR "capidrv-%d: if_sendbuf: no memory\n",
1905 card->contrnr); 1905 card->contrnr);
1906 (void)capidrv_del_ack(nccip, datahandle); 1906 (void)capidrv_del_ack(nccip, datahandle);
1907 return 0; 1907 return 0;
1908 } 1908 }
1909 printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n", 1909 printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n",
@@ -1917,9 +1917,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
1917 } 1917 }
1918 if (debugmode > 3) 1918 if (debugmode > 3)
1919 printk(KERN_DEBUG "capidrv-%d: sendbuf putmsg ret(%x) - %s\n", 1919 printk(KERN_DEBUG "capidrv-%d: sendbuf putmsg ret(%x) - %s\n",
1920 card->contrnr, errcode, capi_info2str(errcode)); 1920 card->contrnr, errcode, capi_info2str(errcode));
1921 (void)capidrv_del_ack(nccip, datahandle); 1921 (void)capidrv_del_ack(nccip, datahandle);
1922 dev_kfree_skb(nskb); 1922 dev_kfree_skb(nskb);
1923 return errcode == CAPI_SENDQUEUEFULL ? 0 : -1; 1923 return errcode == CAPI_SENDQUEUEFULL ? 0 : -1;
1924 } else { 1924 } else {
1925 memcpy(skb_push(skb, msglen), sendcmsg.buf, msglen); 1925 memcpy(skb_push(skb, msglen), sendcmsg.buf, msglen);
@@ -1930,9 +1930,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
1930 } 1930 }
1931 if (debugmode > 3) 1931 if (debugmode > 3)
1932 printk(KERN_DEBUG "capidrv-%d: sendbuf putmsg ret(%x) - %s\n", 1932 printk(KERN_DEBUG "capidrv-%d: sendbuf putmsg ret(%x) - %s\n",
1933 card->contrnr, errcode, capi_info2str(errcode)); 1933 card->contrnr, errcode, capi_info2str(errcode));
1934 skb_pull(skb, msglen); 1934 skb_pull(skb, msglen);
1935 (void)capidrv_del_ack(nccip, datahandle); 1935 (void)capidrv_del_ack(nccip, datahandle);
1936 return errcode == CAPI_SENDQUEUEFULL ? 0 : -1; 1936 return errcode == CAPI_SENDQUEUEFULL ? 0 : -1;
1937 } 1937 }
1938} 1938}
@@ -1949,11 +1949,11 @@ static int if_readstat(u8 __user *buf, int len, int id, int channel)
1949 return -ENODEV; 1949 return -ENODEV;
1950 } 1950 }
1951 1951
1952 for (p=buf, count=0; count < len; p++, count++) { 1952 for (p = buf, count = 0; count < len; p++, count++) {
1953 if (put_user(*card->q931_read++, p)) 1953 if (put_user(*card->q931_read++, p))
1954 return -EFAULT; 1954 return -EFAULT;
1955 if (card->q931_read > card->q931_end) 1955 if (card->q931_read > card->q931_end)
1956 card->q931_read = card->q931_buf; 1956 card->q931_read = card->q931_buf;
1957 } 1957 }
1958 return count; 1958 return count;
1959 1959
@@ -1961,35 +1961,35 @@ static int if_readstat(u8 __user *buf, int len, int id, int channel)
1961 1961
1962static void enable_dchannel_trace(capidrv_contr *card) 1962static void enable_dchannel_trace(capidrv_contr *card)
1963{ 1963{
1964 u8 manufacturer[CAPI_MANUFACTURER_LEN]; 1964 u8 manufacturer[CAPI_MANUFACTURER_LEN];
1965 capi_version version; 1965 capi_version version;
1966 u16 contr = card->contrnr; 1966 u16 contr = card->contrnr;
1967 u16 errcode; 1967 u16 errcode;
1968 u16 avmversion[3]; 1968 u16 avmversion[3];
1969 1969
1970 errcode = capi20_get_manufacturer(contr, manufacturer); 1970 errcode = capi20_get_manufacturer(contr, manufacturer);
1971 if (errcode != CAPI_NOERROR) { 1971 if (errcode != CAPI_NOERROR) {
1972 printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n", 1972 printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n",
1973 card->name, errcode); 1973 card->name, errcode);
1974 return; 1974 return;
1975 } 1975 }
1976 if (strstr(manufacturer, "AVM") == NULL) { 1976 if (strstr(manufacturer, "AVM") == NULL) {
1977 printk(KERN_ERR "%s: not from AVM, no d-channel trace possible (%s)\n", 1977 printk(KERN_ERR "%s: not from AVM, no d-channel trace possible (%s)\n",
1978 card->name, manufacturer); 1978 card->name, manufacturer);
1979 return; 1979 return;
1980 } 1980 }
1981 errcode = capi20_get_version(contr, &version); 1981 errcode = capi20_get_version(contr, &version);
1982 if (errcode != CAPI_NOERROR) { 1982 if (errcode != CAPI_NOERROR) {
1983 printk(KERN_ERR "%s: can't get version (0x%x)\n", 1983 printk(KERN_ERR "%s: can't get version (0x%x)\n",
1984 card->name, errcode); 1984 card->name, errcode);
1985 return; 1985 return;
1986 } 1986 }
1987 avmversion[0] = (version.majormanuversion >> 4) & 0x0f; 1987 avmversion[0] = (version.majormanuversion >> 4) & 0x0f;
1988 avmversion[1] = (version.majormanuversion << 4) & 0xf0; 1988 avmversion[1] = (version.majormanuversion << 4) & 0xf0;
1989 avmversion[1] |= (version.minormanuversion >> 4) & 0x0f; 1989 avmversion[1] |= (version.minormanuversion >> 4) & 0x0f;
1990 avmversion[2] |= version.minormanuversion & 0x0f; 1990 avmversion[2] |= version.minormanuversion & 0x0f;
1991 1991
1992 if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) { 1992 if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) {
1993 printk(KERN_INFO "%s: D2 trace enabled\n", card->name); 1993 printk(KERN_INFO "%s: D2 trace enabled\n", card->name);
1994 capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.ap.applid, 1994 capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.ap.applid,
1995 card->msgid++, 1995 card->msgid++,
@@ -2030,8 +2030,8 @@ static void listentimerfunc(unsigned long x)
2030 capidrv_contr *card = (capidrv_contr *)x; 2030 capidrv_contr *card = (capidrv_contr *)x;
2031 if (card->state != ST_LISTEN_NONE && card->state != ST_LISTEN_ACTIVE) 2031 if (card->state != ST_LISTEN_NONE && card->state != ST_LISTEN_ACTIVE)
2032 printk(KERN_ERR "%s: controller dead ??\n", card->name); 2032 printk(KERN_ERR "%s: controller dead ??\n", card->name);
2033 send_listen(card); 2033 send_listen(card);
2034 mod_timer(&card->listentimer, jiffies + 60*HZ); 2034 mod_timer(&card->listentimer, jiffies + 60 * HZ);
2035} 2035}
2036 2036
2037 2037
@@ -2050,7 +2050,7 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp)
2050 } 2050 }
2051 if (!(card = kzalloc(sizeof(capidrv_contr), GFP_ATOMIC))) { 2051 if (!(card = kzalloc(sizeof(capidrv_contr), GFP_ATOMIC))) {
2052 printk(KERN_WARNING 2052 printk(KERN_WARNING
2053 "capidrv: (%s) Could not allocate contr-struct.\n", id); 2053 "capidrv: (%s) Could not allocate contr-struct.\n", id);
2054 return -1; 2054 return -1;
2055 } 2055 }
2056 card->owner = THIS_MODULE; 2056 card->owner = THIS_MODULE;
@@ -2061,7 +2061,7 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp)
2061 card->bchans = kmalloc(sizeof(capidrv_bchan) * card->nbchan, GFP_ATOMIC); 2061 card->bchans = kmalloc(sizeof(capidrv_bchan) * card->nbchan, GFP_ATOMIC);
2062 if (!card->bchans) { 2062 if (!card->bchans) {
2063 printk(KERN_WARNING 2063 printk(KERN_WARNING
2064 "capidrv: (%s) Could not allocate bchan-structs.\n", id); 2064 "capidrv: (%s) Could not allocate bchan-structs.\n", id);
2065 module_put(card->owner); 2065 module_put(card->owner);
2066 kfree(card); 2066 kfree(card);
2067 return -1; 2067 return -1;
@@ -2073,17 +2073,17 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp)
2073 card->interface.writecmd = NULL; 2073 card->interface.writecmd = NULL;
2074 card->interface.readstat = if_readstat; 2074 card->interface.readstat = if_readstat;
2075 card->interface.features = ISDN_FEATURE_L2_HDLC | 2075 card->interface.features = ISDN_FEATURE_L2_HDLC |
2076 ISDN_FEATURE_L2_TRANS | 2076 ISDN_FEATURE_L2_TRANS |
2077 ISDN_FEATURE_L3_TRANS | 2077 ISDN_FEATURE_L3_TRANS |
2078 ISDN_FEATURE_P_UNKNOWN | 2078 ISDN_FEATURE_P_UNKNOWN |
2079 ISDN_FEATURE_L2_X75I | 2079 ISDN_FEATURE_L2_X75I |
2080 ISDN_FEATURE_L2_X75UI | 2080 ISDN_FEATURE_L2_X75UI |
2081 ISDN_FEATURE_L2_X75BUI; 2081 ISDN_FEATURE_L2_X75BUI;
2082 if (profp->support1 & (1<<2)) 2082 if (profp->support1 & (1 << 2))
2083 card->interface.features |= ISDN_FEATURE_L2_V11096 | 2083 card->interface.features |= ISDN_FEATURE_L2_V11096 |
2084 ISDN_FEATURE_L2_V11019 | 2084 ISDN_FEATURE_L2_V11019 |
2085 ISDN_FEATURE_L2_V11038; 2085 ISDN_FEATURE_L2_V11038;
2086 if (profp->support1 & (1<<8)) 2086 if (profp->support1 & (1 << 8))
2087 card->interface.features |= ISDN_FEATURE_L2_MODEM; 2087 card->interface.features |= ISDN_FEATURE_L2_MODEM;
2088 card->interface.hl_hdrlen = 22; /* len of DATA_B3_REQ */ 2088 card->interface.hl_hdrlen = 22; /* len of DATA_B3_REQ */
2089 strncpy(card->interface.id, id, sizeof(card->interface.id) - 1); 2089 strncpy(card->interface.id, id, sizeof(card->interface.id) - 1);
@@ -2122,10 +2122,10 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp)
2122 card->listentimer.data = (unsigned long)card; 2122 card->listentimer.data = (unsigned long)card;
2123 card->listentimer.function = listentimerfunc; 2123 card->listentimer.function = listentimerfunc;
2124 send_listen(card); 2124 send_listen(card);
2125 mod_timer(&card->listentimer, jiffies + 60*HZ); 2125 mod_timer(&card->listentimer, jiffies + 60 * HZ);
2126 2126
2127 printk(KERN_INFO "%s: now up (%d B channels)\n", 2127 printk(KERN_INFO "%s: now up (%d B channels)\n",
2128 card->name, card->nbchan); 2128 card->name, card->nbchan);
2129 2129
2130 enable_dchannel_trace(card); 2130 enable_dchannel_trace(card);
2131 2131
@@ -2158,7 +2158,7 @@ static int capidrv_delcontr(u16 contr)
2158 2158
2159 if (debugmode) 2159 if (debugmode)
2160 printk(KERN_DEBUG "capidrv-%d: id=%d unloading\n", 2160 printk(KERN_DEBUG "capidrv-%d: id=%d unloading\n",
2161 card->contrnr, card->myid); 2161 card->contrnr, card->myid);
2162 2162
2163 cmd.command = ISDN_STAT_STOP; 2163 cmd.command = ISDN_STAT_STOP;
2164 cmd.driver = card->myid; 2164 cmd.driver = card->myid;
@@ -2168,17 +2168,17 @@ static int capidrv_delcontr(u16 contr)
2168 2168
2169 cmd.command = ISDN_STAT_DISCH; 2169 cmd.command = ISDN_STAT_DISCH;
2170 cmd.driver = card->myid; 2170 cmd.driver = card->myid;
2171 cmd.arg = card->nbchan-1; 2171 cmd.arg = card->nbchan - 1;
2172 cmd.parm.num[0] = 0; 2172 cmd.parm.num[0] = 0;
2173 if (debugmode) 2173 if (debugmode)
2174 printk(KERN_DEBUG "capidrv-%d: id=%d disable chan=%ld\n", 2174 printk(KERN_DEBUG "capidrv-%d: id=%d disable chan=%ld\n",
2175 card->contrnr, card->myid, cmd.arg); 2175 card->contrnr, card->myid, cmd.arg);
2176 card->interface.statcallb(&cmd); 2176 card->interface.statcallb(&cmd);
2177 2177
2178 if (card->bchans[card->nbchan-1].nccip) 2178 if (card->bchans[card->nbchan - 1].nccip)
2179 free_ncci(card, card->bchans[card->nbchan-1].nccip); 2179 free_ncci(card, card->bchans[card->nbchan - 1].nccip);
2180 if (card->bchans[card->nbchan-1].plcip) 2180 if (card->bchans[card->nbchan - 1].plcip)
2181 free_plci(card, card->bchans[card->nbchan-1].plcip); 2181 free_plci(card, card->bchans[card->nbchan - 1].plcip);
2182 if (card->plci_list) 2182 if (card->plci_list)
2183 printk(KERN_ERR "capidrv: bug in free_plci()\n"); 2183 printk(KERN_ERR "capidrv: bug in free_plci()\n");
2184 card->nbchan--; 2184 card->nbchan--;
@@ -2188,7 +2188,7 @@ static int capidrv_delcontr(u16 contr)
2188 2188
2189 if (debugmode) 2189 if (debugmode)
2190 printk(KERN_DEBUG "capidrv-%d: id=%d isdn unload\n", 2190 printk(KERN_DEBUG "capidrv-%d: id=%d isdn unload\n",
2191 card->contrnr, card->myid); 2191 card->contrnr, card->myid);
2192 2192
2193 cmd.command = ISDN_STAT_UNLOAD; 2193 cmd.command = ISDN_STAT_UNLOAD;
2194 cmd.driver = card->myid; 2194 cmd.driver = card->myid;
@@ -2196,7 +2196,7 @@ static int capidrv_delcontr(u16 contr)
2196 2196
2197 if (debugmode) 2197 if (debugmode)
2198 printk(KERN_DEBUG "capidrv-%d: id=%d remove contr from list\n", 2198 printk(KERN_DEBUG "capidrv-%d: id=%d remove contr from list\n",
2199 card->contrnr, card->myid); 2199 card->contrnr, card->myid);
2200 2200
2201 spin_lock_irqsave(&global_lock, flags); 2201 spin_lock_irqsave(&global_lock, flags);
2202 for (pp = &global.contr_list; *pp; pp = &(*pp)->next) { 2202 for (pp = &global.contr_list; *pp; pp = &(*pp)->next) {
@@ -2243,10 +2243,10 @@ lower_callback(struct notifier_block *nb, unsigned long val, void *v)
2243static int capidrv_proc_show(struct seq_file *m, void *v) 2243static int capidrv_proc_show(struct seq_file *m, void *v)
2244{ 2244{
2245 seq_printf(m, "%lu %lu %lu %lu\n", 2245 seq_printf(m, "%lu %lu %lu %lu\n",
2246 global.ap.nrecvctlpkt, 2246 global.ap.nrecvctlpkt,
2247 global.ap.nrecvdatapkt, 2247 global.ap.nrecvdatapkt,
2248 global.ap.nsentctlpkt, 2248 global.ap.nsentctlpkt,
2249 global.ap.nsentdatapkt); 2249 global.ap.nsentdatapkt);
2250 return 0; 2250 return 0;
2251} 2251}
2252 2252
diff --git a/drivers/isdn/capi/capidrv.h b/drivers/isdn/capi/capidrv.h
index 1e698e1e269f..4466b2e0176d 100644
--- a/drivers/isdn/capi/capidrv.h
+++ b/drivers/isdn/capi/capidrv.h
@@ -34,7 +34,7 @@
34 * per plci state machine 34 * per plci state machine
35 */ 35 */
36#define ST_PLCI_NONE 0 /* P-0 */ 36#define ST_PLCI_NONE 0 /* P-0 */
37#define ST_PLCI_OUTGOING 1 /* P-0.1 */ 37#define ST_PLCI_OUTGOING 1 /* P-0.1 */
38#define ST_PLCI_ALLOCATED 2 /* P-1 */ 38#define ST_PLCI_ALLOCATED 2 /* P-1 */
39#define ST_PLCI_ACTIVE 3 /* P-ACT */ 39#define ST_PLCI_ACTIVE 3 /* P-ACT */
40#define ST_PLCI_INCOMING 4 /* P-2 */ 40#define ST_PLCI_INCOMING 4 /* P-2 */
@@ -47,20 +47,20 @@
47#define ST_PLCI_HELD 11 /* P-HELD */ 47#define ST_PLCI_HELD 11 /* P-HELD */
48 48
49#define EV_PLCI_CONNECT_REQ 1 /* P-0 -> P-0.1 49#define EV_PLCI_CONNECT_REQ 1 /* P-0 -> P-0.1
50 */ 50 */
51#define EV_PLCI_CONNECT_CONF_ERROR 2 /* P-0.1 -> P-0 51#define EV_PLCI_CONNECT_CONF_ERROR 2 /* P-0.1 -> P-0
52 */ 52 */
53#define EV_PLCI_CONNECT_CONF_OK 3 /* P-0.1 -> P-1 53#define EV_PLCI_CONNECT_CONF_OK 3 /* P-0.1 -> P-1
54 */ 54 */
55#define EV_PLCI_FACILITY_IND_UP 4 /* P-0 -> P-1 55#define EV_PLCI_FACILITY_IND_UP 4 /* P-0 -> P-1
56 */ 56 */
57#define EV_PLCI_CONNECT_IND 5 /* P-0 -> P-2 57#define EV_PLCI_CONNECT_IND 5 /* P-0 -> P-2
58 */ 58 */
59#define EV_PLCI_CONNECT_ACTIVE_IND 6 /* P-1 -> P-ACT 59#define EV_PLCI_CONNECT_ACTIVE_IND 6 /* P-1 -> P-ACT
60 */ 60 */
61#define EV_PLCI_CONNECT_REJECT 7 /* P-2 -> P-5 61#define EV_PLCI_CONNECT_REJECT 7 /* P-2 -> P-5
62 P-3 -> P-5 62 P-3 -> P-5
63 */ 63 */
64#define EV_PLCI_DISCONNECT_REQ 8 /* P-1 -> P-5 64#define EV_PLCI_DISCONNECT_REQ 8 /* P-1 -> P-5
65 P-2 -> P-5 65 P-2 -> P-5
66 P-3 -> P-5 66 P-3 -> P-5
@@ -68,7 +68,7 @@
68 P-ACT -> P-5 68 P-ACT -> P-5
69 P-Res -> P-5 (*) 69 P-Res -> P-5 (*)
70 P-HELD -> P-5 (*) 70 P-HELD -> P-5 (*)
71 */ 71 */
72#define EV_PLCI_DISCONNECT_IND 9 /* P-1 -> P-6 72#define EV_PLCI_DISCONNECT_IND 9 /* P-1 -> P-6
73 P-2 -> P-6 73 P-2 -> P-6
74 P-3 -> P-6 74 P-3 -> P-6
@@ -77,35 +77,35 @@
77 P-ACT -> P-6 77 P-ACT -> P-6
78 P-Res -> P-6 (*) 78 P-Res -> P-6 (*)
79 P-HELD -> P-6 (*) 79 P-HELD -> P-6 (*)
80 */ 80 */
81#define EV_PLCI_FACILITY_IND_DOWN 10 /* P-0.1 -> P-5 81#define EV_PLCI_FACILITY_IND_DOWN 10 /* P-0.1 -> P-5
82 P-1 -> P-5 82 P-1 -> P-5
83 P-ACT -> P-5 83 P-ACT -> P-5
84 P-2 -> P-5 84 P-2 -> P-5
85 P-3 -> P-5 85 P-3 -> P-5
86 P-4 -> P-5 86 P-4 -> P-5
87 */ 87 */
88#define EV_PLCI_DISCONNECT_RESP 11 /* P-6 -> P-0 88#define EV_PLCI_DISCONNECT_RESP 11 /* P-6 -> P-0
89 */ 89 */
90#define EV_PLCI_CONNECT_RESP 12 /* P-6 -> P-0 90#define EV_PLCI_CONNECT_RESP 12 /* P-6 -> P-0
91 */ 91 */
92 92
93#define EV_PLCI_RESUME_REQ 13 /* P-0 -> P-0.Res 93#define EV_PLCI_RESUME_REQ 13 /* P-0 -> P-0.Res
94 */ 94 */
95#define EV_PLCI_RESUME_CONF_OK 14 /* P-0.Res -> P-Res 95#define EV_PLCI_RESUME_CONF_OK 14 /* P-0.Res -> P-Res
96 */ 96 */
97#define EV_PLCI_RESUME_CONF_ERROR 15 /* P-0.Res -> P-0 97#define EV_PLCI_RESUME_CONF_ERROR 15 /* P-0.Res -> P-0
98 */ 98 */
99#define EV_PLCI_RESUME_IND 16 /* P-Res -> P-ACT 99#define EV_PLCI_RESUME_IND 16 /* P-Res -> P-ACT
100 */ 100 */
101#define EV_PLCI_HOLD_IND 17 /* P-ACT -> P-HELD 101#define EV_PLCI_HOLD_IND 17 /* P-ACT -> P-HELD
102 */ 102 */
103#define EV_PLCI_RETRIEVE_IND 18 /* P-HELD -> P-ACT 103#define EV_PLCI_RETRIEVE_IND 18 /* P-HELD -> P-ACT
104 */ 104 */
105#define EV_PLCI_SUSPEND_IND 19 /* P-ACT -> P-5 105#define EV_PLCI_SUSPEND_IND 19 /* P-ACT -> P-5
106 */ 106 */
107#define EV_PLCI_CD_IND 20 /* P-2 -> P-5 107#define EV_PLCI_CD_IND 20 /* P-2 -> P-5
108 */ 108 */
109 109
110/* 110/*
111 * per ncci state machine 111 * per ncci state machine
diff --git a/drivers/isdn/capi/capilib.c b/drivers/isdn/capi/capilib.c
index 0b041df2108c..33361f833c01 100644
--- a/drivers/isdn/capi/capilib.c
+++ b/drivers/isdn/capi/capilib.c
@@ -4,9 +4,9 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/isdn/capilli.h> 5#include <linux/isdn/capilli.h>
6 6
7#define DBG(format, arg...) do { \ 7#define DBG(format, arg...) do { \
8printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \ 8 printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \
9} while (0) 9 } while (0)
10 10
11struct capilib_msgidqueue { 11struct capilib_msgidqueue {
12 struct capilib_msgidqueue *next; 12 struct capilib_msgidqueue *next;
@@ -28,7 +28,7 @@ struct capilib_ncci {
28// --------------------------------------------------------------------------- 28// ---------------------------------------------------------------------------
29// NCCI Handling 29// NCCI Handling
30 30
31static inline void mq_init(struct capilib_ncci * np) 31static inline void mq_init(struct capilib_ncci *np)
32{ 32{
33 u_int i; 33 u_int i;
34 np->msgidqueue = NULL; 34 np->msgidqueue = NULL;
@@ -42,7 +42,7 @@ static inline void mq_init(struct capilib_ncci * np)
42 } 42 }
43} 43}
44 44
45static inline int mq_enqueue(struct capilib_ncci * np, u16 msgid) 45static inline int mq_enqueue(struct capilib_ncci *np, u16 msgid)
46{ 46{
47 struct capilib_msgidqueue *mq; 47 struct capilib_msgidqueue *mq;
48 if ((mq = np->msgidfree) == NULL) 48 if ((mq = np->msgidfree) == NULL)
@@ -59,7 +59,7 @@ static inline int mq_enqueue(struct capilib_ncci * np, u16 msgid)
59 return 1; 59 return 1;
60} 60}
61 61
62static inline int mq_dequeue(struct capilib_ncci * np, u16 msgid) 62static inline int mq_dequeue(struct capilib_ncci *np, u16 msgid)
63{ 63{
64 struct capilib_msgidqueue **pp; 64 struct capilib_msgidqueue **pp;
65 for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) { 65 for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) {
@@ -165,7 +165,7 @@ u16 capilib_data_b3_req(struct list_head *head, u16 applid, u32 ncci, u16 msgid)
165 continue; 165 continue;
166 if (np->ncci != ncci) 166 if (np->ncci != ncci)
167 continue; 167 continue;
168 168
169 if (mq_enqueue(np, msgid) == 0) 169 if (mq_enqueue(np, msgid) == 0)
170 return CAPI_SENDQUEUEFULL; 170 return CAPI_SENDQUEUEFULL;
171 171
@@ -188,7 +188,7 @@ void capilib_data_b3_conf(struct list_head *head, u16 applid, u32 ncci, u16 msgi
188 continue; 188 continue;
189 if (np->ncci != ncci) 189 if (np->ncci != ncci)
190 continue; 190 continue;
191 191
192 if (mq_dequeue(np, msgid) == 0) { 192 if (mq_dequeue(np, msgid) == 0) {
193 printk(KERN_ERR "kcapi: msgid %hu ncci 0x%x not on queue\n", 193 printk(KERN_ERR "kcapi: msgid %hu ncci 0x%x not on queue\n",
194 msgid, ncci); 194 msgid, ncci);
diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c
index 03c469e4451f..d26f17033b68 100644
--- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -25,149 +25,149 @@
25#ifndef CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON 25#ifndef CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON
26char *capi_info2str(u16 reason) 26char *capi_info2str(u16 reason)
27{ 27{
28 return ".."; 28 return "..";
29} 29}
30#else 30#else
31char *capi_info2str(u16 reason) 31char *capi_info2str(u16 reason)
32{ 32{
33 switch (reason) { 33 switch (reason) {
34 34
35/*-- informative values (corresponding message was processed) -----*/ 35/*-- informative values (corresponding message was processed) -----*/
36 case 0x0001: 36 case 0x0001:
37 return "NCPI not supported by current protocol, NCPI ignored"; 37 return "NCPI not supported by current protocol, NCPI ignored";
38 case 0x0002: 38 case 0x0002:
39 return "Flags not supported by current protocol, flags ignored"; 39 return "Flags not supported by current protocol, flags ignored";
40 case 0x0003: 40 case 0x0003:
41 return "Alert already sent by another application"; 41 return "Alert already sent by another application";
42 42
43/*-- error information concerning CAPI_REGISTER -----*/ 43/*-- error information concerning CAPI_REGISTER -----*/
44 case 0x1001: 44 case 0x1001:
45 return "Too many applications"; 45 return "Too many applications";
46 case 0x1002: 46 case 0x1002:
47 return "Logical block size too small, must be at least 128 Bytes"; 47 return "Logical block size too small, must be at least 128 Bytes";
48 case 0x1003: 48 case 0x1003:
49 return "Buffer exceeds 64 kByte"; 49 return "Buffer exceeds 64 kByte";
50 case 0x1004: 50 case 0x1004:
51 return "Message buffer size too small, must be at least 1024 Bytes"; 51 return "Message buffer size too small, must be at least 1024 Bytes";
52 case 0x1005: 52 case 0x1005:
53 return "Max. number of logical connections not supported"; 53 return "Max. number of logical connections not supported";
54 case 0x1006: 54 case 0x1006:
55 return "Reserved"; 55 return "Reserved";
56 case 0x1007: 56 case 0x1007:
57 return "The message could not be accepted because of an internal busy condition"; 57 return "The message could not be accepted because of an internal busy condition";
58 case 0x1008: 58 case 0x1008:
59 return "OS resource error (no memory ?)"; 59 return "OS resource error (no memory ?)";
60 case 0x1009: 60 case 0x1009:
61 return "CAPI not installed"; 61 return "CAPI not installed";
62 case 0x100A: 62 case 0x100A:
63 return "Controller does not support external equipment"; 63 return "Controller does not support external equipment";
64 case 0x100B: 64 case 0x100B:
65 return "Controller does only support external equipment"; 65 return "Controller does only support external equipment";
66 66
67/*-- error information concerning message exchange functions -----*/ 67/*-- error information concerning message exchange functions -----*/
68 case 0x1101: 68 case 0x1101:
69 return "Illegal application number"; 69 return "Illegal application number";
70 case 0x1102: 70 case 0x1102:
71 return "Illegal command or subcommand or message length less than 12 bytes"; 71 return "Illegal command or subcommand or message length less than 12 bytes";
72 case 0x1103: 72 case 0x1103:
73 return "The message could not be accepted because of a queue full condition !! The error code does not imply that CAPI cannot receive messages directed to another controller, PLCI or NCCI"; 73 return "The message could not be accepted because of a queue full condition !! The error code does not imply that CAPI cannot receive messages directed to another controller, PLCI or NCCI";
74 case 0x1104: 74 case 0x1104:
75 return "Queue is empty"; 75 return "Queue is empty";
76 case 0x1105: 76 case 0x1105:
77 return "Queue overflow, a message was lost !! This indicates a configuration error. The only recovery from this error is to perform a CAPI_RELEASE"; 77 return "Queue overflow, a message was lost !! This indicates a configuration error. The only recovery from this error is to perform a CAPI_RELEASE";
78 case 0x1106: 78 case 0x1106:
79 return "Unknown notification parameter"; 79 return "Unknown notification parameter";
80 case 0x1107: 80 case 0x1107:
81 return "The Message could not be accepted because of an internal busy condition"; 81 return "The Message could not be accepted because of an internal busy condition";
82 case 0x1108: 82 case 0x1108:
83 return "OS Resource error (no memory ?)"; 83 return "OS Resource error (no memory ?)";
84 case 0x1109: 84 case 0x1109:
85 return "CAPI not installed"; 85 return "CAPI not installed";
86 case 0x110A: 86 case 0x110A:
87 return "Controller does not support external equipment"; 87 return "Controller does not support external equipment";
88 case 0x110B: 88 case 0x110B:
89 return "Controller does only support external equipment"; 89 return "Controller does only support external equipment";
90 90
91/*-- error information concerning resource / coding problems -----*/ 91/*-- error information concerning resource / coding problems -----*/
92 case 0x2001: 92 case 0x2001:
93 return "Message not supported in current state"; 93 return "Message not supported in current state";
94 case 0x2002: 94 case 0x2002:
95 return "Illegal Controller / PLCI / NCCI"; 95 return "Illegal Controller / PLCI / NCCI";
96 case 0x2003: 96 case 0x2003:
97 return "Out of PLCI"; 97 return "Out of PLCI";
98 case 0x2004: 98 case 0x2004:
99 return "Out of NCCI"; 99 return "Out of NCCI";
100 case 0x2005: 100 case 0x2005:
101 return "Out of LISTEN"; 101 return "Out of LISTEN";
102 case 0x2006: 102 case 0x2006:
103 return "Out of FAX resources (protocol T.30)"; 103 return "Out of FAX resources (protocol T.30)";
104 case 0x2007: 104 case 0x2007:
105 return "Illegal message parameter coding"; 105 return "Illegal message parameter coding";
106 106
107/*-- error information concerning requested services -----*/ 107/*-- error information concerning requested services -----*/
108 case 0x3001: 108 case 0x3001:
109 return "B1 protocol not supported"; 109 return "B1 protocol not supported";
110 case 0x3002: 110 case 0x3002:
111 return "B2 protocol not supported"; 111 return "B2 protocol not supported";
112 case 0x3003: 112 case 0x3003:
113 return "B3 protocol not supported"; 113 return "B3 protocol not supported";
114 case 0x3004: 114 case 0x3004:
115 return "B1 protocol parameter not supported"; 115 return "B1 protocol parameter not supported";
116 case 0x3005: 116 case 0x3005:
117 return "B2 protocol parameter not supported"; 117 return "B2 protocol parameter not supported";
118 case 0x3006: 118 case 0x3006:
119 return "B3 protocol parameter not supported"; 119 return "B3 protocol parameter not supported";
120 case 0x3007: 120 case 0x3007:
121 return "B protocol combination not supported"; 121 return "B protocol combination not supported";
122 case 0x3008: 122 case 0x3008:
123 return "NCPI not supported"; 123 return "NCPI not supported";
124 case 0x3009: 124 case 0x3009:
125 return "CIP Value unknown"; 125 return "CIP Value unknown";
126 case 0x300A: 126 case 0x300A:
127 return "Flags not supported (reserved bits)"; 127 return "Flags not supported (reserved bits)";
128 case 0x300B: 128 case 0x300B:
129 return "Facility not supported"; 129 return "Facility not supported";
130 case 0x300C: 130 case 0x300C:
131 return "Data length not supported by current protocol"; 131 return "Data length not supported by current protocol";
132 case 0x300D: 132 case 0x300D:
133 return "Reset procedure not supported by current protocol"; 133 return "Reset procedure not supported by current protocol";
134 134
135/*-- informations about the clearing of a physical connection -----*/ 135/*-- informations about the clearing of a physical connection -----*/
136 case 0x3301: 136 case 0x3301:
137 return "Protocol error layer 1 (broken line or B-channel removed by signalling protocol)"; 137 return "Protocol error layer 1 (broken line or B-channel removed by signalling protocol)";
138 case 0x3302: 138 case 0x3302:
139 return "Protocol error layer 2"; 139 return "Protocol error layer 2";
140 case 0x3303: 140 case 0x3303:
141 return "Protocol error layer 3"; 141 return "Protocol error layer 3";
142 case 0x3304: 142 case 0x3304:
143 return "Another application got that call"; 143 return "Another application got that call";
144/*-- T.30 specific reasons -----*/ 144/*-- T.30 specific reasons -----*/
145 case 0x3311: 145 case 0x3311:
146 return "Connecting not successful (remote station is no FAX G3 machine)"; 146 return "Connecting not successful (remote station is no FAX G3 machine)";
147 case 0x3312: 147 case 0x3312:
148 return "Connecting not successful (training error)"; 148 return "Connecting not successful (training error)";
149 case 0x3313: 149 case 0x3313:
150 return "Disconnected before transfer (remote station does not support transfer mode, e.g. resolution)"; 150 return "Disconnected before transfer (remote station does not support transfer mode, e.g. resolution)";
151 case 0x3314: 151 case 0x3314:
152 return "Disconnected during transfer (remote abort)"; 152 return "Disconnected during transfer (remote abort)";
153 case 0x3315: 153 case 0x3315:
154 return "Disconnected during transfer (remote procedure error, e.g. unsuccessful repetition of T.30 commands)"; 154 return "Disconnected during transfer (remote procedure error, e.g. unsuccessful repetition of T.30 commands)";
155 case 0x3316: 155 case 0x3316:
156 return "Disconnected during transfer (local tx data underrun)"; 156 return "Disconnected during transfer (local tx data underrun)";
157 case 0x3317: 157 case 0x3317:
158 return "Disconnected during transfer (local rx data overflow)"; 158 return "Disconnected during transfer (local rx data overflow)";
159 case 0x3318: 159 case 0x3318:
160 return "Disconnected during transfer (local abort)"; 160 return "Disconnected during transfer (local abort)";
161 case 0x3319: 161 case 0x3319:
162 return "Illegal parameter coding (e.g. SFF coding error)"; 162 return "Illegal parameter coding (e.g. SFF coding error)";
163 163
164/*-- disconnect causes from the network according to ETS 300 102-1/Q.931 -----*/ 164/*-- disconnect causes from the network according to ETS 300 102-1/Q.931 -----*/
165 case 0x3481: return "Unallocated (unassigned) number"; 165 case 0x3481: return "Unallocated (unassigned) number";
166 case 0x3482: return "No route to specified transit network"; 166 case 0x3482: return "No route to specified transit network";
167 case 0x3483: return "No route to destination"; 167 case 0x3483: return "No route to destination";
168 case 0x3486: return "Channel unacceptable"; 168 case 0x3486: return "Channel unacceptable";
169 case 0x3487: 169 case 0x3487:
170 return "Call awarded and being delivered in an established channel"; 170 return "Call awarded and being delivered in an established channel";
171 case 0x3490: return "Normal call clearing"; 171 case 0x3490: return "Normal call clearing";
172 case 0x3491: return "User busy"; 172 case 0x3491: return "User busy";
173 case 0x3492: return "No user responding"; 173 case 0x3492: return "No user responding";
@@ -217,7 +217,7 @@ char *capi_info2str(u16 reason)
217 case 0x34FF: return "Interworking, unspecified"; 217 case 0x34FF: return "Interworking, unspecified";
218 218
219 default: return "No additional information"; 219 default: return "No additional information";
220 } 220 }
221} 221}
222#endif 222#endif
223 223
@@ -235,169 +235,169 @@ typedef struct {
235 235
236static _cdef cdef[] = 236static _cdef cdef[] =
237{ 237{
238 /*00 */ 238 /*00 */
239 {_CEND}, 239 {_CEND},
240 /*01 */ 240 /*01 */
241 {_CEND}, 241 {_CEND},
242 /*02 */ 242 /*02 */
243 {_CEND}, 243 {_CEND},
244 /*03 */ 244 /*03 */
245 {_CDWORD, offsetof(_cmsg, adr.adrController)}, 245 {_CDWORD, offsetof(_cmsg, adr.adrController)},
246 /*04 */ 246 /*04 */
247 {_CMSTRUCT, offsetof(_cmsg, AdditionalInfo)}, 247 {_CMSTRUCT, offsetof(_cmsg, AdditionalInfo)},
248 /*05 */ 248 /*05 */
249 {_CSTRUCT, offsetof(_cmsg, B1configuration)}, 249 {_CSTRUCT, offsetof(_cmsg, B1configuration)},
250 /*06 */ 250 /*06 */
251 {_CWORD, offsetof(_cmsg, B1protocol)}, 251 {_CWORD, offsetof(_cmsg, B1protocol)},
252 /*07 */ 252 /*07 */
253 {_CSTRUCT, offsetof(_cmsg, B2configuration)}, 253 {_CSTRUCT, offsetof(_cmsg, B2configuration)},
254 /*08 */ 254 /*08 */
255 {_CWORD, offsetof(_cmsg, B2protocol)}, 255 {_CWORD, offsetof(_cmsg, B2protocol)},
256 /*09 */ 256 /*09 */
257 {_CSTRUCT, offsetof(_cmsg, B3configuration)}, 257 {_CSTRUCT, offsetof(_cmsg, B3configuration)},
258 /*0a */ 258 /*0a */
259 {_CWORD, offsetof(_cmsg, B3protocol)}, 259 {_CWORD, offsetof(_cmsg, B3protocol)},
260 /*0b */ 260 /*0b */
261 {_CSTRUCT, offsetof(_cmsg, BC)}, 261 {_CSTRUCT, offsetof(_cmsg, BC)},
262 /*0c */ 262 /*0c */
263 {_CSTRUCT, offsetof(_cmsg, BChannelinformation)}, 263 {_CSTRUCT, offsetof(_cmsg, BChannelinformation)},
264 /*0d */ 264 /*0d */
265 {_CMSTRUCT, offsetof(_cmsg, BProtocol)}, 265 {_CMSTRUCT, offsetof(_cmsg, BProtocol)},
266 /*0e */ 266 /*0e */
267 {_CSTRUCT, offsetof(_cmsg, CalledPartyNumber)}, 267 {_CSTRUCT, offsetof(_cmsg, CalledPartyNumber)},
268 /*0f */ 268 /*0f */
269 {_CSTRUCT, offsetof(_cmsg, CalledPartySubaddress)}, 269 {_CSTRUCT, offsetof(_cmsg, CalledPartySubaddress)},
270 /*10 */ 270 /*10 */
271 {_CSTRUCT, offsetof(_cmsg, CallingPartyNumber)}, 271 {_CSTRUCT, offsetof(_cmsg, CallingPartyNumber)},
272 /*11 */ 272 /*11 */
273 {_CSTRUCT, offsetof(_cmsg, CallingPartySubaddress)}, 273 {_CSTRUCT, offsetof(_cmsg, CallingPartySubaddress)},
274 /*12 */ 274 /*12 */
275 {_CDWORD, offsetof(_cmsg, CIPmask)}, 275 {_CDWORD, offsetof(_cmsg, CIPmask)},
276 /*13 */ 276 /*13 */
277 {_CDWORD, offsetof(_cmsg, CIPmask2)}, 277 {_CDWORD, offsetof(_cmsg, CIPmask2)},
278 /*14 */ 278 /*14 */
279 {_CWORD, offsetof(_cmsg, CIPValue)}, 279 {_CWORD, offsetof(_cmsg, CIPValue)},
280 /*15 */ 280 /*15 */
281 {_CDWORD, offsetof(_cmsg, Class)}, 281 {_CDWORD, offsetof(_cmsg, Class)},
282 /*16 */ 282 /*16 */
283 {_CSTRUCT, offsetof(_cmsg, ConnectedNumber)}, 283 {_CSTRUCT, offsetof(_cmsg, ConnectedNumber)},
284 /*17 */ 284 /*17 */
285 {_CSTRUCT, offsetof(_cmsg, ConnectedSubaddress)}, 285 {_CSTRUCT, offsetof(_cmsg, ConnectedSubaddress)},
286 /*18 */ 286 /*18 */
287 {_CDWORD, offsetof(_cmsg, Data)}, 287 {_CDWORD, offsetof(_cmsg, Data)},
288 /*19 */ 288 /*19 */
289 {_CWORD, offsetof(_cmsg, DataHandle)}, 289 {_CWORD, offsetof(_cmsg, DataHandle)},
290 /*1a */ 290 /*1a */
291 {_CWORD, offsetof(_cmsg, DataLength)}, 291 {_CWORD, offsetof(_cmsg, DataLength)},
292 /*1b */ 292 /*1b */
293 {_CSTRUCT, offsetof(_cmsg, FacilityConfirmationParameter)}, 293 {_CSTRUCT, offsetof(_cmsg, FacilityConfirmationParameter)},
294 /*1c */ 294 /*1c */
295 {_CSTRUCT, offsetof(_cmsg, Facilitydataarray)}, 295 {_CSTRUCT, offsetof(_cmsg, Facilitydataarray)},
296 /*1d */ 296 /*1d */
297 {_CSTRUCT, offsetof(_cmsg, FacilityIndicationParameter)}, 297 {_CSTRUCT, offsetof(_cmsg, FacilityIndicationParameter)},
298 /*1e */ 298 /*1e */
299 {_CSTRUCT, offsetof(_cmsg, FacilityRequestParameter)}, 299 {_CSTRUCT, offsetof(_cmsg, FacilityRequestParameter)},
300 /*1f */ 300 /*1f */
301 {_CWORD, offsetof(_cmsg, FacilitySelector)}, 301 {_CWORD, offsetof(_cmsg, FacilitySelector)},
302 /*20 */ 302 /*20 */
303 {_CWORD, offsetof(_cmsg, Flags)}, 303 {_CWORD, offsetof(_cmsg, Flags)},
304 /*21 */ 304 /*21 */
305 {_CDWORD, offsetof(_cmsg, Function)}, 305 {_CDWORD, offsetof(_cmsg, Function)},
306 /*22 */ 306 /*22 */
307 {_CSTRUCT, offsetof(_cmsg, HLC)}, 307 {_CSTRUCT, offsetof(_cmsg, HLC)},
308 /*23 */ 308 /*23 */
309 {_CWORD, offsetof(_cmsg, Info)}, 309 {_CWORD, offsetof(_cmsg, Info)},
310 /*24 */ 310 /*24 */
311 {_CSTRUCT, offsetof(_cmsg, InfoElement)}, 311 {_CSTRUCT, offsetof(_cmsg, InfoElement)},
312 /*25 */ 312 /*25 */
313 {_CDWORD, offsetof(_cmsg, InfoMask)}, 313 {_CDWORD, offsetof(_cmsg, InfoMask)},
314 /*26 */ 314 /*26 */
315 {_CWORD, offsetof(_cmsg, InfoNumber)}, 315 {_CWORD, offsetof(_cmsg, InfoNumber)},
316 /*27 */ 316 /*27 */
317 {_CSTRUCT, offsetof(_cmsg, Keypadfacility)}, 317 {_CSTRUCT, offsetof(_cmsg, Keypadfacility)},
318 /*28 */ 318 /*28 */
319 {_CSTRUCT, offsetof(_cmsg, LLC)}, 319 {_CSTRUCT, offsetof(_cmsg, LLC)},
320 /*29 */ 320 /*29 */
321 {_CSTRUCT, offsetof(_cmsg, ManuData)}, 321 {_CSTRUCT, offsetof(_cmsg, ManuData)},
322 /*2a */ 322 /*2a */
323 {_CDWORD, offsetof(_cmsg, ManuID)}, 323 {_CDWORD, offsetof(_cmsg, ManuID)},
324 /*2b */ 324 /*2b */
325 {_CSTRUCT, offsetof(_cmsg, NCPI)}, 325 {_CSTRUCT, offsetof(_cmsg, NCPI)},
326 /*2c */ 326 /*2c */
327 {_CWORD, offsetof(_cmsg, Reason)}, 327 {_CWORD, offsetof(_cmsg, Reason)},
328 /*2d */ 328 /*2d */
329 {_CWORD, offsetof(_cmsg, Reason_B3)}, 329 {_CWORD, offsetof(_cmsg, Reason_B3)},
330 /*2e */ 330 /*2e */
331 {_CWORD, offsetof(_cmsg, Reject)}, 331 {_CWORD, offsetof(_cmsg, Reject)},
332 /*2f */ 332 /*2f */
333 {_CSTRUCT, offsetof(_cmsg, Useruserdata)} 333 {_CSTRUCT, offsetof(_cmsg, Useruserdata)}
334}; 334};
335 335
336static unsigned char *cpars[] = 336static unsigned char *cpars[] =
337{ 337{
338 /* ALERT_REQ */ [0x01] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01", 338 /* ALERT_REQ */ [0x01] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01",
339 /* CONNECT_REQ */ [0x02] = "\x03\x14\x0e\x10\x0f\x11\x0d\x06\x08\x0a\x05\x07\x09\x01\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01", 339 /* CONNECT_REQ */ [0x02] = "\x03\x14\x0e\x10\x0f\x11\x0d\x06\x08\x0a\x05\x07\x09\x01\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01",
340 /* DISCONNECT_REQ */ [0x04] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01", 340 /* DISCONNECT_REQ */ [0x04] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01",
341 /* LISTEN_REQ */ [0x05] = "\x03\x25\x12\x13\x10\x11\x01", 341 /* LISTEN_REQ */ [0x05] = "\x03\x25\x12\x13\x10\x11\x01",
342 /* INFO_REQ */ [0x08] = "\x03\x0e\x04\x0c\x27\x2f\x1c\x01\x01", 342 /* INFO_REQ */ [0x08] = "\x03\x0e\x04\x0c\x27\x2f\x1c\x01\x01",
343 /* FACILITY_REQ */ [0x09] = "\x03\x1f\x1e\x01", 343 /* FACILITY_REQ */ [0x09] = "\x03\x1f\x1e\x01",
344 /* SELECT_B_PROTOCOL_REQ */ [0x0a] = "\x03\x0d\x06\x08\x0a\x05\x07\x09\x01\x01", 344 /* SELECT_B_PROTOCOL_REQ */ [0x0a] = "\x03\x0d\x06\x08\x0a\x05\x07\x09\x01\x01",
345 /* CONNECT_B3_REQ */ [0x0b] = "\x03\x2b\x01", 345 /* CONNECT_B3_REQ */ [0x0b] = "\x03\x2b\x01",
346 /* DISCONNECT_B3_REQ */ [0x0d] = "\x03\x2b\x01", 346 /* DISCONNECT_B3_REQ */ [0x0d] = "\x03\x2b\x01",
347 /* DATA_B3_REQ */ [0x0f] = "\x03\x18\x1a\x19\x20\x01", 347 /* DATA_B3_REQ */ [0x0f] = "\x03\x18\x1a\x19\x20\x01",
348 /* RESET_B3_REQ */ [0x10] = "\x03\x2b\x01", 348 /* RESET_B3_REQ */ [0x10] = "\x03\x2b\x01",
349 /* ALERT_CONF */ [0x13] = "\x03\x23\x01", 349 /* ALERT_CONF */ [0x13] = "\x03\x23\x01",
350 /* CONNECT_CONF */ [0x14] = "\x03\x23\x01", 350 /* CONNECT_CONF */ [0x14] = "\x03\x23\x01",
351 /* DISCONNECT_CONF */ [0x16] = "\x03\x23\x01", 351 /* DISCONNECT_CONF */ [0x16] = "\x03\x23\x01",
352 /* LISTEN_CONF */ [0x17] = "\x03\x23\x01", 352 /* LISTEN_CONF */ [0x17] = "\x03\x23\x01",
353 /* MANUFACTURER_REQ */ [0x18] = "\x03\x2a\x15\x21\x29\x01", 353 /* MANUFACTURER_REQ */ [0x18] = "\x03\x2a\x15\x21\x29\x01",
354 /* INFO_CONF */ [0x1a] = "\x03\x23\x01", 354 /* INFO_CONF */ [0x1a] = "\x03\x23\x01",
355 /* FACILITY_CONF */ [0x1b] = "\x03\x23\x1f\x1b\x01", 355 /* FACILITY_CONF */ [0x1b] = "\x03\x23\x1f\x1b\x01",
356 /* SELECT_B_PROTOCOL_CONF */ [0x1c] = "\x03\x23\x01", 356 /* SELECT_B_PROTOCOL_CONF */ [0x1c] = "\x03\x23\x01",
357 /* CONNECT_B3_CONF */ [0x1d] = "\x03\x23\x01", 357 /* CONNECT_B3_CONF */ [0x1d] = "\x03\x23\x01",
358 /* DISCONNECT_B3_CONF */ [0x1f] = "\x03\x23\x01", 358 /* DISCONNECT_B3_CONF */ [0x1f] = "\x03\x23\x01",
359 /* DATA_B3_CONF */ [0x21] = "\x03\x19\x23\x01", 359 /* DATA_B3_CONF */ [0x21] = "\x03\x19\x23\x01",
360 /* RESET_B3_CONF */ [0x22] = "\x03\x23\x01", 360 /* RESET_B3_CONF */ [0x22] = "\x03\x23\x01",
361 /* CONNECT_IND */ [0x26] = "\x03\x14\x0e\x10\x0f\x11\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01", 361 /* CONNECT_IND */ [0x26] = "\x03\x14\x0e\x10\x0f\x11\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01",
362 /* CONNECT_ACTIVE_IND */ [0x27] = "\x03\x16\x17\x28\x01", 362 /* CONNECT_ACTIVE_IND */ [0x27] = "\x03\x16\x17\x28\x01",
363 /* DISCONNECT_IND */ [0x28] = "\x03\x2c\x01", 363 /* DISCONNECT_IND */ [0x28] = "\x03\x2c\x01",
364 /* MANUFACTURER_CONF */ [0x2a] = "\x03\x2a\x15\x21\x29\x01", 364 /* MANUFACTURER_CONF */ [0x2a] = "\x03\x2a\x15\x21\x29\x01",
365 /* INFO_IND */ [0x2c] = "\x03\x26\x24\x01", 365 /* INFO_IND */ [0x2c] = "\x03\x26\x24\x01",
366 /* FACILITY_IND */ [0x2d] = "\x03\x1f\x1d\x01", 366 /* FACILITY_IND */ [0x2d] = "\x03\x1f\x1d\x01",
367 /* CONNECT_B3_IND */ [0x2f] = "\x03\x2b\x01", 367 /* CONNECT_B3_IND */ [0x2f] = "\x03\x2b\x01",
368 /* CONNECT_B3_ACTIVE_IND */ [0x30] = "\x03\x2b\x01", 368 /* CONNECT_B3_ACTIVE_IND */ [0x30] = "\x03\x2b\x01",
369 /* DISCONNECT_B3_IND */ [0x31] = "\x03\x2d\x2b\x01", 369 /* DISCONNECT_B3_IND */ [0x31] = "\x03\x2d\x2b\x01",
370 /* DATA_B3_IND */ [0x33] = "\x03\x18\x1a\x19\x20\x01", 370 /* DATA_B3_IND */ [0x33] = "\x03\x18\x1a\x19\x20\x01",
371 /* RESET_B3_IND */ [0x34] = "\x03\x2b\x01", 371 /* RESET_B3_IND */ [0x34] = "\x03\x2b\x01",
372 /* CONNECT_B3_T90_ACTIVE_IND */ [0x35] = "\x03\x2b\x01", 372 /* CONNECT_B3_T90_ACTIVE_IND */ [0x35] = "\x03\x2b\x01",
373 /* CONNECT_RESP */ [0x38] = "\x03\x2e\x0d\x06\x08\x0a\x05\x07\x09\x01\x16\x17\x28\x04\x0c\x27\x2f\x1c\x01\x01", 373 /* CONNECT_RESP */ [0x38] = "\x03\x2e\x0d\x06\x08\x0a\x05\x07\x09\x01\x16\x17\x28\x04\x0c\x27\x2f\x1c\x01\x01",
374 /* CONNECT_ACTIVE_RESP */ [0x39] = "\x03\x01", 374 /* CONNECT_ACTIVE_RESP */ [0x39] = "\x03\x01",
375 /* DISCONNECT_RESP */ [0x3a] = "\x03\x01", 375 /* DISCONNECT_RESP */ [0x3a] = "\x03\x01",
376 /* MANUFACTURER_IND */ [0x3c] = "\x03\x2a\x15\x21\x29\x01", 376 /* MANUFACTURER_IND */ [0x3c] = "\x03\x2a\x15\x21\x29\x01",
377 /* INFO_RESP */ [0x3e] = "\x03\x01", 377 /* INFO_RESP */ [0x3e] = "\x03\x01",
378 /* FACILITY_RESP */ [0x3f] = "\x03\x1f\x01", 378 /* FACILITY_RESP */ [0x3f] = "\x03\x1f\x01",
379 /* CONNECT_B3_RESP */ [0x41] = "\x03\x2e\x2b\x01", 379 /* CONNECT_B3_RESP */ [0x41] = "\x03\x2e\x2b\x01",
380 /* CONNECT_B3_ACTIVE_RESP */ [0x42] = "\x03\x01", 380 /* CONNECT_B3_ACTIVE_RESP */ [0x42] = "\x03\x01",
381 /* DISCONNECT_B3_RESP */ [0x43] = "\x03\x01", 381 /* DISCONNECT_B3_RESP */ [0x43] = "\x03\x01",
382 /* DATA_B3_RESP */ [0x45] = "\x03\x19\x01", 382 /* DATA_B3_RESP */ [0x45] = "\x03\x19\x01",
383 /* RESET_B3_RESP */ [0x46] = "\x03\x01", 383 /* RESET_B3_RESP */ [0x46] = "\x03\x01",
384 /* CONNECT_B3_T90_ACTIVE_RESP */ [0x47] = "\x03\x01", 384 /* CONNECT_B3_T90_ACTIVE_RESP */ [0x47] = "\x03\x01",
385 /* MANUFACTURER_RESP */ [0x4e] = "\x03\x2a\x15\x21\x29\x01", 385 /* MANUFACTURER_RESP */ [0x4e] = "\x03\x2a\x15\x21\x29\x01",
386}; 386};
387 387
388/*-------------------------------------------------------*/ 388/*-------------------------------------------------------*/
389 389
390#define byteTLcpy(x,y) *(u8 *)(x)=*(u8 *)(y); 390#define byteTLcpy(x, y) *(u8 *)(x) = *(u8 *)(y);
391#define wordTLcpy(x,y) *(u16 *)(x)=*(u16 *)(y); 391#define wordTLcpy(x, y) *(u16 *)(x) = *(u16 *)(y);
392#define dwordTLcpy(x,y) memcpy(x,y,4); 392#define dwordTLcpy(x, y) memcpy(x, y, 4);
393#define structTLcpy(x,y,l) memcpy (x,y,l) 393#define structTLcpy(x, y, l) memcpy(x, y, l)
394#define structTLcpyovl(x,y,l) memmove (x,y,l) 394#define structTLcpyovl(x, y, l) memmove(x, y, l)
395 395
396#define byteTRcpy(x,y) *(u8 *)(y)=*(u8 *)(x); 396#define byteTRcpy(x, y) *(u8 *)(y) = *(u8 *)(x);
397#define wordTRcpy(x,y) *(u16 *)(y)=*(u16 *)(x); 397#define wordTRcpy(x, y) *(u16 *)(y) = *(u16 *)(x);
398#define dwordTRcpy(x,y) memcpy(y,x,4); 398#define dwordTRcpy(x, y) memcpy(y, x, 4);
399#define structTRcpy(x,y,l) memcpy (y,x,l) 399#define structTRcpy(x, y, l) memcpy(y, x, l)
400#define structTRcpyovl(x,y,l) memmove (y,x,l) 400#define structTRcpyovl(x, y, l) memmove(y, x, l)
401 401
402/*-------------------------------------------------------*/ 402/*-------------------------------------------------------*/
403static unsigned command_2_index(unsigned c, unsigned sc) 403static unsigned command_2_index(unsigned c, unsigned sc)
@@ -414,9 +414,9 @@ static unsigned command_2_index(unsigned c, unsigned sc)
414 414
415/*-------------------------------------------------------*/ 415/*-------------------------------------------------------*/
416#define TYP (cdef[cmsg->par[cmsg->p]].typ) 416#define TYP (cdef[cmsg->par[cmsg->p]].typ)
417#define OFF (((u8 *)cmsg)+cdef[cmsg->par[cmsg->p]].off) 417#define OFF (((u8 *)cmsg) + cdef[cmsg->par[cmsg->p]].off)
418 418
419static void jumpcstruct(_cmsg * cmsg) 419static void jumpcstruct(_cmsg *cmsg)
420{ 420{
421 unsigned layer; 421 unsigned layer;
422 for (cmsg->p++, layer = 1; layer;) { 422 for (cmsg->p++, layer = 1; layer;) {
@@ -433,7 +433,7 @@ static void jumpcstruct(_cmsg * cmsg)
433 } 433 }
434} 434}
435/*-------------------------------------------------------*/ 435/*-------------------------------------------------------*/
436static void pars_2_message(_cmsg * cmsg) 436static void pars_2_message(_cmsg *cmsg)
437{ 437{
438 438
439 for (; TYP != _CEND; cmsg->p++) { 439 for (; TYP != _CEND; cmsg->p++) {
@@ -499,7 +499,7 @@ static void pars_2_message(_cmsg * cmsg)
499 * Return value: 0 for success 499 * Return value: 0 for success
500 */ 500 */
501 501
502unsigned capi_cmsg2message(_cmsg * cmsg, u8 * msg) 502unsigned capi_cmsg2message(_cmsg *cmsg, u8 *msg)
503{ 503{
504 cmsg->m = msg; 504 cmsg->m = msg;
505 cmsg->l = 8; 505 cmsg->l = 8;
@@ -518,7 +518,7 @@ unsigned capi_cmsg2message(_cmsg * cmsg, u8 * msg)
518} 518}
519 519
520/*-------------------------------------------------------*/ 520/*-------------------------------------------------------*/
521static void message_2_pars(_cmsg * cmsg) 521static void message_2_pars(_cmsg *cmsg)
522{ 522{
523 for (; TYP != _CEND; cmsg->p++) { 523 for (; TYP != _CEND; cmsg->p++) {
524 524
@@ -569,7 +569,7 @@ static void message_2_pars(_cmsg * cmsg)
569 * Return value: 0 for success 569 * Return value: 0 for success
570 */ 570 */
571 571
572unsigned capi_message2cmsg(_cmsg * cmsg, u8 * msg) 572unsigned capi_message2cmsg(_cmsg *cmsg, u8 *msg)
573{ 573{
574 memset(cmsg, 0, sizeof(_cmsg)); 574 memset(cmsg, 0, sizeof(_cmsg));
575 cmsg->m = msg; 575 cmsg->m = msg;
@@ -600,7 +600,7 @@ unsigned capi_message2cmsg(_cmsg * cmsg, u8 * msg)
600 * Return value: 0 for success 600 * Return value: 0 for success
601 */ 601 */
602 602
603unsigned capi_cmsg_header(_cmsg * cmsg, u16 _ApplId, 603unsigned capi_cmsg_header(_cmsg *cmsg, u16 _ApplId,
604 u8 _Command, u8 _Subcommand, 604 u8 _Command, u8 _Subcommand,
605 u16 _Messagenumber, u32 _Controller) 605 u16 _Messagenumber, u32 _Controller)
606{ 606{
@@ -689,54 +689,54 @@ char *capi_cmd2str(u8 cmd, u8 subcmd)
689 689
690static char *pnames[] = 690static char *pnames[] =
691{ 691{
692 /*00 */ NULL, 692 /*00 */ NULL,
693 /*01 */ NULL, 693 /*01 */ NULL,
694 /*02 */ NULL, 694 /*02 */ NULL,
695 /*03 */ "Controller/PLCI/NCCI", 695 /*03 */ "Controller/PLCI/NCCI",
696 /*04 */ "AdditionalInfo", 696 /*04 */ "AdditionalInfo",
697 /*05 */ "B1configuration", 697 /*05 */ "B1configuration",
698 /*06 */ "B1protocol", 698 /*06 */ "B1protocol",
699 /*07 */ "B2configuration", 699 /*07 */ "B2configuration",
700 /*08 */ "B2protocol", 700 /*08 */ "B2protocol",
701 /*09 */ "B3configuration", 701 /*09 */ "B3configuration",
702 /*0a */ "B3protocol", 702 /*0a */ "B3protocol",
703 /*0b */ "BC", 703 /*0b */ "BC",
704 /*0c */ "BChannelinformation", 704 /*0c */ "BChannelinformation",
705 /*0d */ "BProtocol", 705 /*0d */ "BProtocol",
706 /*0e */ "CalledPartyNumber", 706 /*0e */ "CalledPartyNumber",
707 /*0f */ "CalledPartySubaddress", 707 /*0f */ "CalledPartySubaddress",
708 /*10 */ "CallingPartyNumber", 708 /*10 */ "CallingPartyNumber",
709 /*11 */ "CallingPartySubaddress", 709 /*11 */ "CallingPartySubaddress",
710 /*12 */ "CIPmask", 710 /*12 */ "CIPmask",
711 /*13 */ "CIPmask2", 711 /*13 */ "CIPmask2",
712 /*14 */ "CIPValue", 712 /*14 */ "CIPValue",
713 /*15 */ "Class", 713 /*15 */ "Class",
714 /*16 */ "ConnectedNumber", 714 /*16 */ "ConnectedNumber",
715 /*17 */ "ConnectedSubaddress", 715 /*17 */ "ConnectedSubaddress",
716 /*18 */ "Data32", 716 /*18 */ "Data32",
717 /*19 */ "DataHandle", 717 /*19 */ "DataHandle",
718 /*1a */ "DataLength", 718 /*1a */ "DataLength",
719 /*1b */ "FacilityConfirmationParameter", 719 /*1b */ "FacilityConfirmationParameter",
720 /*1c */ "Facilitydataarray", 720 /*1c */ "Facilitydataarray",
721 /*1d */ "FacilityIndicationParameter", 721 /*1d */ "FacilityIndicationParameter",
722 /*1e */ "FacilityRequestParameter", 722 /*1e */ "FacilityRequestParameter",
723 /*1f */ "FacilitySelector", 723 /*1f */ "FacilitySelector",
724 /*20 */ "Flags", 724 /*20 */ "Flags",
725 /*21 */ "Function", 725 /*21 */ "Function",
726 /*22 */ "HLC", 726 /*22 */ "HLC",
727 /*23 */ "Info", 727 /*23 */ "Info",
728 /*24 */ "InfoElement", 728 /*24 */ "InfoElement",
729 /*25 */ "InfoMask", 729 /*25 */ "InfoMask",
730 /*26 */ "InfoNumber", 730 /*26 */ "InfoNumber",
731 /*27 */ "Keypadfacility", 731 /*27 */ "Keypadfacility",
732 /*28 */ "LLC", 732 /*28 */ "LLC",
733 /*29 */ "ManuData", 733 /*29 */ "ManuData",
734 /*2a */ "ManuID", 734 /*2a */ "ManuID",
735 /*2b */ "NCPI", 735 /*2b */ "NCPI",
736 /*2c */ "Reason", 736 /*2c */ "Reason",
737 /*2d */ "Reason_B3", 737 /*2d */ "Reason_B3",
738 /*2e */ "Reject", 738 /*2e */ "Reject",
739 /*2f */ "Useruserdata" 739 /*2f */ "Useruserdata"
740}; 740};
741 741
742 742
@@ -744,10 +744,10 @@ static char *pnames[] =
744#include <stdarg.h> 744#include <stdarg.h>
745 745
746/*-------------------------------------------------------*/ 746/*-------------------------------------------------------*/
747static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt,...) 747static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt, ...)
748{ 748{
749 va_list f; 749 va_list f;
750 size_t n,r; 750 size_t n, r;
751 751
752 if (!cdb) 752 if (!cdb)
753 return NULL; 753 return NULL;
@@ -783,7 +783,7 @@ static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt,...)
783 return cdb; 783 return cdb;
784} 784}
785 785
786static _cdebbuf *printstructlen(_cdebbuf *cdb, u8 * m, unsigned len) 786static _cdebbuf *printstructlen(_cdebbuf *cdb, u8 *m, unsigned len)
787{ 787{
788 unsigned hex = 0; 788 unsigned hex = 0;
789 789
@@ -807,7 +807,7 @@ static _cdebbuf *printstructlen(_cdebbuf *cdb, u8 * m, unsigned len)
807 return cdb; 807 return cdb;
808} 808}
809 809
810static _cdebbuf *printstruct(_cdebbuf *cdb, u8 * m) 810static _cdebbuf *printstruct(_cdebbuf *cdb, u8 *m)
811{ 811{
812 unsigned len; 812 unsigned len;
813 813
@@ -940,7 +940,7 @@ void cdebbuf_free(_cdebbuf *cdb)
940 * The returned buffer should be freed by a call to cdebbuf_free() after use. 940 * The returned buffer should be freed by a call to cdebbuf_free() after use.
941 */ 941 */
942 942
943_cdebbuf *capi_message2str(u8 * msg) 943_cdebbuf *capi_message2str(u8 *msg)
944{ 944{
945 _cdebbuf *cdb; 945 _cdebbuf *cdb;
946 _cmsg *cmsg; 946 _cmsg *cmsg;
@@ -964,10 +964,10 @@ _cdebbuf *capi_message2str(u8 * msg)
964 cmsg->par = cpars[command_2_index(cmsg->Command, cmsg->Subcommand)]; 964 cmsg->par = cpars[command_2_index(cmsg->Command, cmsg->Subcommand)];
965 965
966 cdb = bufprint(cdb, "%-26s ID=%03d #0x%04x LEN=%04d\n", 966 cdb = bufprint(cdb, "%-26s ID=%03d #0x%04x LEN=%04d\n",
967 mnames[command_2_index(cmsg->Command, cmsg->Subcommand)], 967 mnames[command_2_index(cmsg->Command, cmsg->Subcommand)],
968 ((unsigned short *) msg)[1], 968 ((unsigned short *) msg)[1],
969 ((unsigned short *) msg)[3], 969 ((unsigned short *) msg)[3],
970 ((unsigned short *) msg)[0]); 970 ((unsigned short *) msg)[0]);
971 971
972 cdb = protocol_message_2_pars(cdb, cmsg, 1); 972 cdb = protocol_message_2_pars(cdb, cmsg, 1);
973 if (unlikely(cmsg != g_cmsg)) 973 if (unlikely(cmsg != g_cmsg))
@@ -986,7 +986,7 @@ _cdebbuf *capi_message2str(u8 * msg)
986 * The returned buffer should be freed by a call to cdebbuf_free() after use. 986 * The returned buffer should be freed by a call to cdebbuf_free() after use.
987 */ 987 */
988 988
989_cdebbuf *capi_cmsg2str(_cmsg * cmsg) 989_cdebbuf *capi_cmsg2str(_cmsg *cmsg)
990{ 990{
991 _cdebbuf *cdb; 991 _cdebbuf *cdb;
992 992
@@ -998,17 +998,17 @@ _cdebbuf *capi_cmsg2str(_cmsg * cmsg)
998 cmsg->l = 8; 998 cmsg->l = 8;
999 cmsg->p = 0; 999 cmsg->p = 0;
1000 cdb = bufprint(cdb, "%s ID=%03d #0x%04x LEN=%04d\n", 1000 cdb = bufprint(cdb, "%s ID=%03d #0x%04x LEN=%04d\n",
1001 mnames[command_2_index(cmsg->Command, cmsg->Subcommand)], 1001 mnames[command_2_index(cmsg->Command, cmsg->Subcommand)],
1002 ((u16 *) cmsg->m)[1], 1002 ((u16 *) cmsg->m)[1],
1003 ((u16 *) cmsg->m)[3], 1003 ((u16 *) cmsg->m)[3],
1004 ((u16 *) cmsg->m)[0]); 1004 ((u16 *) cmsg->m)[0]);
1005 cdb = protocol_message_2_pars(cdb, cmsg, 1); 1005 cdb = protocol_message_2_pars(cdb, cmsg, 1);
1006 return cdb; 1006 return cdb;
1007} 1007}
1008 1008
1009int __init cdebug_init(void) 1009int __init cdebug_init(void)
1010{ 1010{
1011 g_cmsg= kmalloc(sizeof(_cmsg), GFP_KERNEL); 1011 g_cmsg = kmalloc(sizeof(_cmsg), GFP_KERNEL);
1012 if (!g_cmsg) 1012 if (!g_cmsg)
1013 return -ENOMEM; 1013 return -ENOMEM;
1014 g_debbuf = kmalloc(sizeof(_cdebbuf), GFP_KERNEL); 1014 g_debbuf = kmalloc(sizeof(_cdebbuf), GFP_KERNEL);
@@ -1041,12 +1041,12 @@ void __exit cdebug_exit(void)
1041 1041
1042static _cdebbuf g_debbuf = {"CONFIG_CAPI_TRACE not enabled", NULL, 0, 0}; 1042static _cdebbuf g_debbuf = {"CONFIG_CAPI_TRACE not enabled", NULL, 0, 0};
1043 1043
1044_cdebbuf *capi_message2str(u8 * msg) 1044_cdebbuf *capi_message2str(u8 *msg)
1045{ 1045{
1046 return &g_debbuf; 1046 return &g_debbuf;
1047} 1047}
1048 1048
1049_cdebbuf *capi_cmsg2str(_cmsg * cmsg) 1049_cdebbuf *capi_cmsg2str(_cmsg *cmsg)
1050{ 1050{
1051 return &g_debbuf; 1051 return &g_debbuf;
1052} 1052}
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index 2b33b2627fce..9b1b274c7d25 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -1,10 +1,10 @@
1/* $Id: kcapi.c,v 1.1.2.8 2004/03/26 19:57:20 armin Exp $ 1/* $Id: kcapi.c,v 1.1.2.8 2004/03/26 19:57:20 armin Exp $
2 * 2 *
3 * Kernel CAPI 2.0 Module 3 * Kernel CAPI 2.0 Module
4 * 4 *
5 * Copyright 1999 by Carsten Paeth <calle@calle.de> 5 * Copyright 1999 by Carsten Paeth <calle@calle.de>
6 * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name> 6 * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name>
7 * 7 *
8 * This software may be used and distributed according to the terms 8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference. 9 * of the GNU General Public License, incorporated herein by reference.
10 * 10 *
@@ -55,7 +55,7 @@ struct capictr_event {
55 55
56/* ------------------------------------------------------------- */ 56/* ------------------------------------------------------------- */
57 57
58static struct capi_version driver_version = {2, 0, 1, 1<<4}; 58static struct capi_version driver_version = {2, 0, 1, 1 << 4};
59static char driver_serial[CAPI_SERIAL_LEN] = "0004711"; 59static char driver_serial[CAPI_SERIAL_LEN] = "0004711";
60static char capi_manufakturer[64] = "AVM Berlin"; 60static char capi_manufakturer[64] = "AVM Berlin";
61 61
@@ -172,7 +172,7 @@ register_appl(struct capi_ctr *ctr, u16 applid, capi_register_params *rparam)
172static void release_appl(struct capi_ctr *ctr, u16 applid) 172static void release_appl(struct capi_ctr *ctr, u16 applid)
173{ 173{
174 DBG("applid %#x", applid); 174 DBG("applid %#x", applid);
175 175
176 ctr->release_appl(ctr, applid); 176 ctr->release_appl(ctr, applid);
177 capi_ctr_put(ctr); 177 capi_ctr_put(ctr);
178} 178}
@@ -186,7 +186,7 @@ static void notify_up(u32 contr)
186 mutex_lock(&capi_controller_lock); 186 mutex_lock(&capi_controller_lock);
187 187
188 if (showcapimsgs & 1) 188 if (showcapimsgs & 1)
189 printk(KERN_DEBUG "kcapi: notify up contr %d\n", contr); 189 printk(KERN_DEBUG "kcapi: notify up contr %d\n", contr);
190 190
191 ctr = get_capi_ctr_by_nr(contr); 191 ctr = get_capi_ctr_by_nr(contr);
192 if (ctr) { 192 if (ctr) {
@@ -352,16 +352,16 @@ void capi_ctr_handle_message(struct capi_ctr *ctr, u16 appl,
352 cdb = capi_message2str(skb->data); 352 cdb = capi_message2str(skb->data);
353 if (cdb) { 353 if (cdb) {
354 printk(KERN_INFO "kcapi: controller [%03d] not active, got: %s", 354 printk(KERN_INFO "kcapi: controller [%03d] not active, got: %s",
355 ctr->cnr, cdb->buf); 355 ctr->cnr, cdb->buf);
356 cdebbuf_free(cdb); 356 cdebbuf_free(cdb);
357 } else 357 } else
358 printk(KERN_INFO "kcapi: controller [%03d] not active, cannot trace\n", 358 printk(KERN_INFO "kcapi: controller [%03d] not active, cannot trace\n",
359 ctr->cnr); 359 ctr->cnr);
360 goto error; 360 goto error;
361 } 361 }
362 362
363 cmd = CAPIMSG_COMMAND(skb->data); 363 cmd = CAPIMSG_COMMAND(skb->data);
364 subcmd = CAPIMSG_SUBCOMMAND(skb->data); 364 subcmd = CAPIMSG_SUBCOMMAND(skb->data);
365 if (cmd == CAPI_DATA_B3 && subcmd == CAPI_IND) { 365 if (cmd == CAPI_DATA_B3 && subcmd == CAPI_IND) {
366 ctr->nrecvdatapkt++; 366 ctr->nrecvdatapkt++;
367 if (ctr->traceflag > 2) 367 if (ctr->traceflag > 2)
@@ -382,13 +382,13 @@ void capi_ctr_handle_message(struct capi_ctr *ctr, u16 appl,
382 cdb = capi_message2str(skb->data); 382 cdb = capi_message2str(skb->data);
383 if (cdb) { 383 if (cdb) {
384 printk(KERN_DEBUG "kcapi: got [%03d] %s\n", 384 printk(KERN_DEBUG "kcapi: got [%03d] %s\n",
385 ctr->cnr, cdb->buf); 385 ctr->cnr, cdb->buf);
386 cdebbuf_free(cdb); 386 cdebbuf_free(cdb);
387 } else 387 } else
388 printk(KERN_DEBUG "kcapi: got [%03d] id#%d %s len=%u, cannot trace\n", 388 printk(KERN_DEBUG "kcapi: got [%03d] id#%d %s len=%u, cannot trace\n",
389 ctr->cnr, CAPIMSG_APPID(skb->data), 389 ctr->cnr, CAPIMSG_APPID(skb->data),
390 capi_cmd2str(cmd, subcmd), 390 capi_cmd2str(cmd, subcmd),
391 CAPIMSG_LEN(skb->data)); 391 CAPIMSG_LEN(skb->data));
392 } 392 }
393 393
394 } 394 }
@@ -400,12 +400,12 @@ void capi_ctr_handle_message(struct capi_ctr *ctr, u16 appl,
400 cdb = capi_message2str(skb->data); 400 cdb = capi_message2str(skb->data);
401 if (cdb) { 401 if (cdb) {
402 printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s)\n", 402 printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s)\n",
403 CAPIMSG_APPID(skb->data), cdb->buf); 403 CAPIMSG_APPID(skb->data), cdb->buf);
404 cdebbuf_free(cdb); 404 cdebbuf_free(cdb);
405 } else 405 } else
406 printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s) cannot trace\n", 406 printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s) cannot trace\n",
407 CAPIMSG_APPID(skb->data), 407 CAPIMSG_APPID(skb->data),
408 capi_cmd2str(cmd, subcmd)); 408 capi_cmd2str(cmd, subcmd));
409 goto error; 409 goto error;
410 } 410 }
411 skb_queue_tail(&ap->recv_queue, skb); 411 skb_queue_tail(&ap->recv_queue, skb);
@@ -519,7 +519,7 @@ int attach_capi_ctr(struct capi_ctr *ctr)
519 if (i == CAPI_MAXCONTR) { 519 if (i == CAPI_MAXCONTR) {
520 mutex_unlock(&capi_controller_lock); 520 mutex_unlock(&capi_controller_lock);
521 printk(KERN_ERR "kcapi: out of controller slots\n"); 521 printk(KERN_ERR "kcapi: out of controller slots\n");
522 return -EBUSY; 522 return -EBUSY;
523 } 523 }
524 capi_controller[i] = ctr; 524 capi_controller[i] = ctr;
525 525
@@ -541,7 +541,7 @@ int attach_capi_ctr(struct capi_ctr *ctr)
541 mutex_unlock(&capi_controller_lock); 541 mutex_unlock(&capi_controller_lock);
542 542
543 printk(KERN_NOTICE "kcapi: controller [%03d]: %s attached\n", 543 printk(KERN_NOTICE "kcapi: controller [%03d]: %s attached\n",
544 ctr->cnr, ctr->name); 544 ctr->cnr, ctr->name);
545 return 0; 545 return 0;
546} 546}
547 547
@@ -772,7 +772,7 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
772 u8 cmd, subcmd; 772 u8 cmd, subcmd;
773 773
774 DBG("applid %#x", ap->applid); 774 DBG("applid %#x", ap->applid);
775 775
776 if (ncontrollers == 0) 776 if (ncontrollers == 0)
777 return CAPI_REGNOTINSTALLED; 777 return CAPI_REGNOTINSTALLED;
778 if ((ap->applid == 0) || ap->release_in_progress) 778 if ((ap->applid == 0) || ap->release_in_progress)
@@ -794,9 +794,9 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
794 return CAPI_SENDQUEUEFULL; 794 return CAPI_SENDQUEUEFULL;
795 795
796 cmd = CAPIMSG_COMMAND(skb->data); 796 cmd = CAPIMSG_COMMAND(skb->data);
797 subcmd = CAPIMSG_SUBCOMMAND(skb->data); 797 subcmd = CAPIMSG_SUBCOMMAND(skb->data);
798 798
799 if (cmd == CAPI_DATA_B3 && subcmd== CAPI_REQ) { 799 if (cmd == CAPI_DATA_B3 && subcmd == CAPI_REQ) {
800 ctr->nsentdatapkt++; 800 ctr->nsentdatapkt++;
801 ap->nsentdatapkt++; 801 ap->nsentdatapkt++;
802 if (ctr->traceflag > 2) 802 if (ctr->traceflag > 2)
@@ -819,15 +819,15 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
819 _cdebbuf *cdb = capi_message2str(skb->data); 819 _cdebbuf *cdb = capi_message2str(skb->data);
820 if (cdb) { 820 if (cdb) {
821 printk(KERN_DEBUG "kcapi: put [%03d] %s\n", 821 printk(KERN_DEBUG "kcapi: put [%03d] %s\n",
822 CAPIMSG_CONTROLLER(skb->data), 822 CAPIMSG_CONTROLLER(skb->data),
823 cdb->buf); 823 cdb->buf);
824 cdebbuf_free(cdb); 824 cdebbuf_free(cdb);
825 } else 825 } else
826 printk(KERN_DEBUG "kcapi: put [%03d] id#%d %s len=%u cannot trace\n", 826 printk(KERN_DEBUG "kcapi: put [%03d] id#%d %s len=%u cannot trace\n",
827 CAPIMSG_CONTROLLER(skb->data), 827 CAPIMSG_CONTROLLER(skb->data),
828 CAPIMSG_APPID(skb->data), 828 CAPIMSG_APPID(skb->data),
829 capi_cmd2str(cmd, subcmd), 829 capi_cmd2str(cmd, subcmd),
830 CAPIMSG_LEN(skb->data)); 830 CAPIMSG_LEN(skb->data));
831 } 831 }
832 } 832 }
833 return ctr->send_message(ctr, skb); 833 return ctr->send_message(ctr, skb);
@@ -1028,14 +1028,14 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
1028 case AVMB1_ADDCARD: 1028 case AVMB1_ADDCARD:
1029 case AVMB1_ADDCARD_WITH_TYPE: 1029 case AVMB1_ADDCARD_WITH_TYPE:
1030 if (cmd == AVMB1_ADDCARD) { 1030 if (cmd == AVMB1_ADDCARD) {
1031 if ((retval = copy_from_user(&cdef, data, 1031 if ((retval = copy_from_user(&cdef, data,
1032 sizeof(avmb1_carddef)))) 1032 sizeof(avmb1_carddef))))
1033 return -EFAULT; 1033 return -EFAULT;
1034 cdef.cardtype = AVM_CARDTYPE_B1; 1034 cdef.cardtype = AVM_CARDTYPE_B1;
1035 } else { 1035 } else {
1036 if ((retval = copy_from_user(&cdef, data, 1036 if ((retval = copy_from_user(&cdef, data,
1037 sizeof(avmb1_extcarddef)))) 1037 sizeof(avmb1_extcarddef))))
1038 return -EFAULT; 1038 return -EFAULT;
1039 } 1039 }
1040 cparams.port = cdef.port; 1040 cparams.port = cdef.port;
1041 cparams.irq = cdef.irq; 1041 cparams.irq = cdef.irq;
@@ -1043,24 +1043,24 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
1043 1043
1044 mutex_lock(&capi_drivers_lock); 1044 mutex_lock(&capi_drivers_lock);
1045 1045
1046 switch (cdef.cardtype) { 1046 switch (cdef.cardtype) {
1047 case AVM_CARDTYPE_B1: 1047 case AVM_CARDTYPE_B1:
1048 list_for_each(l, &capi_drivers) { 1048 list_for_each(l, &capi_drivers) {
1049 driver = list_entry(l, struct capi_driver, list); 1049 driver = list_entry(l, struct capi_driver, list);
1050 if (strcmp(driver->name, "b1isa") == 0) 1050 if (strcmp(driver->name, "b1isa") == 0)
1051 break; 1051 break;
1052 } 1052 }
1053 break; 1053 break;
1054 case AVM_CARDTYPE_T1: 1054 case AVM_CARDTYPE_T1:
1055 list_for_each(l, &capi_drivers) { 1055 list_for_each(l, &capi_drivers) {
1056 driver = list_entry(l, struct capi_driver, list); 1056 driver = list_entry(l, struct capi_driver, list);
1057 if (strcmp(driver->name, "t1isa") == 0) 1057 if (strcmp(driver->name, "t1isa") == 0)
1058 break; 1058 break;
1059 } 1059 }
1060 break; 1060 break;
1061 default: 1061 default:
1062 driver = NULL; 1062 driver = NULL;
1063 break; 1063 break;
1064 } 1064 }
1065 if (!driver) { 1065 if (!driver) {
1066 printk(KERN_ERR "kcapi: driver not loaded.\n"); 1066 printk(KERN_ERR "kcapi: driver not loaded.\n");
@@ -1136,7 +1136,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
1136 1136
1137 retval = wait_on_ctr_state(ctr, CAPI_CTR_RUNNING); 1137 retval = wait_on_ctr_state(ctr, CAPI_CTR_RUNNING);
1138 1138
1139load_unlock_out: 1139 load_unlock_out:
1140 mutex_unlock(&capi_controller_lock); 1140 mutex_unlock(&capi_controller_lock);
1141 return retval; 1141 return retval;
1142 1142
@@ -1167,7 +1167,7 @@ load_unlock_out:
1167 1167
1168 retval = wait_on_ctr_state(ctr, CAPI_CTR_DETECTED); 1168 retval = wait_on_ctr_state(ctr, CAPI_CTR_DETECTED);
1169 1169
1170reset_unlock_out: 1170 reset_unlock_out:
1171 mutex_unlock(&capi_controller_lock); 1171 mutex_unlock(&capi_controller_lock);
1172 return retval; 1172 return retval;
1173 } 1173 }
@@ -1235,7 +1235,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data)
1235 cparams.membase = cdef.membase; 1235 cparams.membase = cdef.membase;
1236 cparams.cardnr = cdef.cardnr; 1236 cparams.cardnr = cdef.cardnr;
1237 cparams.cardtype = 0; 1237 cparams.cardtype = 0;
1238 cdef.driver[sizeof(cdef.driver)-1] = 0; 1238 cdef.driver[sizeof(cdef.driver) - 1] = 0;
1239 1239
1240 mutex_lock(&capi_drivers_lock); 1240 mutex_lock(&capi_drivers_lock);
1241 1241
@@ -1246,7 +1246,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data)
1246 } 1246 }
1247 if (driver == NULL) { 1247 if (driver == NULL) {
1248 printk(KERN_ERR "kcapi: driver \"%s\" not loaded.\n", 1248 printk(KERN_ERR "kcapi: driver \"%s\" not loaded.\n",
1249 cdef.driver); 1249 cdef.driver);
1250 retval = -ESRCH; 1250 retval = -ESRCH;
1251 } else if (!driver->add_card) { 1251 } else if (!driver->add_card) {
1252 printk(KERN_ERR "kcapi: driver \"%s\" has no add card function.\n", cdef.driver); 1252 printk(KERN_ERR "kcapi: driver \"%s\" has no add card function.\n", cdef.driver);
@@ -1260,7 +1260,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data)
1260 1260
1261 default: 1261 default:
1262 printk(KERN_ERR "kcapi: manufacturer command %d unknown.\n", 1262 printk(KERN_ERR "kcapi: manufacturer command %d unknown.\n",
1263 cmd); 1263 cmd);
1264 break; 1264 break;
1265 1265
1266 } 1266 }
@@ -1305,7 +1305,7 @@ static int __init kcapi_init(void)
1305 1305
1306static void __exit kcapi_exit(void) 1306static void __exit kcapi_exit(void)
1307{ 1307{
1308 kcapi_proc_exit(); 1308 kcapi_proc_exit();
1309 1309
1310 unregister_capictr_notifier(&capictr_nb); 1310 unregister_capictr_notifier(&capictr_nb);
1311 cdebug_exit(); 1311 cdebug_exit();
diff --git a/drivers/isdn/capi/kcapi.h b/drivers/isdn/capi/kcapi.h
index f4620b38ec51..6d439f9a76b2 100644
--- a/drivers/isdn/capi/kcapi.h
+++ b/drivers/isdn/capi/kcapi.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * Kernel CAPI 2.0 Module 2 * Kernel CAPI 2.0 Module
3 * 3 *
4 * Copyright 1999 by Carsten Paeth <calle@calle.de> 4 * Copyright 1999 by Carsten Paeth <calle@calle.de>
5 * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name> 5 * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name>
6 * 6 *
7 * This software may be used and distributed according to the terms 7 * This software may be used and distributed according to the terms
8 * of the GNU General Public License, incorporated herein by reference. 8 * of the GNU General Public License, incorporated herein by reference.
9 * 9 *
@@ -16,9 +16,9 @@
16#include <linux/isdn/capilli.h> 16#include <linux/isdn/capilli.h>
17 17
18#ifdef KCAPI_DEBUG 18#ifdef KCAPI_DEBUG
19#define DBG(format, arg...) do { \ 19#define DBG(format, arg...) do { \
20printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \ 20 printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \
21} while (0) 21 } while (0)
22#else 22#else
23#define DBG(format, arg...) /* */ 23#define DBG(format, arg...) /* */
24#endif 24#endif
@@ -49,4 +49,3 @@ static inline void kcapi_proc_init(void) { };
49static inline void kcapi_proc_exit(void) { }; 49static inline void kcapi_proc_exit(void) { };
50 50
51#endif 51#endif
52
diff --git a/drivers/isdn/capi/kcapi_proc.c b/drivers/isdn/capi/kcapi_proc.c
index 8d51cd1bf674..68db3c5a1063 100644
--- a/drivers/isdn/capi/kcapi_proc.c
+++ b/drivers/isdn/capi/kcapi_proc.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * Kernel CAPI 2.0 Module - /proc/capi handling 2 * Kernel CAPI 2.0 Module - /proc/capi handling
3 * 3 *
4 * Copyright 1999 by Carsten Paeth <calle@calle.de> 4 * Copyright 1999 by Carsten Paeth <calle@calle.de>
5 * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name> 5 * Copyright 2002 by Kai Germaschewski <kai@germaschewski.name>
6 * 6 *
7 * This software may be used and distributed according to the terms 7 * This software may be used and distributed according to the terms
8 * of the GNU General Public License, incorporated herein by reference. 8 * of the GNU General Public License, incorporated herein by reference.
9 * 9 *
@@ -29,7 +29,7 @@ static char *state2str(unsigned short state)
29// /proc/capi 29// /proc/capi
30// =========================================================================== 30// ===========================================================================
31 31
32// /proc/capi/controller: 32// /proc/capi/controller:
33// cnr driver cardstate name driverinfo 33// cnr driver cardstate name driverinfo
34// /proc/capi/contrstats: 34// /proc/capi/contrstats:
35// cnr nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt 35// cnr nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt
@@ -85,7 +85,7 @@ static int contrstats_show(struct seq_file *seq, void *v)
85 return 0; 85 return 0;
86 86
87 seq_printf(seq, "%d %lu %lu %lu %lu\n", 87 seq_printf(seq, "%d %lu %lu %lu %lu\n",
88 ctr->cnr, 88 ctr->cnr,
89 ctr->nrecvctlpkt, 89 ctr->nrecvctlpkt,
90 ctr->nrecvdatapkt, 90 ctr->nrecvdatapkt,
91 ctr->nsentctlpkt, 91 ctr->nsentctlpkt,
@@ -134,9 +134,9 @@ static const struct file_operations proc_contrstats_ops = {
134 .release = seq_release, 134 .release = seq_release,
135}; 135};
136 136
137// /proc/capi/applications: 137// /proc/capi/applications:
138// applid l3cnt dblkcnt dblklen #ncci recvqueuelen 138// applid l3cnt dblkcnt dblklen #ncci recvqueuelen
139// /proc/capi/applstats: 139// /proc/capi/applstats:
140// applid nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt 140// applid nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt
141// --------------------------------------------------------------------------- 141// ---------------------------------------------------------------------------
142 142
@@ -297,7 +297,7 @@ static const struct file_operations proc_driver_ops = {
297 297
298// --------------------------------------------------------------------------- 298// ---------------------------------------------------------------------------
299 299
300void __init 300void __init
301kcapi_proc_init(void) 301kcapi_proc_init(void)
302{ 302{
303 proc_mkdir("capi", NULL); 303 proc_mkdir("capi", NULL);