aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/act2000/act2000.h6
-rw-r--r--drivers/isdn/capi/Kconfig15
-rw-r--r--drivers/isdn/capi/Makefile1
-rw-r--r--drivers/isdn/capi/capi.c149
-rw-r--r--drivers/isdn/capi/capidrv.c18
-rw-r--r--drivers/isdn/capi/capifs.c239
-rw-r--r--drivers/isdn/capi/capifs.h28
-rw-r--r--drivers/isdn/capi/kcapi.c45
-rw-r--r--drivers/isdn/divert/isdn_divert.c6
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c409
-rw-r--r--drivers/isdn/gigaset/capi.c1
-rw-r--r--drivers/isdn/gigaset/common.c26
-rw-r--r--drivers/isdn/gigaset/ev-layer.c26
-rw-r--r--drivers/isdn/gigaset/gigaset.h3
-rw-r--r--drivers/isdn/gigaset/i4l.c2
-rw-r--r--drivers/isdn/gigaset/interface.c16
-rw-r--r--drivers/isdn/gigaset/isocdata.c8
-rw-r--r--drivers/isdn/gigaset/ser-gigaset.c6
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c4
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c85
-rw-r--r--drivers/isdn/hardware/eicon/debug.c5
-rw-r--r--drivers/isdn/hardware/eicon/debuglib.h2
-rw-r--r--drivers/isdn/hardware/eicon/divacapi.h2
-rw-r--r--drivers/isdn/hardware/eicon/divasfunc.c5
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c2
-rw-r--r--drivers/isdn/hardware/eicon/io.h2
-rw-r--r--drivers/isdn/hardware/eicon/istream.c2
-rw-r--r--drivers/isdn/hardware/eicon/message.c27
-rw-r--r--drivers/isdn/hardware/eicon/pc.h2
-rw-r--r--drivers/isdn/hardware/eicon/um_idi.c2
-rw-r--r--drivers/isdn/hardware/mISDN/hfcmulti.c4
-rw-r--r--drivers/isdn/hardware/mISDN/hfcpci.c8
-rw-r--r--drivers/isdn/hardware/mISDN/hfcsusb.c6
-rw-r--r--drivers/isdn/hardware/mISDN/ipac.h4
-rw-r--r--drivers/isdn/hardware/mISDN/isar.h2
-rw-r--r--drivers/isdn/hardware/mISDN/mISDNinfineon.c6
-rw-r--r--drivers/isdn/hardware/mISDN/mISDNisar.c2
-rw-r--r--drivers/isdn/hardware/mISDN/netjet.c6
-rw-r--r--drivers/isdn/hisax/Makefile2
-rw-r--r--drivers/isdn/hisax/arcofi.c4
-rw-r--r--drivers/isdn/hisax/avm_pci.c2
-rw-r--r--drivers/isdn/hisax/avma1_cs.c99
-rw-r--r--drivers/isdn/hisax/callc.c4
-rw-r--r--drivers/isdn/hisax/config.c20
-rw-r--r--drivers/isdn/hisax/elsa_cs.c104
-rw-r--r--drivers/isdn/hisax/elsa_ser.c3
-rw-r--r--drivers/isdn/hisax/hfc_2bds0.c4
-rw-r--r--drivers/isdn/hisax/hfc_2bs0.c2
-rw-r--r--drivers/isdn/hisax/hfc_pci.c6
-rw-r--r--drivers/isdn/hisax/hfc_sx.c21
-rw-r--r--drivers/isdn/hisax/hfc_usb.c6
-rw-r--r--drivers/isdn/hisax/hfc_usb.h2
-rw-r--r--drivers/isdn/hisax/hisax.h3
-rw-r--r--drivers/isdn/hisax/ipacx.c6
-rw-r--r--drivers/isdn/hisax/isar.c19
-rw-r--r--drivers/isdn/hisax/isdnl1.h1
-rw-r--r--drivers/isdn/hisax/isdnl2.c28
-rw-r--r--drivers/isdn/hisax/isdnl3.c2
-rw-r--r--drivers/isdn/hisax/jade.c3
-rw-r--r--drivers/isdn/hisax/l3_1tr6.c6
-rw-r--r--drivers/isdn/hisax/l3dss1.c8
-rw-r--r--drivers/isdn/hisax/l3ni1.c8
-rw-r--r--drivers/isdn/hisax/netjet.c10
-rw-r--r--drivers/isdn/hisax/nj_s.c2
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c170
-rw-r--r--drivers/isdn/hisax/st5481.h1
-rw-r--r--drivers/isdn/hisax/st5481_b.c2
-rw-r--r--drivers/isdn/hisax/st5481_d.c6
-rw-r--r--drivers/isdn/hisax/st5481_init.c6
-rw-r--r--drivers/isdn/hisax/st5481_usb.c2
-rw-r--r--drivers/isdn/hisax/teles_cs.c104
-rw-r--r--drivers/isdn/hysdn/hysdn_defs.h2
-rw-r--r--drivers/isdn/hysdn/hysdn_init.c26
-rw-r--r--drivers/isdn/hysdn/hysdn_net.c3
-rw-r--r--drivers/isdn/hysdn/hysdn_procconf.c3
-rw-r--r--drivers/isdn/hysdn/hysdn_proclog.c11
-rw-r--r--drivers/isdn/hysdn/hysdn_sched.c2
-rw-r--r--drivers/isdn/i4l/isdn_audio.c2
-rw-r--r--drivers/isdn/i4l/isdn_common.c11
-rw-r--r--drivers/isdn/i4l/isdn_concap.c2
-rw-r--r--drivers/isdn/i4l/isdn_net.c26
-rw-r--r--drivers/isdn/i4l/isdn_ppp.c30
-rw-r--r--drivers/isdn/i4l/isdn_tty.c26
-rw-r--r--drivers/isdn/icn/icn.c8
-rw-r--r--drivers/isdn/isdnloop/isdnloop.c2
-rw-r--r--drivers/isdn/mISDN/dsp.h2
-rw-r--r--drivers/isdn/mISDN/dsp_cmx.c7
-rw-r--r--drivers/isdn/mISDN/dsp_core.c8
-rw-r--r--drivers/isdn/mISDN/dsp_dtmf.c4
-rw-r--r--drivers/isdn/mISDN/dsp_tones.c2
-rw-r--r--drivers/isdn/mISDN/hwchannel.c10
-rw-r--r--drivers/isdn/mISDN/l1oip_core.c10
-rw-r--r--drivers/isdn/mISDN/layer1.c10
-rw-r--r--drivers/isdn/mISDN/layer2.c36
-rw-r--r--drivers/isdn/mISDN/socket.c5
-rw-r--r--drivers/isdn/mISDN/stack.c7
-rw-r--r--drivers/isdn/mISDN/tei.c23
-rw-r--r--drivers/isdn/mISDN/timerdev.c1
-rw-r--r--drivers/isdn/pcbit/edss1.c2
-rw-r--r--drivers/isdn/pcbit/edss1.h2
100 files changed, 682 insertions, 1449 deletions
diff --git a/drivers/isdn/act2000/act2000.h b/drivers/isdn/act2000/act2000.h
index d4c50512a1ff..88c9423500d8 100644
--- a/drivers/isdn/act2000/act2000.h
+++ b/drivers/isdn/act2000/act2000.h
@@ -141,9 +141,9 @@ typedef struct irq_data_isa {
141 __u8 rcvhdr[8]; 141 __u8 rcvhdr[8];
142} irq_data_isa; 142} irq_data_isa;
143 143
144typedef union irq_data { 144typedef union act2000_irq_data {
145 irq_data_isa isa; 145 irq_data_isa isa;
146} irq_data; 146} act2000_irq_data;
147 147
148/* 148/*
149 * Per card driver data 149 * Per card driver data
@@ -176,7 +176,7 @@ typedef struct act2000_card {
176 char *status_buf_read; 176 char *status_buf_read;
177 char *status_buf_write; 177 char *status_buf_write;
178 char *status_buf_end; 178 char *status_buf_end;
179 irq_data idat; /* Data used for IRQ handler */ 179 act2000_irq_data idat; /* Data used for IRQ handler */
180 isdn_if interface; /* Interface to upper layer */ 180 isdn_if interface; /* Interface to upper layer */
181 char regname[35]; /* Name used for request_region */ 181 char regname[35]; /* Name used for request_region */
182} act2000_card; 182} act2000_card;
diff --git a/drivers/isdn/capi/Kconfig b/drivers/isdn/capi/Kconfig
index a168e8a891be..15c3ffd9d860 100644
--- a/drivers/isdn/capi/Kconfig
+++ b/drivers/isdn/capi/Kconfig
@@ -33,21 +33,6 @@ config ISDN_CAPI_CAPI20
33 standardized libcapi20 to access this functionality. You should say 33 standardized libcapi20 to access this functionality. You should say
34 Y/M here. 34 Y/M here.
35 35
36config ISDN_CAPI_CAPIFS_BOOL
37 bool "CAPI2.0 filesystem support (DEPRECATED)"
38 depends on ISDN_CAPI_MIDDLEWARE && ISDN_CAPI_CAPI20
39 help
40 This option provides a special file system, similar to /dev/pts with
41 device nodes for the special ttys established by using the
42 middleware extension above.
43 You no longer need this, udev fully replaces it. This feature is
44 scheduled for removal.
45
46config ISDN_CAPI_CAPIFS
47 tristate
48 depends on ISDN_CAPI_CAPIFS_BOOL
49 default ISDN_CAPI_CAPI20
50
51config ISDN_CAPI_CAPIDRV 36config ISDN_CAPI_CAPIDRV
52 tristate "CAPI2.0 capidrv interface support" 37 tristate "CAPI2.0 capidrv interface support"
53 depends on ISDN_I4L 38 depends on ISDN_I4L
diff --git a/drivers/isdn/capi/Makefile b/drivers/isdn/capi/Makefile
index 57123e3e4978..4d5b4b71db1e 100644
--- a/drivers/isdn/capi/Makefile
+++ b/drivers/isdn/capi/Makefile
@@ -7,7 +7,6 @@
7obj-$(CONFIG_ISDN_CAPI) += kernelcapi.o 7obj-$(CONFIG_ISDN_CAPI) += kernelcapi.o
8obj-$(CONFIG_ISDN_CAPI_CAPI20) += capi.o 8obj-$(CONFIG_ISDN_CAPI_CAPI20) += capi.o
9obj-$(CONFIG_ISDN_CAPI_CAPIDRV) += capidrv.o 9obj-$(CONFIG_ISDN_CAPI_CAPIDRV) += capidrv.o
10obj-$(CONFIG_ISDN_CAPI_CAPIFS) += capifs.o
11 10
12# Multipart objects. 11# Multipart objects.
13 12
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index f80a7c48a35f..e44933d58790 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -38,15 +38,10 @@
38#include <linux/isdn/capiutil.h> 38#include <linux/isdn/capiutil.h>
39#include <linux/isdn/capicmd.h> 39#include <linux/isdn/capicmd.h>
40 40
41#include "capifs.h"
42
43MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface"); 41MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface");
44MODULE_AUTHOR("Carsten Paeth"); 42MODULE_AUTHOR("Carsten Paeth");
45MODULE_LICENSE("GPL"); 43MODULE_LICENSE("GPL");
46 44
47#undef _DEBUG_TTYFUNCS /* call to tty_driver */
48#undef _DEBUG_DATAFLOW /* data flow */
49
50/* -------- driver information -------------------------------------- */ 45/* -------- driver information -------------------------------------- */
51 46
52static DEFINE_MUTEX(capi_mutex); 47static DEFINE_MUTEX(capi_mutex);
@@ -85,7 +80,6 @@ struct capiminor {
85 struct kref kref; 80 struct kref kref;
86 81
87 unsigned int minor; 82 unsigned int minor;
88 struct dentry *capifs_dentry;
89 83
90 struct capi20_appl *ap; 84 struct capi20_appl *ap;
91 u32 ncci; 85 u32 ncci;
@@ -300,17 +294,8 @@ static void capiminor_free(struct capiminor *mp)
300 294
301static void capincci_alloc_minor(struct capidev *cdev, struct capincci *np) 295static void capincci_alloc_minor(struct capidev *cdev, struct capincci *np)
302{ 296{
303 struct capiminor *mp; 297 if (cdev->userflags & CAPIFLAG_HIGHJACKING)
304 dev_t device; 298 np->minorp = capiminor_alloc(&cdev->ap, np->ncci);
305
306 if (!(cdev->userflags & CAPIFLAG_HIGHJACKING))
307 return;
308
309 mp = np->minorp = capiminor_alloc(&cdev->ap, np->ncci);
310 if (mp) {
311 device = MKDEV(capinc_tty_driver->major, mp->minor);
312 mp->capifs_dentry = capifs_new_ncci(mp->minor, device);
313 }
314} 299}
315 300
316static void capincci_free_minor(struct capincci *np) 301static void capincci_free_minor(struct capincci *np)
@@ -319,8 +304,6 @@ static void capincci_free_minor(struct capincci *np)
319 struct tty_struct *tty; 304 struct tty_struct *tty;
320 305
321 if (mp) { 306 if (mp) {
322 capifs_free_ncci(mp->capifs_dentry);
323
324 tty = tty_port_tty_get(&mp->port); 307 tty = tty_port_tty_get(&mp->port);
325 if (tty) { 308 if (tty) {
326 tty_vhangup(tty); 309 tty_vhangup(tty);
@@ -432,9 +415,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
432 415
433 tty = tty_port_tty_get(&mp->port); 416 tty = tty_port_tty_get(&mp->port);
434 if (!tty) { 417 if (!tty) {
435#ifdef _DEBUG_DATAFLOW 418 pr_debug("capi: currently no receiver\n");
436 printk(KERN_DEBUG "capi: currently no receiver\n");
437#endif
438 return -1; 419 return -1;
439 } 420 }
440 421
@@ -447,23 +428,17 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
447 } 428 }
448 429
449 if (ld->ops->receive_buf == NULL) { 430 if (ld->ops->receive_buf == NULL) {
450#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) 431 pr_debug("capi: ldisc has no receive_buf function\n");
451 printk(KERN_DEBUG "capi: ldisc has no receive_buf function\n");
452#endif
453 /* fatal error, do not requeue */ 432 /* fatal error, do not requeue */
454 goto free_skb; 433 goto free_skb;
455 } 434 }
456 if (mp->ttyinstop) { 435 if (mp->ttyinstop) {
457#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) 436 pr_debug("capi: recv tty throttled\n");
458 printk(KERN_DEBUG "capi: recv tty throttled\n");
459#endif
460 goto deref_ldisc; 437 goto deref_ldisc;
461 } 438 }
462 439
463 if (tty->receive_room < datalen) { 440 if (tty->receive_room < datalen) {
464#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) 441 pr_debug("capi: no room in tty\n");
465 printk(KERN_DEBUG "capi: no room in tty\n");
466#endif
467 goto deref_ldisc; 442 goto deref_ldisc;
468 } 443 }
469 444
@@ -479,10 +454,8 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
479 454
480 if (errcode == CAPI_NOERROR) { 455 if (errcode == CAPI_NOERROR) {
481 skb_pull(skb, CAPIMSG_LEN(skb->data)); 456 skb_pull(skb, CAPIMSG_LEN(skb->data));
482#ifdef _DEBUG_DATAFLOW 457 pr_debug("capi: DATA_B3_RESP %u len=%d => ldisc\n",
483 printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ldisc\n", 458 datahandle, skb->len);
484 datahandle, skb->len);
485#endif
486 ld->ops->receive_buf(tty, skb->data, NULL, skb->len); 459 ld->ops->receive_buf(tty, skb->data, NULL, skb->len);
487 } else { 460 } else {
488 printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n", 461 printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n",
@@ -529,9 +502,7 @@ static void handle_minor_send(struct capiminor *mp)
529 return; 502 return;
530 503
531 if (mp->ttyoutstop) { 504 if (mp->ttyoutstop) {
532#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) 505 pr_debug("capi: send: tty stopped\n");
533 printk(KERN_DEBUG "capi: send: tty stopped\n");
534#endif
535 tty_kref_put(tty); 506 tty_kref_put(tty);
536 return; 507 return;
537 } 508 }
@@ -573,10 +544,8 @@ static void handle_minor_send(struct capiminor *mp)
573 } 544 }
574 errcode = capi20_put_message(mp->ap, skb); 545 errcode = capi20_put_message(mp->ap, skb);
575 if (errcode == CAPI_NOERROR) { 546 if (errcode == CAPI_NOERROR) {
576#ifdef _DEBUG_DATAFLOW 547 pr_debug("capi: DATA_B3_REQ %u len=%u\n",
577 printk(KERN_DEBUG "capi: DATA_B3_REQ %u len=%u\n", 548 datahandle, len);
578 datahandle, len);
579#endif
580 continue; 549 continue;
581 } 550 }
582 capiminor_del_ack(mp, datahandle); 551 capiminor_del_ack(mp, datahandle);
@@ -650,10 +619,8 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
650 } 619 }
651 if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) { 620 if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) {
652 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+4+2); 621 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+4+2);
653#ifdef _DEBUG_DATAFLOW 622 pr_debug("capi_signal: DATA_B3_IND %u len=%d\n",
654 printk(KERN_DEBUG "capi_signal: DATA_B3_IND %u len=%d\n", 623 datahandle, skb->len-CAPIMSG_LEN(skb->data));
655 datahandle, skb->len-CAPIMSG_LEN(skb->data));
656#endif
657 skb_queue_tail(&mp->inqueue, skb); 624 skb_queue_tail(&mp->inqueue, skb);
658 625
659 handle_minor_recv(mp); 626 handle_minor_recv(mp);
@@ -661,11 +628,9 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
661 } else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) { 628 } else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) {
662 629
663 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4); 630 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4);
664#ifdef _DEBUG_DATAFLOW 631 pr_debug("capi_signal: DATA_B3_CONF %u 0x%x\n",
665 printk(KERN_DEBUG "capi_signal: DATA_B3_CONF %u 0x%x\n", 632 datahandle,
666 datahandle, 633 CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2));
667 CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2));
668#endif
669 kfree_skb(skb); 634 kfree_skb(skb);
670 capiminor_del_ack(mp, datahandle); 635 capiminor_del_ack(mp, datahandle);
671 tty = tty_port_tty_get(&mp->port); 636 tty = tty_port_tty_get(&mp->port);
@@ -1095,9 +1060,7 @@ static int capinc_tty_write(struct tty_struct *tty,
1095 struct capiminor *mp = tty->driver_data; 1060 struct capiminor *mp = tty->driver_data;
1096 struct sk_buff *skb; 1061 struct sk_buff *skb;
1097 1062
1098#ifdef _DEBUG_TTYFUNCS 1063 pr_debug("capinc_tty_write(count=%d)\n", count);
1099 printk(KERN_DEBUG "capinc_tty_write(count=%d)\n", count);
1100#endif
1101 1064
1102 spin_lock_bh(&mp->outlock); 1065 spin_lock_bh(&mp->outlock);
1103 skb = mp->outskb; 1066 skb = mp->outskb;
@@ -1133,9 +1096,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
1133 struct sk_buff *skb; 1096 struct sk_buff *skb;
1134 int ret = 1; 1097 int ret = 1;
1135 1098
1136#ifdef _DEBUG_TTYFUNCS 1099 pr_debug("capinc_put_char(%u)\n", ch);
1137 printk(KERN_DEBUG "capinc_put_char(%u)\n", ch);
1138#endif
1139 1100
1140 spin_lock_bh(&mp->outlock); 1101 spin_lock_bh(&mp->outlock);
1141 skb = mp->outskb; 1102 skb = mp->outskb;
@@ -1174,9 +1135,7 @@ static void capinc_tty_flush_chars(struct tty_struct *tty)
1174 struct capiminor *mp = tty->driver_data; 1135 struct capiminor *mp = tty->driver_data;
1175 struct sk_buff *skb; 1136 struct sk_buff *skb;
1176 1137
1177#ifdef _DEBUG_TTYFUNCS 1138 pr_debug("capinc_tty_flush_chars\n");
1178 printk(KERN_DEBUG "capinc_tty_flush_chars\n");
1179#endif
1180 1139
1181 spin_lock_bh(&mp->outlock); 1140 spin_lock_bh(&mp->outlock);
1182 skb = mp->outskb; 1141 skb = mp->outskb;
@@ -1200,9 +1159,7 @@ static int capinc_tty_write_room(struct tty_struct *tty)
1200 1159
1201 room = CAPINC_MAX_SENDQUEUE-skb_queue_len(&mp->outqueue); 1160 room = CAPINC_MAX_SENDQUEUE-skb_queue_len(&mp->outqueue);
1202 room *= CAPI_MAX_BLKSIZE; 1161 room *= CAPI_MAX_BLKSIZE;
1203#ifdef _DEBUG_TTYFUNCS 1162 pr_debug("capinc_tty_write_room = %d\n", room);
1204 printk(KERN_DEBUG "capinc_tty_write_room = %d\n", room);
1205#endif
1206 return room; 1163 return room;
1207} 1164}
1208 1165
@@ -1210,40 +1167,28 @@ static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
1210{ 1167{
1211 struct capiminor *mp = tty->driver_data; 1168 struct capiminor *mp = tty->driver_data;
1212 1169
1213#ifdef _DEBUG_TTYFUNCS 1170 pr_debug("capinc_tty_chars_in_buffer = %d nack=%d sq=%d rq=%d\n",
1214 printk(KERN_DEBUG "capinc_tty_chars_in_buffer = %d nack=%d sq=%d rq=%d\n", 1171 mp->outbytes, mp->nack,
1215 mp->outbytes, mp->nack, 1172 skb_queue_len(&mp->outqueue),
1216 skb_queue_len(&mp->outqueue), 1173 skb_queue_len(&mp->inqueue));
1217 skb_queue_len(&mp->inqueue));
1218#endif
1219 return mp->outbytes; 1174 return mp->outbytes;
1220} 1175}
1221 1176
1222static int capinc_tty_ioctl(struct tty_struct *tty, struct file * file, 1177static int capinc_tty_ioctl(struct tty_struct *tty,
1223 unsigned int cmd, unsigned long arg) 1178 unsigned int cmd, unsigned long arg)
1224{ 1179{
1225 int error = 0; 1180 return -ENOIOCTLCMD;
1226 switch (cmd) {
1227 default:
1228 error = n_tty_ioctl_helper(tty, file, cmd, arg);
1229 break;
1230 }
1231 return error;
1232} 1181}
1233 1182
1234static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old) 1183static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old)
1235{ 1184{
1236#ifdef _DEBUG_TTYFUNCS 1185 pr_debug("capinc_tty_set_termios\n");
1237 printk(KERN_DEBUG "capinc_tty_set_termios\n");
1238#endif
1239} 1186}
1240 1187
1241static void capinc_tty_throttle(struct tty_struct *tty) 1188static void capinc_tty_throttle(struct tty_struct *tty)
1242{ 1189{
1243 struct capiminor *mp = tty->driver_data; 1190 struct capiminor *mp = tty->driver_data;
1244#ifdef _DEBUG_TTYFUNCS 1191 pr_debug("capinc_tty_throttle\n");
1245 printk(KERN_DEBUG "capinc_tty_throttle\n");
1246#endif
1247 mp->ttyinstop = 1; 1192 mp->ttyinstop = 1;
1248} 1193}
1249 1194
@@ -1251,9 +1196,7 @@ static void capinc_tty_unthrottle(struct tty_struct *tty)
1251{ 1196{
1252 struct capiminor *mp = tty->driver_data; 1197 struct capiminor *mp = tty->driver_data;
1253 1198
1254#ifdef _DEBUG_TTYFUNCS 1199 pr_debug("capinc_tty_unthrottle\n");
1255 printk(KERN_DEBUG "capinc_tty_unthrottle\n");
1256#endif
1257 mp->ttyinstop = 0; 1200 mp->ttyinstop = 0;
1258 handle_minor_recv(mp); 1201 handle_minor_recv(mp);
1259} 1202}
@@ -1262,9 +1205,7 @@ static void capinc_tty_stop(struct tty_struct *tty)
1262{ 1205{
1263 struct capiminor *mp = tty->driver_data; 1206 struct capiminor *mp = tty->driver_data;
1264 1207
1265#ifdef _DEBUG_TTYFUNCS 1208 pr_debug("capinc_tty_stop\n");
1266 printk(KERN_DEBUG "capinc_tty_stop\n");
1267#endif
1268 mp->ttyoutstop = 1; 1209 mp->ttyoutstop = 1;
1269} 1210}
1270 1211
@@ -1272,9 +1213,7 @@ static void capinc_tty_start(struct tty_struct *tty)
1272{ 1213{
1273 struct capiminor *mp = tty->driver_data; 1214 struct capiminor *mp = tty->driver_data;
1274 1215
1275#ifdef _DEBUG_TTYFUNCS 1216 pr_debug("capinc_tty_start\n");
1276 printk(KERN_DEBUG "capinc_tty_start\n");
1277#endif
1278 mp->ttyoutstop = 0; 1217 mp->ttyoutstop = 0;
1279 handle_minor_send(mp); 1218 handle_minor_send(mp);
1280} 1219}
@@ -1283,39 +1222,29 @@ static void capinc_tty_hangup(struct tty_struct *tty)
1283{ 1222{
1284 struct capiminor *mp = tty->driver_data; 1223 struct capiminor *mp = tty->driver_data;
1285 1224
1286#ifdef _DEBUG_TTYFUNCS 1225 pr_debug("capinc_tty_hangup\n");
1287 printk(KERN_DEBUG "capinc_tty_hangup\n");
1288#endif
1289 tty_port_hangup(&mp->port); 1226 tty_port_hangup(&mp->port);
1290} 1227}
1291 1228
1292static int capinc_tty_break_ctl(struct tty_struct *tty, int state) 1229static int capinc_tty_break_ctl(struct tty_struct *tty, int state)
1293{ 1230{
1294#ifdef _DEBUG_TTYFUNCS 1231 pr_debug("capinc_tty_break_ctl(%d)\n", state);
1295 printk(KERN_DEBUG "capinc_tty_break_ctl(%d)\n", state);
1296#endif
1297 return 0; 1232 return 0;
1298} 1233}
1299 1234
1300static void capinc_tty_flush_buffer(struct tty_struct *tty) 1235static void capinc_tty_flush_buffer(struct tty_struct *tty)
1301{ 1236{
1302#ifdef _DEBUG_TTYFUNCS 1237 pr_debug("capinc_tty_flush_buffer\n");
1303 printk(KERN_DEBUG "capinc_tty_flush_buffer\n");
1304#endif
1305} 1238}
1306 1239
1307static void capinc_tty_set_ldisc(struct tty_struct *tty) 1240static void capinc_tty_set_ldisc(struct tty_struct *tty)
1308{ 1241{
1309#ifdef _DEBUG_TTYFUNCS 1242 pr_debug("capinc_tty_set_ldisc\n");
1310 printk(KERN_DEBUG "capinc_tty_set_ldisc\n");
1311#endif
1312} 1243}
1313 1244
1314static void capinc_tty_send_xchar(struct tty_struct *tty, char ch) 1245static void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
1315{ 1246{
1316#ifdef _DEBUG_TTYFUNCS 1247 pr_debug("capinc_tty_send_xchar(%d)\n", ch);
1317 printk(KERN_DEBUG "capinc_tty_send_xchar(%d)\n", ch);
1318#endif
1319} 1248}
1320 1249
1321static const struct tty_operations capinc_ops = { 1250static const struct tty_operations capinc_ops = {
@@ -1520,10 +1449,8 @@ static int __init capi_init(void)
1520 1449
1521 proc_init(); 1450 proc_init();
1522 1451
1523#if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE) 1452#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1524 compileinfo = " (middleware+capifs)"; 1453 compileinfo = " (middleware)";
1525#elif defined(CONFIG_ISDN_CAPI_MIDDLEWARE)
1526 compileinfo = " (no capifs)";
1527#else 1454#else
1528 compileinfo = " (no middleware)"; 1455 compileinfo = " (no middleware)";
1529#endif 1456#endif
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index 2978bdaa6b88..92607ed25e2e 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -1515,8 +1515,13 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep)
1515 while (*s) { 1515 while (*s) {
1516 int digit1 = 0; 1516 int digit1 = 0;
1517 int digit2 = 0; 1517 int digit2 = 0;
1518 if (!isdigit(*s)) return -3; 1518 char *endp;
1519 while (isdigit(*s)) { digit1 = digit1*10 + (*s - '0'); s++; } 1519
1520 digit1 = simple_strtoul(s, &endp, 10);
1521 if (s == endp)
1522 return -3;
1523 s = endp;
1524
1520 if (digit1 <= 0 || digit1 > 30) return -4; 1525 if (digit1 <= 0 || digit1 > 30) return -4;
1521 if (*s == 0 || *s == ',' || *s == ' ') { 1526 if (*s == 0 || *s == ',' || *s == ' ') {
1522 bmask |= (1 << digit1); 1527 bmask |= (1 << digit1);
@@ -1526,8 +1531,12 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep)
1526 } 1531 }
1527 if (*s != '-') return -5; 1532 if (*s != '-') return -5;
1528 s++; 1533 s++;
1529 if (!isdigit(*s)) return -3; 1534
1530 while (isdigit(*s)) { digit2 = digit2*10 + (*s - '0'); s++; } 1535 digit2 = simple_strtoul(s, &endp, 10);
1536 if (s == endp)
1537 return -3;
1538 s = endp;
1539
1531 if (digit2 <= 0 || digit2 > 30) return -4; 1540 if (digit2 <= 0 || digit2 > 30) return -4;
1532 if (*s == 0 || *s == ',' || *s == ' ') { 1541 if (*s == 0 || *s == ',' || *s == ' ') {
1533 if (digit1 > digit2) 1542 if (digit1 > digit2)
@@ -2288,6 +2297,7 @@ static int __init capidrv_init(void)
2288 2297
2289 errcode = capi20_get_profile(0, &profile); 2298 errcode = capi20_get_profile(0, &profile);
2290 if (errcode != CAPI_NOERROR) { 2299 if (errcode != CAPI_NOERROR) {
2300 unregister_capictr_notifier(&capictr_nb);
2291 capi20_release(&global.ap); 2301 capi20_release(&global.ap);
2292 return -EIO; 2302 return -EIO;
2293 } 2303 }
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c
deleted file mode 100644
index 2b83850997c3..000000000000
--- a/drivers/isdn/capi/capifs.c
+++ /dev/null
@@ -1,239 +0,0 @@
1/* $Id: capifs.c,v 1.1.2.3 2004/01/16 21:09:26 keil Exp $
2 *
3 * Copyright 2000 by Carsten Paeth <calle@calle.de>
4 *
5 * Heavily based on devpts filesystem from H. Peter Anvin
6 *
7 * This software may be used and distributed according to the terms
8 * of the GNU General Public License, incorporated herein by reference.
9 *
10 */
11
12#include <linux/fs.h>
13#include <linux/mount.h>
14#include <linux/slab.h>
15#include <linux/namei.h>
16#include <linux/module.h>
17#include <linux/init.h>
18#include <linux/ctype.h>
19#include <linux/sched.h> /* current */
20
21#include "capifs.h"
22
23MODULE_DESCRIPTION("CAPI4Linux: /dev/capi/ filesystem");
24MODULE_AUTHOR("Carsten Paeth");
25MODULE_LICENSE("GPL");
26
27/* ------------------------------------------------------------------ */
28
29#define CAPIFS_SUPER_MAGIC (('C'<<8)|'N')
30
31static struct vfsmount *capifs_mnt;
32static int capifs_mnt_count;
33
34static struct {
35 int setuid;
36 int setgid;
37 uid_t uid;
38 gid_t gid;
39 umode_t mode;
40} config = {.mode = 0600};
41
42/* ------------------------------------------------------------------ */
43
44static int capifs_remount(struct super_block *s, int *flags, char *data)
45{
46 int setuid = 0;
47 int setgid = 0;
48 uid_t uid = 0;
49 gid_t gid = 0;
50 umode_t mode = 0600;
51 char *this_char;
52 char *new_opt = kstrdup(data, GFP_KERNEL);
53
54 this_char = NULL;
55 while ((this_char = strsep(&data, ",")) != NULL) {
56 int n;
57 char dummy;
58 if (!*this_char)
59 continue;
60 if (sscanf(this_char, "uid=%i%c", &n, &dummy) == 1) {
61 setuid = 1;
62 uid = n;
63 } else if (sscanf(this_char, "gid=%i%c", &n, &dummy) == 1) {
64 setgid = 1;
65 gid = n;
66 } else if (sscanf(this_char, "mode=%o%c", &n, &dummy) == 1)
67 mode = n & ~S_IFMT;
68 else {
69 kfree(new_opt);
70 printk("capifs: called with bogus options\n");
71 return -EINVAL;
72 }
73 }
74
75 mutex_lock(&s->s_root->d_inode->i_mutex);
76
77 replace_mount_options(s, new_opt);
78 config.setuid = setuid;
79 config.setgid = setgid;
80 config.uid = uid;
81 config.gid = gid;
82 config.mode = mode;
83
84 mutex_unlock(&s->s_root->d_inode->i_mutex);
85
86 return 0;
87}
88
89static const struct super_operations capifs_sops =
90{
91 .statfs = simple_statfs,
92 .remount_fs = capifs_remount,
93 .show_options = generic_show_options,
94};
95
96
97static int
98capifs_fill_super(struct super_block *s, void *data, int silent)
99{
100 struct inode * inode;
101
102 s->s_blocksize = 1024;
103 s->s_blocksize_bits = 10;
104 s->s_magic = CAPIFS_SUPER_MAGIC;
105 s->s_op = &capifs_sops;
106 s->s_time_gran = 1;
107
108 inode = new_inode(s);
109 if (!inode)
110 goto fail;
111 inode->i_ino = 1;
112 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
113 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
114 inode->i_op = &simple_dir_inode_operations;
115 inode->i_fop = &simple_dir_operations;
116 inode->i_nlink = 2;
117
118 s->s_root = d_alloc_root(inode);
119 if (s->s_root)
120 return 0;
121
122 printk("capifs: get root dentry failed\n");
123 iput(inode);
124fail:
125 return -ENOMEM;
126}
127
128static int capifs_get_sb(struct file_system_type *fs_type,
129 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
130{
131 return get_sb_single(fs_type, flags, data, capifs_fill_super, mnt);
132}
133
134static struct file_system_type capifs_fs_type = {
135 .owner = THIS_MODULE,
136 .name = "capifs",
137 .get_sb = capifs_get_sb,
138 .kill_sb = kill_anon_super,
139};
140
141static struct dentry *new_ncci(unsigned int number, dev_t device)
142{
143 struct super_block *s = capifs_mnt->mnt_sb;
144 struct dentry *root = s->s_root;
145 struct dentry *dentry;
146 struct inode *inode;
147 char name[10];
148 int namelen;
149
150 mutex_lock(&root->d_inode->i_mutex);
151
152 namelen = sprintf(name, "%d", number);
153 dentry = lookup_one_len(name, root, namelen);
154 if (IS_ERR(dentry)) {
155 dentry = NULL;
156 goto unlock_out;
157 }
158
159 if (dentry->d_inode) {
160 dput(dentry);
161 dentry = NULL;
162 goto unlock_out;
163 }
164
165 inode = new_inode(s);
166 if (!inode) {
167 dput(dentry);
168 dentry = NULL;
169 goto unlock_out;
170 }
171
172 /* config contents is protected by root's i_mutex */
173 inode->i_uid = config.setuid ? config.uid : current_fsuid();
174 inode->i_gid = config.setgid ? config.gid : current_fsgid();
175 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
176 inode->i_ino = number + 2;
177 init_special_inode(inode, S_IFCHR|config.mode, device);
178
179 d_instantiate(dentry, inode);
180 dget(dentry);
181
182unlock_out:
183 mutex_unlock(&root->d_inode->i_mutex);
184
185 return dentry;
186}
187
188struct dentry *capifs_new_ncci(unsigned int number, dev_t device)
189{
190 struct dentry *dentry;
191
192 if (simple_pin_fs(&capifs_fs_type, &capifs_mnt, &capifs_mnt_count) < 0)
193 return NULL;
194
195 dentry = new_ncci(number, device);
196 if (!dentry)
197 simple_release_fs(&capifs_mnt, &capifs_mnt_count);
198
199 return dentry;
200}
201
202void capifs_free_ncci(struct dentry *dentry)
203{
204 struct dentry *root = capifs_mnt->mnt_sb->s_root;
205 struct inode *inode;
206
207 if (!dentry)
208 return;
209
210 mutex_lock(&root->d_inode->i_mutex);
211
212 inode = dentry->d_inode;
213 if (inode) {
214 drop_nlink(inode);
215 d_delete(dentry);
216 dput(dentry);
217 }
218 dput(dentry);
219
220 mutex_unlock(&root->d_inode->i_mutex);
221
222 simple_release_fs(&capifs_mnt, &capifs_mnt_count);
223}
224
225static int __init capifs_init(void)
226{
227 return register_filesystem(&capifs_fs_type);
228}
229
230static void __exit capifs_exit(void)
231{
232 unregister_filesystem(&capifs_fs_type);
233}
234
235EXPORT_SYMBOL(capifs_new_ncci);
236EXPORT_SYMBOL(capifs_free_ncci);
237
238module_init(capifs_init);
239module_exit(capifs_exit);
diff --git a/drivers/isdn/capi/capifs.h b/drivers/isdn/capi/capifs.h
deleted file mode 100644
index e193d1189531..000000000000
--- a/drivers/isdn/capi/capifs.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/* $Id: capifs.h,v 1.1.2.2 2004/01/16 21:09:26 keil Exp $
2 *
3 * Copyright 2000 by Carsten Paeth <calle@calle.de>
4 *
5 * This software may be used and distributed according to the terms
6 * of the GNU General Public License, incorporated herein by reference.
7 *
8 */
9
10#include <linux/dcache.h>
11
12#if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
13
14struct dentry *capifs_new_ncci(unsigned int num, dev_t device);
15void capifs_free_ncci(struct dentry *dentry);
16
17#else
18
19static inline struct dentry *capifs_new_ncci(unsigned int num, dev_t device)
20{
21 return NULL;
22}
23
24static inline void capifs_free_ncci(struct dentry *dentry)
25{
26}
27
28#endif
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index b054494df846..2b33b2627fce 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -38,6 +38,7 @@
38#include <linux/rcupdate.h> 38#include <linux/rcupdate.h>
39 39
40static int showcapimsgs = 0; 40static int showcapimsgs = 0;
41static struct workqueue_struct *kcapi_wq;
41 42
42MODULE_DESCRIPTION("CAPI4Linux: kernel CAPI layer"); 43MODULE_DESCRIPTION("CAPI4Linux: kernel CAPI layer");
43MODULE_AUTHOR("Carsten Paeth"); 44MODULE_AUTHOR("Carsten Paeth");
@@ -98,6 +99,16 @@ static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr)
98 return capi_controller[contr - 1]; 99 return capi_controller[contr - 1];
99} 100}
100 101
102static inline struct capi20_appl *__get_capi_appl_by_nr(u16 applid)
103{
104 lockdep_assert_held(&capi_controller_lock);
105
106 if (applid - 1 >= CAPI_MAXAPPL)
107 return NULL;
108
109 return capi_applications[applid - 1];
110}
111
101static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid) 112static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid)
102{ 113{
103 if (applid - 1 >= CAPI_MAXAPPL) 114 if (applid - 1 >= CAPI_MAXAPPL)
@@ -185,10 +196,9 @@ static void notify_up(u32 contr)
185 ctr->state = CAPI_CTR_RUNNING; 196 ctr->state = CAPI_CTR_RUNNING;
186 197
187 for (applid = 1; applid <= CAPI_MAXAPPL; applid++) { 198 for (applid = 1; applid <= CAPI_MAXAPPL; applid++) {
188 ap = get_capi_appl_by_nr(applid); 199 ap = __get_capi_appl_by_nr(applid);
189 if (!ap) 200 if (ap)
190 continue; 201 register_appl(ctr, applid, &ap->rparam);
191 register_appl(ctr, applid, &ap->rparam);
192 } 202 }
193 203
194 wake_up_interruptible_all(&ctr->state_wait_queue); 204 wake_up_interruptible_all(&ctr->state_wait_queue);
@@ -215,7 +225,7 @@ static void ctr_down(struct capi_ctr *ctr, int new_state)
215 memset(ctr->serial, 0, sizeof(ctr->serial)); 225 memset(ctr->serial, 0, sizeof(ctr->serial));
216 226
217 for (applid = 1; applid <= CAPI_MAXAPPL; applid++) { 227 for (applid = 1; applid <= CAPI_MAXAPPL; applid++) {
218 ap = get_capi_appl_by_nr(applid); 228 ap = __get_capi_appl_by_nr(applid);
219 if (ap) 229 if (ap)
220 capi_ctr_put(ctr); 230 capi_ctr_put(ctr);
221 } 231 }
@@ -282,7 +292,7 @@ static int notify_push(unsigned int event_type, u32 controller)
282 event->type = event_type; 292 event->type = event_type;
283 event->controller = controller; 293 event->controller = controller;
284 294
285 schedule_work(&event->work); 295 queue_work(kcapi_wq, &event->work);
286 return 0; 296 return 0;
287} 297}
288 298
@@ -399,7 +409,7 @@ void capi_ctr_handle_message(struct capi_ctr *ctr, u16 appl,
399 goto error; 409 goto error;
400 } 410 }
401 skb_queue_tail(&ap->recv_queue, skb); 411 skb_queue_tail(&ap->recv_queue, skb);
402 schedule_work(&ap->recv_work); 412 queue_work(kcapi_wq, &ap->recv_work);
403 rcu_read_unlock(); 413 rcu_read_unlock();
404 414
405 return; 415 return;
@@ -734,7 +744,7 @@ u16 capi20_release(struct capi20_appl *ap)
734 744
735 mutex_unlock(&capi_controller_lock); 745 mutex_unlock(&capi_controller_lock);
736 746
737 flush_scheduled_work(); 747 flush_workqueue(kcapi_wq);
738 skb_queue_purge(&ap->recv_queue); 748 skb_queue_purge(&ap->recv_queue);
739 749
740 if (showcapimsgs & 1) { 750 if (showcapimsgs & 1) {
@@ -1276,21 +1286,30 @@ static int __init kcapi_init(void)
1276{ 1286{
1277 int err; 1287 int err;
1278 1288
1289 kcapi_wq = alloc_workqueue("kcapi", 0, 0);
1290 if (!kcapi_wq)
1291 return -ENOMEM;
1292
1279 register_capictr_notifier(&capictr_nb); 1293 register_capictr_notifier(&capictr_nb);
1280 1294
1281 err = cdebug_init(); 1295 err = cdebug_init();
1282 if (!err) 1296 if (err) {
1283 kcapi_proc_init(); 1297 unregister_capictr_notifier(&capictr_nb);
1284 return err; 1298 destroy_workqueue(kcapi_wq);
1299 return err;
1300 }
1301
1302 kcapi_proc_init();
1303 return 0;
1285} 1304}
1286 1305
1287static void __exit kcapi_exit(void) 1306static void __exit kcapi_exit(void)
1288{ 1307{
1289 kcapi_proc_exit(); 1308 kcapi_proc_exit();
1290 1309
1291 /* make sure all notifiers are finished */ 1310 unregister_capictr_notifier(&capictr_nb);
1292 flush_scheduled_work();
1293 cdebug_exit(); 1311 cdebug_exit();
1312 destroy_workqueue(kcapi_wq);
1294} 1313}
1295 1314
1296module_init(kcapi_init); 1315module_init(kcapi_init);
diff --git a/drivers/isdn/divert/isdn_divert.c b/drivers/isdn/divert/isdn_divert.c
index 70cf6bac7a5a..48e6d220f62c 100644
--- a/drivers/isdn/divert/isdn_divert.c
+++ b/drivers/isdn/divert/isdn_divert.c
@@ -77,7 +77,7 @@ static void deflect_timer_expire(ulong arg)
77 77
78 case DEFLECT_ALERT: 78 case DEFLECT_ALERT:
79 cs->ics.command = ISDN_CMD_REDIR; /* protocol */ 79 cs->ics.command = ISDN_CMD_REDIR; /* protocol */
80 strcpy(cs->ics.parm.setup.phone,cs->deflect_dest); 80 strlcpy(cs->ics.parm.setup.phone, cs->deflect_dest, sizeof(cs->ics.parm.setup.phone));
81 strcpy(cs->ics.parm.setup.eazmsn,"Testtext delayed"); 81 strcpy(cs->ics.parm.setup.eazmsn,"Testtext delayed");
82 divert_if.ll_cmd(&cs->ics); 82 divert_if.ll_cmd(&cs->ics);
83 spin_lock_irqsave(&divert_lock, flags); 83 spin_lock_irqsave(&divert_lock, flags);
@@ -251,7 +251,7 @@ int deflect_extern_action(u_char cmd, ulong callid, char *to_nr)
251 251
252 case 2: /* redir */ 252 case 2: /* redir */
253 del_timer(&cs->timer); 253 del_timer(&cs->timer);
254 strcpy(cs->ics.parm.setup.phone, to_nr); 254 strlcpy(cs->ics.parm.setup.phone, to_nr, sizeof(cs->ics.parm.setup.phone));
255 strcpy(cs->ics.parm.setup.eazmsn, "Testtext manual"); 255 strcpy(cs->ics.parm.setup.eazmsn, "Testtext manual");
256 ic.command = ISDN_CMD_REDIR; 256 ic.command = ISDN_CMD_REDIR;
257 if ((i = divert_if.ll_cmd(&ic))) 257 if ((i = divert_if.ll_cmd(&ic)))
@@ -480,7 +480,7 @@ static int isdn_divert_icall(isdn_ctrl *ic)
480 if (!cs->timer.expires) 480 if (!cs->timer.expires)
481 { strcpy(ic->parm.setup.eazmsn,"Testtext direct"); 481 { strcpy(ic->parm.setup.eazmsn,"Testtext direct");
482 ic->parm.setup.screen = dv->rule.screen; 482 ic->parm.setup.screen = dv->rule.screen;
483 strcpy(ic->parm.setup.phone,dv->rule.to_nr); 483 strlcpy(ic->parm.setup.phone, dv->rule.to_nr, sizeof(ic->parm.setup.phone));
484 cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */ 484 cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */
485 cs->timer.expires = jiffies + (HZ * AUTODEL_TIME); 485 cs->timer.expires = jiffies + (HZ * AUTODEL_TIME);
486 retval = 5; 486 retval = 5;
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 707d9c94cf9e..3913f47ef86d 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -109,6 +109,9 @@ struct bas_cardstate {
109 109
110 struct urb *urb_int_in; /* URB for interrupt pipe */ 110 struct urb *urb_int_in; /* URB for interrupt pipe */
111 unsigned char *int_in_buf; 111 unsigned char *int_in_buf;
112 struct work_struct int_in_wq; /* for usb_clear_halt() */
113 struct timer_list timer_int_in; /* int read retry delay */
114 int retry_int_in;
112 115
113 spinlock_t lock; /* locks all following */ 116 spinlock_t lock; /* locks all following */
114 int basstate; /* bitmap (BS_*) */ 117 int basstate; /* bitmap (BS_*) */
@@ -169,7 +172,7 @@ static char *get_usb_rcmsg(int rc)
169 case -EAGAIN: 172 case -EAGAIN:
170 return "start frame too early or too much scheduled"; 173 return "start frame too early or too much scheduled";
171 case -EFBIG: 174 case -EFBIG:
172 return "too many isochronous frames requested"; 175 return "too many isoc frames requested";
173 case -EPIPE: 176 case -EPIPE:
174 return "endpoint stalled"; 177 return "endpoint stalled";
175 case -EMSGSIZE: 178 case -EMSGSIZE:
@@ -200,13 +203,13 @@ static char *get_usb_statmsg(int status)
200 case -ENOENT: 203 case -ENOENT:
201 return "unlinked (sync)"; 204 return "unlinked (sync)";
202 case -EINPROGRESS: 205 case -EINPROGRESS:
203 return "pending"; 206 return "URB still pending";
204 case -EPROTO: 207 case -EPROTO:
205 return "bit stuffing error, timeout, or unknown USB error"; 208 return "bitstuff error, timeout, or unknown USB error";
206 case -EILSEQ: 209 case -EILSEQ:
207 return "CRC mismatch, timeout, or unknown USB error"; 210 return "CRC mismatch, timeout, or unknown USB error";
208 case -ETIME: 211 case -ETIME:
209 return "timed out"; 212 return "USB response timeout";
210 case -EPIPE: 213 case -EPIPE:
211 return "endpoint stalled"; 214 return "endpoint stalled";
212 case -ECOMM: 215 case -ECOMM:
@@ -214,15 +217,15 @@ static char *get_usb_statmsg(int status)
214 case -ENOSR: 217 case -ENOSR:
215 return "OUT buffer underrun"; 218 return "OUT buffer underrun";
216 case -EOVERFLOW: 219 case -EOVERFLOW:
217 return "too much data"; 220 return "endpoint babble";
218 case -EREMOTEIO: 221 case -EREMOTEIO:
219 return "short packet detected"; 222 return "short packet";
220 case -ENODEV: 223 case -ENODEV:
221 return "device removed"; 224 return "device removed";
222 case -EXDEV: 225 case -EXDEV:
223 return "partial isochronous transfer"; 226 return "partial isoc transfer";
224 case -EINVAL: 227 case -EINVAL:
225 return "invalid argument"; 228 return "ISO madness";
226 case -ECONNRESET: 229 case -ECONNRESET:
227 return "unlinked (async)"; 230 return "unlinked (async)";
228 case -ESHUTDOWN: 231 case -ESHUTDOWN:
@@ -350,7 +353,7 @@ static inline void error_hangup(struct bc_state *bcs)
350 * reset Gigaset device because of an unrecoverable error 353 * reset Gigaset device because of an unrecoverable error
351 * This function may be called from any context, and takes care of 354 * This function may be called from any context, and takes care of
352 * scheduling the necessary actions for execution outside of interrupt context. 355 * scheduling the necessary actions for execution outside of interrupt context.
353 * cs->lock must not be held. 356 * cs->hw.bas->lock must not be held.
354 * argument: 357 * argument:
355 * controller state structure 358 * controller state structure
356 */ 359 */
@@ -358,7 +361,9 @@ static inline void error_reset(struct cardstate *cs)
358{ 361{
359 /* reset interrupt pipe to recover (ignore errors) */ 362 /* reset interrupt pipe to recover (ignore errors) */
360 update_basstate(cs->hw.bas, BS_RESETTING, 0); 363 update_basstate(cs->hw.bas, BS_RESETTING, 0);
361 req_submit(cs->bcs, HD_RESET_INTERRUPT_PIPE, 0, BAS_TIMEOUT); 364 if (req_submit(cs->bcs, HD_RESET_INTERRUPT_PIPE, 0, BAS_TIMEOUT))
365 /* submission failed, escalate to USB port reset */
366 usb_queue_reset_device(cs->hw.bas->interface);
362} 367}
363 368
364/* check_pending 369/* check_pending
@@ -438,23 +443,27 @@ static void cmd_in_timeout(unsigned long data)
438 return; 443 return;
439 } 444 }
440 445
441 if (ucs->retry_cmd_in++ < BAS_RETRY) { 446 if (ucs->retry_cmd_in++ >= BAS_RETRY) {
442 dev_notice(cs->dev, "control read: timeout, retry %d\n",
443 ucs->retry_cmd_in);
444 rc = atread_submit(cs, BAS_TIMEOUT);
445 if (rc >= 0 || rc == -ENODEV)
446 /* resubmitted or disconnected */
447 /* - bypass regular exit block */
448 return;
449 } else {
450 dev_err(cs->dev, 447 dev_err(cs->dev,
451 "control read: timeout, giving up after %d tries\n", 448 "control read: timeout, giving up after %d tries\n",
452 ucs->retry_cmd_in); 449 ucs->retry_cmd_in);
450 kfree(ucs->rcvbuf);
451 ucs->rcvbuf = NULL;
452 ucs->rcvbuf_size = 0;
453 error_reset(cs);
454 return;
455 }
456
457 gig_dbg(DEBUG_USBREQ, "%s: timeout, retry %d",
458 __func__, ucs->retry_cmd_in);
459 rc = atread_submit(cs, BAS_TIMEOUT);
460 if (rc < 0) {
461 kfree(ucs->rcvbuf);
462 ucs->rcvbuf = NULL;
463 ucs->rcvbuf_size = 0;
464 if (rc != -ENODEV)
465 error_reset(cs);
453 } 466 }
454 kfree(ucs->rcvbuf);
455 ucs->rcvbuf = NULL;
456 ucs->rcvbuf_size = 0;
457 error_reset(cs);
458} 467}
459 468
460/* read_ctrl_callback 469/* read_ctrl_callback
@@ -470,18 +479,11 @@ static void read_ctrl_callback(struct urb *urb)
470 struct cardstate *cs = inbuf->cs; 479 struct cardstate *cs = inbuf->cs;
471 struct bas_cardstate *ucs = cs->hw.bas; 480 struct bas_cardstate *ucs = cs->hw.bas;
472 int status = urb->status; 481 int status = urb->status;
473 int have_data = 0;
474 unsigned numbytes; 482 unsigned numbytes;
475 int rc; 483 int rc;
476 484
477 update_basstate(ucs, 0, BS_ATRDPEND); 485 update_basstate(ucs, 0, BS_ATRDPEND);
478 wake_up(&ucs->waitqueue); 486 wake_up(&ucs->waitqueue);
479
480 if (!ucs->rcvbuf_size) {
481 dev_warn(cs->dev, "%s: no receive in progress\n", __func__);
482 return;
483 }
484
485 del_timer(&ucs->timer_cmd_in); 487 del_timer(&ucs->timer_cmd_in);
486 488
487 switch (status) { 489 switch (status) {
@@ -495,19 +497,10 @@ static void read_ctrl_callback(struct urb *urb)
495 numbytes = ucs->rcvbuf_size; 497 numbytes = ucs->rcvbuf_size;
496 } 498 }
497 499
498 /* copy received bytes to inbuf */ 500 /* copy received bytes to inbuf, notify event layer */
499 have_data = gigaset_fill_inbuf(inbuf, ucs->rcvbuf, numbytes); 501 if (gigaset_fill_inbuf(inbuf, ucs->rcvbuf, numbytes)) {
500 502 gig_dbg(DEBUG_INTR, "%s-->BH", __func__);
501 if (unlikely(numbytes < ucs->rcvbuf_size)) { 503 gigaset_schedule_event(cs);
502 /* incomplete - resubmit for remaining bytes */
503 ucs->rcvbuf_size -= numbytes;
504 ucs->retry_cmd_in = 0;
505 rc = atread_submit(cs, BAS_TIMEOUT);
506 if (rc >= 0 || rc == -ENODEV)
507 /* resubmitted or disconnected */
508 /* - bypass regular exit block */
509 return;
510 error_reset(cs);
511 } 504 }
512 break; 505 break;
513 506
@@ -516,37 +509,32 @@ static void read_ctrl_callback(struct urb *urb)
516 case -EINPROGRESS: /* pending */ 509 case -EINPROGRESS: /* pending */
517 case -ENODEV: /* device removed */ 510 case -ENODEV: /* device removed */
518 case -ESHUTDOWN: /* device shut down */ 511 case -ESHUTDOWN: /* device shut down */
519 /* no action necessary */ 512 /* no further action necessary */
520 gig_dbg(DEBUG_USBREQ, "%s: %s", 513 gig_dbg(DEBUG_USBREQ, "%s: %s",
521 __func__, get_usb_statmsg(status)); 514 __func__, get_usb_statmsg(status));
522 break; 515 break;
523 516
524 default: /* severe trouble */ 517 default: /* other errors: retry */
525 dev_warn(cs->dev, "control read: %s\n",
526 get_usb_statmsg(status));
527 if (ucs->retry_cmd_in++ < BAS_RETRY) { 518 if (ucs->retry_cmd_in++ < BAS_RETRY) {
528 dev_notice(cs->dev, "control read: retry %d\n", 519 gig_dbg(DEBUG_USBREQ, "%s: %s, retry %d", __func__,
529 ucs->retry_cmd_in); 520 get_usb_statmsg(status), ucs->retry_cmd_in);
530 rc = atread_submit(cs, BAS_TIMEOUT); 521 rc = atread_submit(cs, BAS_TIMEOUT);
531 if (rc >= 0 || rc == -ENODEV) 522 if (rc >= 0)
532 /* resubmitted or disconnected */ 523 /* successfully resubmitted, skip freeing */
533 /* - bypass regular exit block */
534 return; 524 return;
535 } else { 525 if (rc == -ENODEV)
536 dev_err(cs->dev, 526 /* disconnect, no further action necessary */
537 "control read: giving up after %d tries\n", 527 break;
538 ucs->retry_cmd_in);
539 } 528 }
529 dev_err(cs->dev, "control read: %s, giving up after %d tries\n",
530 get_usb_statmsg(status), ucs->retry_cmd_in);
540 error_reset(cs); 531 error_reset(cs);
541 } 532 }
542 533
534 /* read finished, free buffer */
543 kfree(ucs->rcvbuf); 535 kfree(ucs->rcvbuf);
544 ucs->rcvbuf = NULL; 536 ucs->rcvbuf = NULL;
545 ucs->rcvbuf_size = 0; 537 ucs->rcvbuf_size = 0;
546 if (have_data) {
547 gig_dbg(DEBUG_INTR, "%s-->BH", __func__);
548 gigaset_schedule_event(cs);
549 }
550} 538}
551 539
552/* atread_submit 540/* atread_submit
@@ -605,14 +593,67 @@ static int atread_submit(struct cardstate *cs, int timeout)
605 593
606 if (timeout > 0) { 594 if (timeout > 0) {
607 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); 595 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout);
608 ucs->timer_cmd_in.expires = jiffies + timeout * HZ / 10; 596 mod_timer(&ucs->timer_cmd_in, jiffies + timeout * HZ / 10);
609 ucs->timer_cmd_in.data = (unsigned long) cs;
610 ucs->timer_cmd_in.function = cmd_in_timeout;
611 add_timer(&ucs->timer_cmd_in);
612 } 597 }
613 return 0; 598 return 0;
614} 599}
615 600
601/* int_in_work
602 * workqueue routine to clear halt on interrupt in endpoint
603 */
604
605static void int_in_work(struct work_struct *work)
606{
607 struct bas_cardstate *ucs =
608 container_of(work, struct bas_cardstate, int_in_wq);
609 struct urb *urb = ucs->urb_int_in;
610 struct cardstate *cs = urb->context;
611 int rc;
612
613 /* clear halt condition */
614 rc = usb_clear_halt(ucs->udev, urb->pipe);
615 gig_dbg(DEBUG_USBREQ, "clear_halt: %s", get_usb_rcmsg(rc));
616 if (rc == 0)
617 /* success, resubmit interrupt read URB */
618 rc = usb_submit_urb(urb, GFP_ATOMIC);
619 if (rc != 0 && rc != -ENODEV) {
620 dev_err(cs->dev, "clear halt failed: %s\n", get_usb_rcmsg(rc));
621 rc = usb_lock_device_for_reset(ucs->udev, ucs->interface);
622 if (rc == 0) {
623 rc = usb_reset_device(ucs->udev);
624 usb_unlock_device(ucs->udev);
625 }
626 }
627 ucs->retry_int_in = 0;
628}
629
630/* int_in_resubmit
631 * timer routine for interrupt read delayed resubmit
632 * argument:
633 * controller state structure
634 */
635static void int_in_resubmit(unsigned long data)
636{
637 struct cardstate *cs = (struct cardstate *) data;
638 struct bas_cardstate *ucs = cs->hw.bas;
639 int rc;
640
641 if (ucs->retry_int_in++ >= BAS_RETRY) {
642 dev_err(cs->dev, "interrupt read: giving up after %d tries\n",
643 ucs->retry_int_in);
644 usb_queue_reset_device(ucs->interface);
645 return;
646 }
647
648 gig_dbg(DEBUG_USBREQ, "%s: retry %d", __func__, ucs->retry_int_in);
649 rc = usb_submit_urb(ucs->urb_int_in, GFP_ATOMIC);
650 if (rc != 0 && rc != -ENODEV) {
651 dev_err(cs->dev, "could not resubmit interrupt URB: %s\n",
652 get_usb_rcmsg(rc));
653 usb_queue_reset_device(ucs->interface);
654 }
655}
656
616/* read_int_callback 657/* read_int_callback
617 * USB completion handler for interrupt pipe input 658 * USB completion handler for interrupt pipe input
618 * called by the USB subsystem in interrupt context 659 * called by the USB subsystem in interrupt context
@@ -633,19 +674,29 @@ static void read_int_callback(struct urb *urb)
633 674
634 switch (status) { 675 switch (status) {
635 case 0: /* success */ 676 case 0: /* success */
677 ucs->retry_int_in = 0;
636 break; 678 break;
679 case -EPIPE: /* endpoint stalled */
680 schedule_work(&ucs->int_in_wq);
681 /* fall through */
637 case -ENOENT: /* cancelled */ 682 case -ENOENT: /* cancelled */
638 case -ECONNRESET: /* cancelled (async) */ 683 case -ECONNRESET: /* cancelled (async) */
639 case -EINPROGRESS: /* pending */ 684 case -EINPROGRESS: /* pending */
640 /* ignore silently */ 685 case -ENODEV: /* device removed */
686 case -ESHUTDOWN: /* device shut down */
687 /* no further action necessary */
641 gig_dbg(DEBUG_USBREQ, "%s: %s", 688 gig_dbg(DEBUG_USBREQ, "%s: %s",
642 __func__, get_usb_statmsg(status)); 689 __func__, get_usb_statmsg(status));
643 return; 690 return;
644 case -ENODEV: /* device removed */ 691 case -EPROTO: /* protocol error or unplug */
645 case -ESHUTDOWN: /* device shut down */ 692 case -EILSEQ:
646 gig_dbg(DEBUG_USBREQ, "%s: device disconnected", __func__); 693 case -ETIME:
694 /* resubmit after delay */
695 gig_dbg(DEBUG_USBREQ, "%s: %s",
696 __func__, get_usb_statmsg(status));
697 mod_timer(&ucs->timer_int_in, jiffies + HZ / 10);
647 return; 698 return;
648 default: /* severe trouble */ 699 default: /* other errors: just resubmit */
649 dev_warn(cs->dev, "interrupt read: %s\n", 700 dev_warn(cs->dev, "interrupt read: %s\n",
650 get_usb_statmsg(status)); 701 get_usb_statmsg(status));
651 goto resubmit; 702 goto resubmit;
@@ -723,6 +774,13 @@ static void read_int_callback(struct urb *urb)
723 break; 774 break;
724 } 775 }
725 spin_lock_irqsave(&cs->lock, flags); 776 spin_lock_irqsave(&cs->lock, flags);
777 if (ucs->basstate & BS_ATRDPEND) {
778 spin_unlock_irqrestore(&cs->lock, flags);
779 dev_warn(cs->dev,
780 "HD_RECEIVEATDATA_ACK(%d) during HD_READ_ATMESSAGE(%d) ignored\n",
781 l, ucs->rcvbuf_size);
782 break;
783 }
726 if (ucs->rcvbuf_size) { 784 if (ucs->rcvbuf_size) {
727 /* throw away previous buffer - we have no queue */ 785 /* throw away previous buffer - we have no queue */
728 dev_err(cs->dev, 786 dev_err(cs->dev,
@@ -735,7 +793,6 @@ static void read_int_callback(struct urb *urb)
735 if (ucs->rcvbuf == NULL) { 793 if (ucs->rcvbuf == NULL) {
736 spin_unlock_irqrestore(&cs->lock, flags); 794 spin_unlock_irqrestore(&cs->lock, flags);
737 dev_err(cs->dev, "out of memory receiving AT data\n"); 795 dev_err(cs->dev, "out of memory receiving AT data\n");
738 error_reset(cs);
739 break; 796 break;
740 } 797 }
741 ucs->rcvbuf_size = l; 798 ucs->rcvbuf_size = l;
@@ -745,13 +802,10 @@ static void read_int_callback(struct urb *urb)
745 kfree(ucs->rcvbuf); 802 kfree(ucs->rcvbuf);
746 ucs->rcvbuf = NULL; 803 ucs->rcvbuf = NULL;
747 ucs->rcvbuf_size = 0; 804 ucs->rcvbuf_size = 0;
748 if (rc != -ENODEV) {
749 spin_unlock_irqrestore(&cs->lock, flags);
750 error_reset(cs);
751 break;
752 }
753 } 805 }
754 spin_unlock_irqrestore(&cs->lock, flags); 806 spin_unlock_irqrestore(&cs->lock, flags);
807 if (rc < 0 && rc != -ENODEV)
808 error_reset(cs);
755 break; 809 break;
756 810
757 case HD_RESET_INTERRUPT_PIPE_ACK: 811 case HD_RESET_INTERRUPT_PIPE_ACK:
@@ -818,6 +872,7 @@ static void read_iso_callback(struct urb *urb)
818 tasklet_hi_schedule(&ubc->rcvd_tasklet); 872 tasklet_hi_schedule(&ubc->rcvd_tasklet);
819 } else { 873 } else {
820 /* tasklet still busy, drop data and resubmit URB */ 874 /* tasklet still busy, drop data and resubmit URB */
875 gig_dbg(DEBUG_ISO, "%s: overrun", __func__);
821 ubc->loststatus = status; 876 ubc->loststatus = status;
822 for (i = 0; i < BAS_NUMFRAMES; i++) { 877 for (i = 0; i < BAS_NUMFRAMES; i++) {
823 ubc->isoinlost += urb->iso_frame_desc[i].actual_length; 878 ubc->isoinlost += urb->iso_frame_desc[i].actual_length;
@@ -833,13 +888,11 @@ static void read_iso_callback(struct urb *urb)
833 urb->dev = bcs->cs->hw.bas->udev; 888 urb->dev = bcs->cs->hw.bas->udev;
834 urb->transfer_flags = URB_ISO_ASAP; 889 urb->transfer_flags = URB_ISO_ASAP;
835 urb->number_of_packets = BAS_NUMFRAMES; 890 urb->number_of_packets = BAS_NUMFRAMES;
836 gig_dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit",
837 __func__);
838 rc = usb_submit_urb(urb, GFP_ATOMIC); 891 rc = usb_submit_urb(urb, GFP_ATOMIC);
839 if (unlikely(rc != 0 && rc != -ENODEV)) { 892 if (unlikely(rc != 0 && rc != -ENODEV)) {
840 dev_err(bcs->cs->dev, 893 dev_err(bcs->cs->dev,
841 "could not resubmit isochronous read " 894 "could not resubmit isoc read URB: %s\n",
842 "URB: %s\n", get_usb_rcmsg(rc)); 895 get_usb_rcmsg(rc));
843 dump_urb(DEBUG_ISO, "isoc read", urb); 896 dump_urb(DEBUG_ISO, "isoc read", urb);
844 error_hangup(bcs); 897 error_hangup(bcs);
845 } 898 }
@@ -1081,7 +1134,7 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
1081 gig_dbg(DEBUG_ISO, "%s: disconnected", __func__); 1134 gig_dbg(DEBUG_ISO, "%s: disconnected", __func__);
1082 else 1135 else
1083 dev_err(ucx->bcs->cs->dev, 1136 dev_err(ucx->bcs->cs->dev,
1084 "could not submit isochronous write URB: %s\n", 1137 "could not submit isoc write URB: %s\n",
1085 get_usb_rcmsg(rc)); 1138 get_usb_rcmsg(rc));
1086 return rc; 1139 return rc;
1087 } 1140 }
@@ -1104,7 +1157,6 @@ static void write_iso_tasklet(unsigned long data)
1104 struct urb *urb; 1157 struct urb *urb;
1105 int status; 1158 int status;
1106 struct usb_iso_packet_descriptor *ifd; 1159 struct usb_iso_packet_descriptor *ifd;
1107 int offset;
1108 unsigned long flags; 1160 unsigned long flags;
1109 int i; 1161 int i;
1110 struct sk_buff *skb; 1162 struct sk_buff *skb;
@@ -1126,7 +1178,7 @@ static void write_iso_tasklet(unsigned long data)
1126 ubc->isooutovfl = NULL; 1178 ubc->isooutovfl = NULL;
1127 spin_unlock_irqrestore(&ubc->isooutlock, flags); 1179 spin_unlock_irqrestore(&ubc->isooutlock, flags);
1128 if (ovfl) { 1180 if (ovfl) {
1129 dev_err(cs->dev, "isochronous write buffer underrun\n"); 1181 dev_err(cs->dev, "isoc write underrun\n");
1130 error_hangup(bcs); 1182 error_hangup(bcs);
1131 break; 1183 break;
1132 } 1184 }
@@ -1151,7 +1203,7 @@ static void write_iso_tasklet(unsigned long data)
1151 if (next) { 1203 if (next) {
1152 /* couldn't put it back */ 1204 /* couldn't put it back */
1153 dev_err(cs->dev, 1205 dev_err(cs->dev,
1154 "losing isochronous write URB\n"); 1206 "losing isoc write URB\n");
1155 error_hangup(bcs); 1207 error_hangup(bcs);
1156 } 1208 }
1157 } 1209 }
@@ -1172,29 +1224,25 @@ static void write_iso_tasklet(unsigned long data)
1172 * successfully sent 1224 * successfully sent
1173 * - all following frames are not sent at all 1225 * - all following frames are not sent at all
1174 */ 1226 */
1175 offset = done->limit; /* default (no error) */
1176 for (i = 0; i < BAS_NUMFRAMES; i++) { 1227 for (i = 0; i < BAS_NUMFRAMES; i++) {
1177 ifd = &urb->iso_frame_desc[i]; 1228 ifd = &urb->iso_frame_desc[i];
1178 if (ifd->status || 1229 if (ifd->status ||
1179 ifd->actual_length != ifd->length) { 1230 ifd->actual_length != ifd->length) {
1180 dev_warn(cs->dev, 1231 dev_warn(cs->dev,
1181 "isochronous write: frame %d: %s, " 1232 "isoc write: frame %d[%d/%d]: %s\n",
1182 "only %d of %d bytes sent\n", 1233 i, ifd->actual_length,
1183 i, get_usb_statmsg(ifd->status), 1234 ifd->length,
1184 ifd->actual_length, ifd->length); 1235 get_usb_statmsg(ifd->status));
1185 offset = (ifd->offset +
1186 ifd->actual_length)
1187 % BAS_OUTBUFSIZE;
1188 break; 1236 break;
1189 } 1237 }
1190 } 1238 }
1191 break; 1239 break;
1192 case -EPIPE: /* stall - probably underrun */ 1240 case -EPIPE: /* stall - probably underrun */
1193 dev_err(cs->dev, "isochronous write stalled\n"); 1241 dev_err(cs->dev, "isoc write: stalled\n");
1194 error_hangup(bcs); 1242 error_hangup(bcs);
1195 break; 1243 break;
1196 default: /* severe trouble */ 1244 default: /* other errors */
1197 dev_warn(cs->dev, "isochronous write: %s\n", 1245 dev_warn(cs->dev, "isoc write: %s\n",
1198 get_usb_statmsg(status)); 1246 get_usb_statmsg(status));
1199 } 1247 }
1200 1248
@@ -1250,6 +1298,7 @@ static void read_iso_tasklet(unsigned long data)
1250 struct cardstate *cs = bcs->cs; 1298 struct cardstate *cs = bcs->cs;
1251 struct urb *urb; 1299 struct urb *urb;
1252 int status; 1300 int status;
1301 struct usb_iso_packet_descriptor *ifd;
1253 char *rcvbuf; 1302 char *rcvbuf;
1254 unsigned long flags; 1303 unsigned long flags;
1255 int totleft, numbytes, offset, frame, rc; 1304 int totleft, numbytes, offset, frame, rc;
@@ -1267,8 +1316,7 @@ static void read_iso_tasklet(unsigned long data)
1267 ubc->isoindone = NULL; 1316 ubc->isoindone = NULL;
1268 if (unlikely(ubc->loststatus != -EINPROGRESS)) { 1317 if (unlikely(ubc->loststatus != -EINPROGRESS)) {
1269 dev_warn(cs->dev, 1318 dev_warn(cs->dev,
1270 "isochronous read overrun, " 1319 "isoc read overrun, URB dropped (status: %s, %d bytes)\n",
1271 "dropped URB with status: %s, %d bytes lost\n",
1272 get_usb_statmsg(ubc->loststatus), 1320 get_usb_statmsg(ubc->loststatus),
1273 ubc->isoinlost); 1321 ubc->isoinlost);
1274 ubc->loststatus = -EINPROGRESS; 1322 ubc->loststatus = -EINPROGRESS;
@@ -1298,11 +1346,11 @@ static void read_iso_tasklet(unsigned long data)
1298 __func__, get_usb_statmsg(status)); 1346 __func__, get_usb_statmsg(status));
1299 continue; /* -> skip */ 1347 continue; /* -> skip */
1300 case -EPIPE: 1348 case -EPIPE:
1301 dev_err(cs->dev, "isochronous read stalled\n"); 1349 dev_err(cs->dev, "isoc read: stalled\n");
1302 error_hangup(bcs); 1350 error_hangup(bcs);
1303 continue; /* -> skip */ 1351 continue; /* -> skip */
1304 default: /* severe trouble */ 1352 default: /* other error */
1305 dev_warn(cs->dev, "isochronous read: %s\n", 1353 dev_warn(cs->dev, "isoc read: %s\n",
1306 get_usb_statmsg(status)); 1354 get_usb_statmsg(status));
1307 goto error; 1355 goto error;
1308 } 1356 }
@@ -1310,40 +1358,52 @@ static void read_iso_tasklet(unsigned long data)
1310 rcvbuf = urb->transfer_buffer; 1358 rcvbuf = urb->transfer_buffer;
1311 totleft = urb->actual_length; 1359 totleft = urb->actual_length;
1312 for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { 1360 for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) {
1313 numbytes = urb->iso_frame_desc[frame].actual_length; 1361 ifd = &urb->iso_frame_desc[frame];
1314 if (unlikely(urb->iso_frame_desc[frame].status)) 1362 numbytes = ifd->actual_length;
1363 switch (ifd->status) {
1364 case 0: /* success */
1365 break;
1366 case -EPROTO: /* protocol error or unplug */
1367 case -EILSEQ:
1368 case -ETIME:
1369 /* probably just disconnected, ignore */
1370 gig_dbg(DEBUG_ISO,
1371 "isoc read: frame %d[%d]: %s\n",
1372 frame, numbytes,
1373 get_usb_statmsg(ifd->status));
1374 break;
1375 default: /* other error */
1376 /* report, assume transferred bytes are ok */
1315 dev_warn(cs->dev, 1377 dev_warn(cs->dev,
1316 "isochronous read: frame %d[%d]: %s\n", 1378 "isoc read: frame %d[%d]: %s\n",
1317 frame, numbytes, 1379 frame, numbytes,
1318 get_usb_statmsg( 1380 get_usb_statmsg(ifd->status));
1319 urb->iso_frame_desc[frame].status)); 1381 }
1320 if (unlikely(numbytes > BAS_MAXFRAME)) 1382 if (unlikely(numbytes > BAS_MAXFRAME))
1321 dev_warn(cs->dev, 1383 dev_warn(cs->dev,
1322 "isochronous read: frame %d: " 1384 "isoc read: frame %d[%d]: %s\n",
1323 "numbytes (%d) > BAS_MAXFRAME\n", 1385 frame, numbytes,
1324 frame, numbytes); 1386 "exceeds max frame size");
1325 if (unlikely(numbytes > totleft)) { 1387 if (unlikely(numbytes > totleft)) {
1326 dev_warn(cs->dev, 1388 dev_warn(cs->dev,
1327 "isochronous read: frame %d: " 1389 "isoc read: frame %d[%d]: %s\n",
1328 "numbytes (%d) > totleft (%d)\n", 1390 frame, numbytes,
1329 frame, numbytes, totleft); 1391 "exceeds total transfer length");
1330 numbytes = totleft; 1392 numbytes = totleft;
1331 } 1393 }
1332 offset = urb->iso_frame_desc[frame].offset; 1394 offset = ifd->offset;
1333 if (unlikely(offset + numbytes > BAS_INBUFSIZE)) { 1395 if (unlikely(offset + numbytes > BAS_INBUFSIZE)) {
1334 dev_warn(cs->dev, 1396 dev_warn(cs->dev,
1335 "isochronous read: frame %d: " 1397 "isoc read: frame %d[%d]: %s\n",
1336 "offset (%d) + numbytes (%d) " 1398 frame, numbytes,
1337 "> BAS_INBUFSIZE\n", 1399 "exceeds end of buffer");
1338 frame, offset, numbytes);
1339 numbytes = BAS_INBUFSIZE - offset; 1400 numbytes = BAS_INBUFSIZE - offset;
1340 } 1401 }
1341 gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs); 1402 gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs);
1342 totleft -= numbytes; 1403 totleft -= numbytes;
1343 } 1404 }
1344 if (unlikely(totleft > 0)) 1405 if (unlikely(totleft > 0))
1345 dev_warn(cs->dev, 1406 dev_warn(cs->dev, "isoc read: %d data bytes missing\n",
1346 "isochronous read: %d data bytes missing\n",
1347 totleft); 1407 totleft);
1348 1408
1349error: 1409error:
@@ -1359,9 +1419,9 @@ error:
1359 rc = usb_submit_urb(urb, GFP_ATOMIC); 1419 rc = usb_submit_urb(urb, GFP_ATOMIC);
1360 if (unlikely(rc != 0 && rc != -ENODEV)) { 1420 if (unlikely(rc != 0 && rc != -ENODEV)) {
1361 dev_err(cs->dev, 1421 dev_err(cs->dev,
1362 "could not resubmit isochronous read URB: %s\n", 1422 "could not resubmit isoc read URB: %s\n",
1363 get_usb_rcmsg(rc)); 1423 get_usb_rcmsg(rc));
1364 dump_urb(DEBUG_ISO, "resubmit iso read", urb); 1424 dump_urb(DEBUG_ISO, "resubmit isoc read", urb);
1365 error_hangup(bcs); 1425 error_hangup(bcs);
1366 } 1426 }
1367 } 1427 }
@@ -1373,12 +1433,12 @@ error:
1373/* req_timeout 1433/* req_timeout
1374 * timeout routine for control output request 1434 * timeout routine for control output request
1375 * argument: 1435 * argument:
1376 * B channel control structure 1436 * controller state structure
1377 */ 1437 */
1378static void req_timeout(unsigned long data) 1438static void req_timeout(unsigned long data)
1379{ 1439{
1380 struct bc_state *bcs = (struct bc_state *) data; 1440 struct cardstate *cs = (struct cardstate *) data;
1381 struct bas_cardstate *ucs = bcs->cs->hw.bas; 1441 struct bas_cardstate *ucs = cs->hw.bas;
1382 int pending; 1442 int pending;
1383 unsigned long flags; 1443 unsigned long flags;
1384 1444
@@ -1395,38 +1455,44 @@ static void req_timeout(unsigned long data)
1395 break; 1455 break;
1396 1456
1397 case HD_OPEN_ATCHANNEL: 1457 case HD_OPEN_ATCHANNEL:
1398 dev_err(bcs->cs->dev, "timeout opening AT channel\n"); 1458 dev_err(cs->dev, "timeout opening AT channel\n");
1399 error_reset(bcs->cs); 1459 error_reset(cs);
1400 break; 1460 break;
1401 1461
1402 case HD_OPEN_B2CHANNEL:
1403 case HD_OPEN_B1CHANNEL: 1462 case HD_OPEN_B1CHANNEL:
1404 dev_err(bcs->cs->dev, "timeout opening channel %d\n", 1463 dev_err(cs->dev, "timeout opening channel 1\n");
1405 bcs->channel + 1); 1464 error_hangup(&cs->bcs[0]);
1406 error_hangup(bcs); 1465 break;
1466
1467 case HD_OPEN_B2CHANNEL:
1468 dev_err(cs->dev, "timeout opening channel 2\n");
1469 error_hangup(&cs->bcs[1]);
1407 break; 1470 break;
1408 1471
1409 case HD_CLOSE_ATCHANNEL: 1472 case HD_CLOSE_ATCHANNEL:
1410 dev_err(bcs->cs->dev, "timeout closing AT channel\n"); 1473 dev_err(cs->dev, "timeout closing AT channel\n");
1411 error_reset(bcs->cs); 1474 error_reset(cs);
1412 break; 1475 break;
1413 1476
1414 case HD_CLOSE_B2CHANNEL:
1415 case HD_CLOSE_B1CHANNEL: 1477 case HD_CLOSE_B1CHANNEL:
1416 dev_err(bcs->cs->dev, "timeout closing channel %d\n", 1478 dev_err(cs->dev, "timeout closing channel 1\n");
1417 bcs->channel + 1); 1479 error_reset(cs);
1418 error_reset(bcs->cs); 1480 break;
1481
1482 case HD_CLOSE_B2CHANNEL:
1483 dev_err(cs->dev, "timeout closing channel 2\n");
1484 error_reset(cs);
1419 break; 1485 break;
1420 1486
1421 case HD_RESET_INTERRUPT_PIPE: 1487 case HD_RESET_INTERRUPT_PIPE:
1422 /* error recovery escalation */ 1488 /* error recovery escalation */
1423 dev_err(bcs->cs->dev, 1489 dev_err(cs->dev,
1424 "reset interrupt pipe timeout, attempting USB reset\n"); 1490 "reset interrupt pipe timeout, attempting USB reset\n");
1425 usb_queue_reset_device(bcs->cs->hw.bas->interface); 1491 usb_queue_reset_device(ucs->interface);
1426 break; 1492 break;
1427 1493
1428 default: 1494 default:
1429 dev_warn(bcs->cs->dev, "request 0x%02x timed out, clearing\n", 1495 dev_warn(cs->dev, "request 0x%02x timed out, clearing\n",
1430 pending); 1496 pending);
1431 } 1497 }
1432 1498
@@ -1557,10 +1623,7 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout)
1557 1623
1558 if (timeout > 0) { 1624 if (timeout > 0) {
1559 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); 1625 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout);
1560 ucs->timer_ctrl.expires = jiffies + timeout * HZ / 10; 1626 mod_timer(&ucs->timer_ctrl, jiffies + timeout * HZ / 10);
1561 ucs->timer_ctrl.data = (unsigned long) bcs;
1562 ucs->timer_ctrl.function = req_timeout;
1563 add_timer(&ucs->timer_ctrl);
1564 } 1627 }
1565 1628
1566 spin_unlock_irqrestore(&ucs->lock, flags); 1629 spin_unlock_irqrestore(&ucs->lock, flags);
@@ -1590,21 +1653,20 @@ static int gigaset_init_bchannel(struct bc_state *bcs)
1590 1653
1591 if (cs->hw.bas->basstate & BS_SUSPEND) { 1654 if (cs->hw.bas->basstate & BS_SUSPEND) {
1592 dev_notice(cs->dev, 1655 dev_notice(cs->dev,
1593 "not starting isochronous I/O, " 1656 "not starting isoc I/O, suspend in progress\n");
1594 "suspend in progress\n");
1595 spin_unlock_irqrestore(&cs->lock, flags); 1657 spin_unlock_irqrestore(&cs->lock, flags);
1596 return -EHOSTUNREACH; 1658 return -EHOSTUNREACH;
1597 } 1659 }
1598 1660
1599 ret = starturbs(bcs); 1661 ret = starturbs(bcs);
1600 if (ret < 0) { 1662 if (ret < 0) {
1663 spin_unlock_irqrestore(&cs->lock, flags);
1601 dev_err(cs->dev, 1664 dev_err(cs->dev,
1602 "could not start isochronous I/O for channel B%d: %s\n", 1665 "could not start isoc I/O for channel B%d: %s\n",
1603 bcs->channel + 1, 1666 bcs->channel + 1,
1604 ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); 1667 ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret));
1605 if (ret != -ENODEV) 1668 if (ret != -ENODEV)
1606 error_hangup(bcs); 1669 error_hangup(bcs);
1607 spin_unlock_irqrestore(&cs->lock, flags);
1608 return ret; 1670 return ret;
1609 } 1671 }
1610 1672
@@ -1614,11 +1676,11 @@ static int gigaset_init_bchannel(struct bc_state *bcs)
1614 dev_err(cs->dev, "could not open channel B%d\n", 1676 dev_err(cs->dev, "could not open channel B%d\n",
1615 bcs->channel + 1); 1677 bcs->channel + 1);
1616 stopurbs(bcs->hw.bas); 1678 stopurbs(bcs->hw.bas);
1617 if (ret != -ENODEV)
1618 error_hangup(bcs);
1619 } 1679 }
1620 1680
1621 spin_unlock_irqrestore(&cs->lock, flags); 1681 spin_unlock_irqrestore(&cs->lock, flags);
1682 if (ret < 0 && ret != -ENODEV)
1683 error_hangup(bcs);
1622 return ret; 1684 return ret;
1623} 1685}
1624 1686
@@ -1826,10 +1888,7 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len)
1826 if (!(update_basstate(ucs, BS_ATTIMER, BS_ATREADY) & BS_ATTIMER)) { 1888 if (!(update_basstate(ucs, BS_ATTIMER, BS_ATREADY) & BS_ATTIMER)) {
1827 gig_dbg(DEBUG_OUTPUT, "setting ATREADY timeout of %d/10 secs", 1889 gig_dbg(DEBUG_OUTPUT, "setting ATREADY timeout of %d/10 secs",
1828 ATRDY_TIMEOUT); 1890 ATRDY_TIMEOUT);
1829 ucs->timer_atrdy.expires = jiffies + ATRDY_TIMEOUT * HZ / 10; 1891 mod_timer(&ucs->timer_atrdy, jiffies + ATRDY_TIMEOUT * HZ / 10);
1830 ucs->timer_atrdy.data = (unsigned long) cs;
1831 ucs->timer_atrdy.function = atrdy_timeout;
1832 add_timer(&ucs->timer_atrdy);
1833 } 1892 }
1834 return 0; 1893 return 0;
1835} 1894}
@@ -1914,6 +1973,28 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
1914 * The next command will reopen the AT channel automatically. 1973 * The next command will reopen the AT channel automatically.
1915 */ 1974 */
1916 if (cb->len == 3 && !memcmp(cb->buf, "+++", 3)) { 1975 if (cb->len == 3 && !memcmp(cb->buf, "+++", 3)) {
1976 /* If an HD_RECEIVEATDATA_ACK message remains unhandled
1977 * because of an error, the base never sends another one.
1978 * The response channel is thus effectively blocked.
1979 * Closing and reopening the AT channel does *not* clear
1980 * this condition.
1981 * As a stopgap measure, submit a zero-length AT read
1982 * before closing the AT channel. This has the undocumented
1983 * effect of triggering a new HD_RECEIVEATDATA_ACK message
1984 * from the base if necessary.
1985 * The subsequent AT channel close then discards any pending
1986 * messages.
1987 */
1988 spin_lock_irqsave(&cs->lock, flags);
1989 if (!(cs->hw.bas->basstate & BS_ATRDPEND)) {
1990 kfree(cs->hw.bas->rcvbuf);
1991 cs->hw.bas->rcvbuf = NULL;
1992 cs->hw.bas->rcvbuf_size = 0;
1993 cs->hw.bas->retry_cmd_in = 0;
1994 atread_submit(cs, 0);
1995 }
1996 spin_unlock_irqrestore(&cs->lock, flags);
1997
1917 rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT); 1998 rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT);
1918 if (cb->wake_tasklet) 1999 if (cb->wake_tasklet)
1919 tasklet_schedule(cb->wake_tasklet); 2000 tasklet_schedule(cb->wake_tasklet);
@@ -2010,7 +2091,7 @@ static int gigaset_freebcshw(struct bc_state *bcs)
2010 2091
2011 /* kill URBs and tasklets before freeing - better safe than sorry */ 2092 /* kill URBs and tasklets before freeing - better safe than sorry */
2012 ubc->running = 0; 2093 ubc->running = 0;
2013 gig_dbg(DEBUG_INIT, "%s: killing iso URBs", __func__); 2094 gig_dbg(DEBUG_INIT, "%s: killing isoc URBs", __func__);
2014 for (i = 0; i < BAS_OUTURBS; ++i) { 2095 for (i = 0; i < BAS_OUTURBS; ++i) {
2015 usb_kill_urb(ubc->isoouturbs[i].urb); 2096 usb_kill_urb(ubc->isoouturbs[i].urb);
2016 usb_free_urb(ubc->isoouturbs[i].urb); 2097 usb_free_urb(ubc->isoouturbs[i].urb);
@@ -2131,10 +2212,12 @@ static int gigaset_initcshw(struct cardstate *cs)
2131 ucs->pending = 0; 2212 ucs->pending = 0;
2132 2213
2133 ucs->basstate = 0; 2214 ucs->basstate = 0;
2134 init_timer(&ucs->timer_ctrl); 2215 setup_timer(&ucs->timer_ctrl, req_timeout, (unsigned long) cs);
2135 init_timer(&ucs->timer_atrdy); 2216 setup_timer(&ucs->timer_atrdy, atrdy_timeout, (unsigned long) cs);
2136 init_timer(&ucs->timer_cmd_in); 2217 setup_timer(&ucs->timer_cmd_in, cmd_in_timeout, (unsigned long) cs);
2218 setup_timer(&ucs->timer_int_in, int_in_resubmit, (unsigned long) cs);
2137 init_waitqueue_head(&ucs->waitqueue); 2219 init_waitqueue_head(&ucs->waitqueue);
2220 INIT_WORK(&ucs->int_in_wq, int_in_work);
2138 2221
2139 return 1; 2222 return 1;
2140} 2223}
@@ -2230,7 +2313,7 @@ static int gigaset_probe(struct usb_interface *interface,
2230 __func__, le16_to_cpu(udev->descriptor.idVendor), 2313 __func__, le16_to_cpu(udev->descriptor.idVendor),
2231 le16_to_cpu(udev->descriptor.idProduct)); 2314 le16_to_cpu(udev->descriptor.idProduct));
2232 2315
2233 /* allocate memory for our device state and intialize it */ 2316 /* allocate memory for our device state and initialize it */
2234 cs = gigaset_initcs(driver, BAS_CHANNELS, 0, 0, cidmode, 2317 cs = gigaset_initcs(driver, BAS_CHANNELS, 0, 0, cidmode,
2235 GIGASET_MODULENAME); 2318 GIGASET_MODULENAME);
2236 if (!cs) 2319 if (!cs)
@@ -2282,6 +2365,7 @@ static int gigaset_probe(struct usb_interface *interface,
2282 get_usb_rcmsg(rc)); 2365 get_usb_rcmsg(rc));
2283 goto error; 2366 goto error;
2284 } 2367 }
2368 ucs->retry_int_in = 0;
2285 2369
2286 /* tell the device that the driver is ready */ 2370 /* tell the device that the driver is ready */
2287 rc = req_submit(cs->bcs, HD_DEVICE_INIT_ACK, 0, 0); 2371 rc = req_submit(cs->bcs, HD_DEVICE_INIT_ACK, 0, 0);
@@ -2334,10 +2418,12 @@ static void gigaset_disconnect(struct usb_interface *interface)
2334 /* stop driver (common part) */ 2418 /* stop driver (common part) */
2335 gigaset_stop(cs); 2419 gigaset_stop(cs);
2336 2420
2337 /* stop timers and URBs, free ressources */ 2421 /* stop delayed work and URBs, free ressources */
2338 del_timer_sync(&ucs->timer_ctrl); 2422 del_timer_sync(&ucs->timer_ctrl);
2339 del_timer_sync(&ucs->timer_atrdy); 2423 del_timer_sync(&ucs->timer_atrdy);
2340 del_timer_sync(&ucs->timer_cmd_in); 2424 del_timer_sync(&ucs->timer_cmd_in);
2425 del_timer_sync(&ucs->timer_int_in);
2426 cancel_work_sync(&ucs->int_in_wq);
2341 freeurbs(cs); 2427 freeurbs(cs);
2342 usb_set_intfdata(interface, NULL); 2428 usb_set_intfdata(interface, NULL);
2343 kfree(ucs->rcvbuf); 2429 kfree(ucs->rcvbuf);
@@ -2400,10 +2486,14 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
2400 /* in case of timeout, proceed anyway */ 2486 /* in case of timeout, proceed anyway */
2401 } 2487 }
2402 2488
2403 /* kill all URBs and timers that might still be pending */ 2489 /* kill all URBs and delayed work that might still be pending */
2404 usb_kill_urb(ucs->urb_ctrl); 2490 usb_kill_urb(ucs->urb_ctrl);
2405 usb_kill_urb(ucs->urb_int_in); 2491 usb_kill_urb(ucs->urb_int_in);
2406 del_timer_sync(&ucs->timer_ctrl); 2492 del_timer_sync(&ucs->timer_ctrl);
2493 del_timer_sync(&ucs->timer_atrdy);
2494 del_timer_sync(&ucs->timer_cmd_in);
2495 del_timer_sync(&ucs->timer_int_in);
2496 cancel_work_sync(&ucs->int_in_wq);
2407 2497
2408 gig_dbg(DEBUG_SUSPEND, "suspend complete"); 2498 gig_dbg(DEBUG_SUSPEND, "suspend complete");
2409 return 0; 2499 return 0;
@@ -2425,6 +2515,7 @@ static int gigaset_resume(struct usb_interface *intf)
2425 get_usb_rcmsg(rc)); 2515 get_usb_rcmsg(rc));
2426 return rc; 2516 return rc;
2427 } 2517 }
2518 ucs->retry_int_in = 0;
2428 2519
2429 /* clear suspend flag to reallow activity */ 2520 /* clear suspend flag to reallow activity */
2430 update_basstate(ucs, 0, BS_SUSPEND); 2521 update_basstate(ucs, 0, BS_SUSPEND);
@@ -2480,7 +2571,7 @@ static int __init bas_gigaset_init(void)
2480{ 2571{
2481 int result; 2572 int result;
2482 2573
2483 /* allocate memory for our driver state and intialize it */ 2574 /* allocate memory for our driver state and initialize it */
2484 driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, 2575 driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
2485 GIGASET_MODULENAME, GIGASET_DEVNAME, 2576 GIGASET_MODULENAME, GIGASET_DEVNAME,
2486 &gigops, THIS_MODULE); 2577 &gigops, THIS_MODULE);
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index bcc174e4f3b1..658e75f18d05 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -1900,6 +1900,7 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif,
1900 if (b3skb == NULL) { 1900 if (b3skb == NULL) {
1901 dev_err(cs->dev, "%s: out of memory\n", __func__); 1901 dev_err(cs->dev, "%s: out of memory\n", __func__);
1902 send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); 1902 send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR);
1903 kfree(b3cmsg);
1903 return; 1904 return;
1904 } 1905 }
1905 capi_cmsg2message(b3cmsg, 1906 capi_cmsg2message(b3cmsg,
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 3ca561eccd9f..db621db67f61 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -1026,32 +1026,6 @@ struct cardstate *gigaset_get_cs_by_id(int id)
1026 return ret; 1026 return ret;
1027} 1027}
1028 1028
1029void gigaset_debugdrivers(void)
1030{
1031 unsigned long flags;
1032 static struct cardstate *cs;
1033 struct gigaset_driver *drv;
1034 unsigned i;
1035
1036 spin_lock_irqsave(&driver_lock, flags);
1037 list_for_each_entry(drv, &drivers, list) {
1038 gig_dbg(DEBUG_DRIVER, "driver %p", drv);
1039 spin_lock(&drv->lock);
1040 for (i = 0; i < drv->minors; ++i) {
1041 gig_dbg(DEBUG_DRIVER, " index %u", i);
1042 cs = drv->cs + i;
1043 gig_dbg(DEBUG_DRIVER, " cardstate %p", cs);
1044 gig_dbg(DEBUG_DRIVER, " flags 0x%02x", cs->flags);
1045 gig_dbg(DEBUG_DRIVER, " minor_index %u",
1046 cs->minor_index);
1047 gig_dbg(DEBUG_DRIVER, " driver %p", cs->driver);
1048 gig_dbg(DEBUG_DRIVER, " i4l id %d", cs->myid);
1049 }
1050 spin_unlock(&drv->lock);
1051 }
1052 spin_unlock_irqrestore(&driver_lock, flags);
1053}
1054
1055static struct cardstate *gigaset_get_cs_by_minor(unsigned minor) 1029static struct cardstate *gigaset_get_cs_by_minor(unsigned minor)
1056{ 1030{
1057 unsigned long flags; 1031 unsigned long flags;
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index a14187605f5e..ba74646cf0e4 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -390,12 +390,12 @@ static const struct zsau_resp_t {
390 */ 390 */
391static int cid_of_response(char *s) 391static int cid_of_response(char *s)
392{ 392{
393 unsigned long cid; 393 int cid;
394 int rc; 394 int rc;
395 395
396 if (s[-1] != ';') 396 if (s[-1] != ';')
397 return 0; /* no CID separator */ 397 return 0; /* no CID separator */
398 rc = strict_strtoul(s, 10, &cid); 398 rc = kstrtoint(s, 10, &cid);
399 if (rc) 399 if (rc)
400 return 0; /* CID not numeric */ 400 return 0; /* CID not numeric */
401 if (cid < 1 || cid > 65535) 401 if (cid < 1 || cid > 65535)
@@ -566,27 +566,19 @@ void gigaset_handle_modem_response(struct cardstate *cs)
566 case RT_ZCAU: 566 case RT_ZCAU:
567 event->parameter = -1; 567 event->parameter = -1;
568 if (curarg + 1 < params) { 568 if (curarg + 1 < params) {
569 unsigned long type, value; 569 u8 type, value;
570
571 i = strict_strtoul(argv[curarg++], 16, &type);
572 j = strict_strtoul(argv[curarg++], 16, &value);
573 570
574 if (i == 0 && type < 256 && 571 i = kstrtou8(argv[curarg++], 16, &type);
575 j == 0 && value < 256) 572 j = kstrtou8(argv[curarg++], 16, &value);
573 if (i == 0 && j == 0)
576 event->parameter = (type << 8) | value; 574 event->parameter = (type << 8) | value;
577 } else 575 } else
578 curarg = params - 1; 576 curarg = params - 1;
579 break; 577 break;
580 case RT_NUMBER: 578 case RT_NUMBER:
581 event->parameter = -1; 579 if (curarg >= params ||
582 if (curarg < params) { 580 kstrtoint(argv[curarg++], 10, &event->parameter))
583 unsigned long res; 581 event->parameter = -1;
584 int rc;
585
586 rc = strict_strtoul(argv[curarg++], 10, &res);
587 if (rc == 0)
588 event->parameter = res;
589 }
590 gig_dbg(DEBUG_EVENT, "parameter==%d", event->parameter); 582 gig_dbg(DEBUG_EVENT, "parameter==%d", event->parameter);
591 break; 583 break;
592 } 584 }
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index a69512fb1195..6dd360734cfd 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -70,7 +70,6 @@ enum debuglevel {
70 DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */ 70 DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */
71 DEBUG_LLDATA = 0x00100, /* sent/received LL data */ 71 DEBUG_LLDATA = 0x00100, /* sent/received LL data */
72 DEBUG_EVENT = 0x00200, /* event processing */ 72 DEBUG_EVENT = 0x00200, /* event processing */
73 DEBUG_DRIVER = 0x00400, /* driver structure */
74 DEBUG_HDLC = 0x00800, /* M10x HDLC processing */ 73 DEBUG_HDLC = 0x00800, /* M10x HDLC processing */
75 DEBUG_CHANNEL = 0x01000, /* channel allocation/deallocation */ 74 DEBUG_CHANNEL = 0x01000, /* channel allocation/deallocation */
76 DEBUG_TRANSCMD = 0x02000, /* AT-COMMANDS+RESPONSES */ 75 DEBUG_TRANSCMD = 0x02000, /* AT-COMMANDS+RESPONSES */
@@ -727,7 +726,7 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
727 726
728/* Deallocate driver structure. */ 727/* Deallocate driver structure. */
729void gigaset_freedriver(struct gigaset_driver *drv); 728void gigaset_freedriver(struct gigaset_driver *drv);
730void gigaset_debugdrivers(void); 729
731struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty); 730struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty);
732struct cardstate *gigaset_get_cs_by_id(int id); 731struct cardstate *gigaset_get_cs_by_id(int id);
733void gigaset_blockdriver(struct gigaset_driver *drv); 732void gigaset_blockdriver(struct gigaset_driver *drv);
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index 34bca37d65b9..9bec8b969964 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -201,8 +201,6 @@ static int command_from_LL(isdn_ctrl *cntrl)
201 int i; 201 int i;
202 size_t l; 202 size_t l;
203 203
204 gigaset_debugdrivers();
205
206 gig_dbg(DEBUG_CMD, "driver: %d, command: %d, arg: 0x%lx", 204 gig_dbg(DEBUG_CMD, "driver: %d, command: %d, arg: 0x%lx",
207 cntrl->driver, cntrl->command, cntrl->arg); 205 cntrl->driver, cntrl->command, cntrl->arg);
208 206
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index bb710d16a526..e35058bcd7b9 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -115,15 +115,15 @@ static int if_config(struct cardstate *cs, int *arg)
115 115
116static int if_open(struct tty_struct *tty, struct file *filp); 116static int if_open(struct tty_struct *tty, struct file *filp);
117static void if_close(struct tty_struct *tty, struct file *filp); 117static void if_close(struct tty_struct *tty, struct file *filp);
118static int if_ioctl(struct tty_struct *tty, struct file *file, 118static int if_ioctl(struct tty_struct *tty,
119 unsigned int cmd, unsigned long arg); 119 unsigned int cmd, unsigned long arg);
120static int if_write_room(struct tty_struct *tty); 120static int if_write_room(struct tty_struct *tty);
121static int if_chars_in_buffer(struct tty_struct *tty); 121static int if_chars_in_buffer(struct tty_struct *tty);
122static void if_throttle(struct tty_struct *tty); 122static void if_throttle(struct tty_struct *tty);
123static void if_unthrottle(struct tty_struct *tty); 123static void if_unthrottle(struct tty_struct *tty);
124static void if_set_termios(struct tty_struct *tty, struct ktermios *old); 124static void if_set_termios(struct tty_struct *tty, struct ktermios *old);
125static int if_tiocmget(struct tty_struct *tty, struct file *file); 125static int if_tiocmget(struct tty_struct *tty);
126static int if_tiocmset(struct tty_struct *tty, struct file *file, 126static int if_tiocmset(struct tty_struct *tty,
127 unsigned int set, unsigned int clear); 127 unsigned int set, unsigned int clear);
128static int if_write(struct tty_struct *tty, 128static int if_write(struct tty_struct *tty,
129 const unsigned char *buf, int count); 129 const unsigned char *buf, int count);
@@ -156,8 +156,10 @@ static int if_open(struct tty_struct *tty, struct file *filp)
156 if (!cs || !try_module_get(cs->driver->owner)) 156 if (!cs || !try_module_get(cs->driver->owner))
157 return -ENODEV; 157 return -ENODEV;
158 158
159 if (mutex_lock_interruptible(&cs->mutex)) 159 if (mutex_lock_interruptible(&cs->mutex)) {
160 module_put(cs->driver->owner);
160 return -ERESTARTSYS; 161 return -ERESTARTSYS;
162 }
161 tty->driver_data = cs; 163 tty->driver_data = cs;
162 164
163 ++cs->open_count; 165 ++cs->open_count;
@@ -205,7 +207,7 @@ static void if_close(struct tty_struct *tty, struct file *filp)
205 module_put(cs->driver->owner); 207 module_put(cs->driver->owner);
206} 208}
207 209
208static int if_ioctl(struct tty_struct *tty, struct file *file, 210static int if_ioctl(struct tty_struct *tty,
209 unsigned int cmd, unsigned long arg) 211 unsigned int cmd, unsigned long arg)
210{ 212{
211 struct cardstate *cs; 213 struct cardstate *cs;
@@ -280,7 +282,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
280 return retval; 282 return retval;
281} 283}
282 284
283static int if_tiocmget(struct tty_struct *tty, struct file *file) 285static int if_tiocmget(struct tty_struct *tty)
284{ 286{
285 struct cardstate *cs; 287 struct cardstate *cs;
286 int retval; 288 int retval;
@@ -303,7 +305,7 @@ static int if_tiocmget(struct tty_struct *tty, struct file *file)
303 return retval; 305 return retval;
304} 306}
305 307
306static int if_tiocmset(struct tty_struct *tty, struct file *file, 308static int if_tiocmset(struct tty_struct *tty,
307 unsigned int set, unsigned int clear) 309 unsigned int set, unsigned int clear)
308{ 310{
309 struct cardstate *cs; 311 struct cardstate *cs;
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index 2dfd346fc889..f39ccdf87a17 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -842,13 +842,14 @@ static inline void trans_receive(unsigned char *src, unsigned count,
842 842
843 if (unlikely(bcs->ignore)) { 843 if (unlikely(bcs->ignore)) {
844 bcs->ignore--; 844 bcs->ignore--;
845 hdlc_flush(bcs);
846 return; 845 return;
847 } 846 }
848 skb = bcs->rx_skb; 847 skb = bcs->rx_skb;
849 if (skb == NULL) 848 if (skb == NULL) {
850 skb = gigaset_new_rx_skb(bcs); 849 skb = gigaset_new_rx_skb(bcs);
851 bcs->hw.bas->goodbytes += skb->len; 850 if (skb == NULL)
851 return;
852 }
852 dobytes = bcs->rx_bufsize - skb->len; 853 dobytes = bcs->rx_bufsize - skb->len;
853 while (count > 0) { 854 while (count > 0) {
854 dst = skb_put(skb, count < dobytes ? count : dobytes); 855 dst = skb_put(skb, count < dobytes ? count : dobytes);
@@ -860,6 +861,7 @@ static inline void trans_receive(unsigned char *src, unsigned count,
860 if (dobytes == 0) { 861 if (dobytes == 0) {
861 dump_bytes(DEBUG_STREAM_DUMP, 862 dump_bytes(DEBUG_STREAM_DUMP,
862 "rcv data", skb->data, skb->len); 863 "rcv data", skb->data, skb->len);
864 bcs->hw.bas->goodbytes += skb->len;
863 gigaset_skb_rcvd(bcs, skb); 865 gigaset_skb_rcvd(bcs, skb);
864 skb = gigaset_new_rx_skb(bcs); 866 skb = gigaset_new_rx_skb(bcs);
865 if (skb == NULL) 867 if (skb == NULL)
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index d151dcbf770d..86a5c4f7775e 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -440,7 +440,7 @@ static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state,
440 if (!set && !clear) 440 if (!set && !clear)
441 return 0; 441 return 0;
442 gig_dbg(DEBUG_IF, "tiocmset set %x clear %x", set, clear); 442 gig_dbg(DEBUG_IF, "tiocmset set %x clear %x", set, clear);
443 return tty->ops->tiocmset(tty, NULL, set, clear); 443 return tty->ops->tiocmset(tty, set, clear);
444} 444}
445 445
446static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag) 446static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag)
@@ -513,7 +513,7 @@ gigaset_tty_open(struct tty_struct *tty)
513 return -ENODEV; 513 return -ENODEV;
514 } 514 }
515 515
516 /* allocate memory for our device state and intialize it */ 516 /* allocate memory for our device state and initialize it */
517 cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME); 517 cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME);
518 if (!cs) 518 if (!cs)
519 goto error; 519 goto error;
@@ -771,7 +771,7 @@ static int __init ser_gigaset_init(void)
771 return rc; 771 return rc;
772 } 772 }
773 773
774 /* allocate memory for our driver state and intialize it */ 774 /* allocate memory for our driver state and initialize it */
775 driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, 775 driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
776 GIGASET_MODULENAME, GIGASET_DEVNAME, 776 GIGASET_MODULENAME, GIGASET_DEVNAME,
777 &ops, THIS_MODULE); 777 &ops, THIS_MODULE);
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index 4a66338f4e7d..5e3300d8a2a5 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -695,7 +695,7 @@ static int gigaset_probe(struct usb_interface *interface,
695 695
696 dev_info(&udev->dev, "%s: Device matched ... !\n", __func__); 696 dev_info(&udev->dev, "%s: Device matched ... !\n", __func__);
697 697
698 /* allocate memory for our device state and intialize it */ 698 /* allocate memory for our device state and initialize it */
699 cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME); 699 cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME);
700 if (!cs) 700 if (!cs)
701 return -ENODEV; 701 return -ENODEV;
@@ -894,7 +894,7 @@ static int __init usb_gigaset_init(void)
894{ 894{
895 int result; 895 int result;
896 896
897 /* allocate memory for our driver state and intialize it */ 897 /* allocate memory for our driver state and initialize it */
898 driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, 898 driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
899 GIGASET_MODULENAME, GIGASET_DEVNAME, 899 GIGASET_MODULENAME, GIGASET_DEVNAME,
900 &ops, THIS_MODULE); 900 &ops, THIS_MODULE);
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 09b1795516f4..61f516f376dc 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -20,7 +20,6 @@
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/system.h> 21#include <asm/system.h>
22 22
23#include <pcmcia/cs.h>
24#include <pcmcia/cistpl.h> 23#include <pcmcia/cistpl.h>
25#include <pcmcia/ciscode.h> 24#include <pcmcia/ciscode.h>
26#include <pcmcia/ds.h> 25#include <pcmcia/ds.h>
@@ -39,87 +38,32 @@ MODULE_LICENSE("GPL");
39 38
40/*====================================================================*/ 39/*====================================================================*/
41 40
42/*
43 The event() function is this driver's Card Services event handler.
44 It will be called by Card Services when an appropriate card status
45 event is received. The config() and release() entry points are
46 used to configure or release a socket, in response to card insertion
47 and ejection events. They are invoked from the skeleton event
48 handler.
49*/
50
51static int avmcs_config(struct pcmcia_device *link); 41static int avmcs_config(struct pcmcia_device *link);
52static void avmcs_release(struct pcmcia_device *link); 42static void avmcs_release(struct pcmcia_device *link);
53
54/*
55 The attach() and detach() entry points are used to create and destroy
56 "instances" of the driver, where each instance represents everything
57 needed to manage one actual PCMCIA card.
58*/
59
60static void avmcs_detach(struct pcmcia_device *p_dev); 43static void avmcs_detach(struct pcmcia_device *p_dev);
61 44
62/*======================================================================
63
64 avmcs_attach() creates an "instance" of the driver, allocating
65 local data structures for one device. The device is registered
66 with Card Services.
67
68 The dev_link structure is initialized, but we don't actually
69 configure the card at this point -- we wait until we receive a
70 card insertion event.
71
72======================================================================*/
73
74static int avmcs_probe(struct pcmcia_device *p_dev) 45static int avmcs_probe(struct pcmcia_device *p_dev)
75{ 46{
76
77 /* The io structure describes IO port mapping */
78 p_dev->resource[0]->end = 16;
79 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
80
81 /* General socket configuration */ 47 /* General socket configuration */
82 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 48 p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
83 p_dev->conf.IntType = INT_MEMORY_AND_IO; 49 p_dev->config_index = 1;
84 p_dev->conf.ConfigIndex = 1; 50 p_dev->config_regs = PRESENT_OPTION;
85 p_dev->conf.Present = PRESENT_OPTION;
86 51
87 return avmcs_config(p_dev); 52 return avmcs_config(p_dev);
88} /* avmcs_attach */ 53} /* avmcs_attach */
89 54
90/*======================================================================
91
92 This deletes a driver "instance". The device is de-registered
93 with Card Services. If it has been released, all local data
94 structures are freed. Otherwise, the structures will be freed
95 when the device is released.
96
97======================================================================*/
98 55
99static void avmcs_detach(struct pcmcia_device *link) 56static void avmcs_detach(struct pcmcia_device *link)
100{ 57{
101 avmcs_release(link); 58 avmcs_release(link);
102} /* avmcs_detach */ 59} /* avmcs_detach */
103 60
104/*====================================================================== 61static int avmcs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
105
106 avmcs_config() is scheduled to run after a CARD_INSERTION event
107 is received, to configure the PCMCIA socket, and to make the
108 ethernet device available to the system.
109
110======================================================================*/
111
112static int avmcs_configcheck(struct pcmcia_device *p_dev,
113 cistpl_cftable_entry_t *cf,
114 cistpl_cftable_entry_t *dflt,
115 unsigned int vcc,
116 void *priv_data)
117{ 62{
118 if (cf->io.nwin <= 0) 63 p_dev->resource[0]->end = 16;
119 return -ENODEV; 64 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
65 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
120 66
121 p_dev->resource[0]->start = cf->io.win[0].base;
122 p_dev->resource[0]->end = cf->io.win[0].len;
123 return pcmcia_request_io(p_dev); 67 return pcmcia_request_io(p_dev);
124} 68}
125 69
@@ -150,7 +94,7 @@ static int avmcs_config(struct pcmcia_device *link)
150 /* 94 /*
151 * configure the PCMCIA socket 95 * configure the PCMCIA socket
152 */ 96 */
153 i = pcmcia_request_configuration(link, &link->conf); 97 i = pcmcia_enable_device(link);
154 if (i != 0) { 98 if (i != 0) {
155 pcmcia_disable_device(link); 99 pcmcia_disable_device(link);
156 break; 100 break;
@@ -197,13 +141,6 @@ static int avmcs_config(struct pcmcia_device *link)
197 141
198} /* avmcs_config */ 142} /* avmcs_config */
199 143
200/*======================================================================
201
202 After a card is removed, avmcs_release() will unregister the net
203 device, and release the PCMCIA configuration. If the device is
204 still open, this will be postponed until it is closed.
205
206======================================================================*/
207 144
208static void avmcs_release(struct pcmcia_device *link) 145static void avmcs_release(struct pcmcia_device *link)
209{ 146{
@@ -212,7 +149,7 @@ static void avmcs_release(struct pcmcia_device *link)
212} /* avmcs_release */ 149} /* avmcs_release */
213 150
214 151
215static struct pcmcia_device_id avmcs_ids[] = { 152static const struct pcmcia_device_id avmcs_ids[] = {
216 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335), 153 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335),
217 PCMCIA_DEVICE_PROD_ID12("AVM", "Mobile ISDN-Controller M1", 0x95d42008, 0x81e10430), 154 PCMCIA_DEVICE_PROD_ID12("AVM", "Mobile ISDN-Controller M1", 0x95d42008, 0x81e10430),
218 PCMCIA_DEVICE_PROD_ID12("AVM", "Mobile ISDN-Controller M2", 0x95d42008, 0x18e8558a), 155 PCMCIA_DEVICE_PROD_ID12("AVM", "Mobile ISDN-Controller M2", 0x95d42008, 0x18e8558a),
@@ -222,9 +159,7 @@ MODULE_DEVICE_TABLE(pcmcia, avmcs_ids);
222 159
223static struct pcmcia_driver avmcs_driver = { 160static struct pcmcia_driver avmcs_driver = {
224 .owner = THIS_MODULE, 161 .owner = THIS_MODULE,
225 .drv = { 162 .name = "avm_cs",
226 .name = "avm_cs",
227 },
228 .probe = avmcs_probe, 163 .probe = avmcs_probe,
229 .remove = avmcs_detach, 164 .remove = avmcs_detach,
230 .id_table = avmcs_ids, 165 .id_table = avmcs_ids,
diff --git a/drivers/isdn/hardware/eicon/debug.c b/drivers/isdn/hardware/eicon/debug.c
index 33ce89eed65b..7a9894cb4557 100644
--- a/drivers/isdn/hardware/eicon/debug.c
+++ b/drivers/isdn/hardware/eicon/debug.c
@@ -861,8 +861,8 @@ static int diva_get_idi_adapter_info (IDI_CALL request, dword* serial, dword* lo
861void diva_mnt_add_xdi_adapter (const DESCRIPTOR* d) { 861void diva_mnt_add_xdi_adapter (const DESCRIPTOR* d) {
862 diva_os_spin_lock_magic_t old_irql, old_irql1; 862 diva_os_spin_lock_magic_t old_irql, old_irql1;
863 dword sec, usec, logical, serial, org_mask; 863 dword sec, usec, logical, serial, org_mask;
864 int id, best_id = 0, free_id = -1; 864 int id, free_id = -1;
865 char tmp[256]; 865 char tmp[128];
866 diva_dbg_entry_head_t* pmsg = NULL; 866 diva_dbg_entry_head_t* pmsg = NULL;
867 int len; 867 int len;
868 word size; 868 word size;
@@ -906,7 +906,6 @@ void diva_mnt_add_xdi_adapter (const DESCRIPTOR* d) {
906 and slot is still free - reuse it 906 and slot is still free - reuse it
907 */ 907 */
908 free_id = id; 908 free_id = id;
909 best_id = 1;
910 break; 909 break;
911 } 910 }
912 } 911 }
diff --git a/drivers/isdn/hardware/eicon/debuglib.h b/drivers/isdn/hardware/eicon/debuglib.h
index 8ea587783e14..02eed6b4354c 100644
--- a/drivers/isdn/hardware/eicon/debuglib.h
+++ b/drivers/isdn/hardware/eicon/debuglib.h
@@ -249,7 +249,7 @@ typedef struct _DbgHandle_
249 } regTime ; /* timestamp for registration */ 249 } regTime ; /* timestamp for registration */
250 void *pIrp ; /* ptr to pending i/o request */ 250 void *pIrp ; /* ptr to pending i/o request */
251 unsigned long dbgMask ; /* current debug mask */ 251 unsigned long dbgMask ; /* current debug mask */
252 char drvName[16] ; /* ASCII name of registered driver */ 252 char drvName[128] ; /* ASCII name of registered driver */
253 char drvTag[64] ; /* revision string */ 253 char drvTag[64] ; /* revision string */
254 DbgEnd dbg_end ; /* function for debug closing */ 254 DbgEnd dbg_end ; /* function for debug closing */
255 DbgLog dbg_prt ; /* function for debug appending */ 255 DbgLog dbg_prt ; /* function for debug appending */
diff --git a/drivers/isdn/hardware/eicon/divacapi.h b/drivers/isdn/hardware/eicon/divacapi.h
index 9f5b68037a26..e330da0c5fc0 100644
--- a/drivers/isdn/hardware/eicon/divacapi.h
+++ b/drivers/isdn/hardware/eicon/divacapi.h
@@ -673,7 +673,7 @@ struct async_s {
673 673
674 674
675/*------------------------------------------------------------------*/ 675/*------------------------------------------------------------------*/
676/* auxilliary states for supplementary services */ 676/* auxiliary states for supplementary services */
677/*------------------------------------------------------------------*/ 677/*------------------------------------------------------------------*/
678 678
679#define IDLE 0 679#define IDLE 0
diff --git a/drivers/isdn/hardware/eicon/divasfunc.c b/drivers/isdn/hardware/eicon/divasfunc.c
index d36a4c09e25d..0bbee7824d78 100644
--- a/drivers/isdn/hardware/eicon/divasfunc.c
+++ b/drivers/isdn/hardware/eicon/divasfunc.c
@@ -113,9 +113,8 @@ void diva_xdi_didd_remove_adapter(int card)
113static void start_dbg(void) 113static void start_dbg(void)
114{ 114{
115 DbgRegister("DIVAS", DRIVERRELEASE_DIVAS, (debugmask) ? debugmask : DBG_DEFAULT); 115 DbgRegister("DIVAS", DRIVERRELEASE_DIVAS, (debugmask) ? debugmask : DBG_DEFAULT);
116 DBG_LOG(("DIVA ISDNXDI BUILD (%s[%s]-%s-%s)", 116 DBG_LOG(("DIVA ISDNXDI BUILD (%s[%s])",
117 DIVA_BUILD, diva_xdi_common_code_build, __DATE__, 117 DIVA_BUILD, diva_xdi_common_code_build))
118 __TIME__))
119} 118}
120 119
121/* 120/*
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index ed9c55506797..f332b60eff6b 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -15,7 +15,6 @@
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include <asm/io.h> 16#include <asm/io.h>
17#include <linux/ioport.h> 17#include <linux/ioport.h>
18#include <linux/workqueue.h>
19#include <linux/pci.h> 18#include <linux/pci.h>
20#include <linux/interrupt.h> 19#include <linux/interrupt.h>
21#include <linux/list.h> 20#include <linux/list.h>
@@ -546,7 +545,6 @@ void diva_os_remove_soft_isr(diva_os_soft_isr_t * psoft_isr)
546 void *mem; 545 void *mem;
547 546
548 tasklet_kill(&pdpc->divas_task); 547 tasklet_kill(&pdpc->divas_task);
549 flush_scheduled_work();
550 mem = psoft_isr->object; 548 mem = psoft_isr->object;
551 psoft_isr->object = NULL; 549 psoft_isr->object = NULL;
552 diva_os_free(0, mem); 550 diva_os_free(0, mem);
diff --git a/drivers/isdn/hardware/eicon/io.h b/drivers/isdn/hardware/eicon/io.h
index 0c6c650d76bb..a6f175596364 100644
--- a/drivers/isdn/hardware/eicon/io.h
+++ b/drivers/isdn/hardware/eicon/io.h
@@ -60,7 +60,7 @@ typedef struct _diva_xdi_capi_cfg {
60 -------------------------------------------------------------------------- */ 60 -------------------------------------------------------------------------- */
61struct _ISDN_ADAPTER { 61struct _ISDN_ADAPTER {
62 void (* DIRequest)(PISDN_ADAPTER, ENTITY *) ; 62 void (* DIRequest)(PISDN_ADAPTER, ENTITY *) ;
63 int State ; /* from NT4 1.srv, a good idea, but a poor achievment */ 63 int State ; /* from NT4 1.srv, a good idea, but a poor achievement */
64 int Initialized ; 64 int Initialized ;
65 int RegisteredWithDidd ; 65 int RegisteredWithDidd ;
66 int Unavailable ; /* callback function possible? */ 66 int Unavailable ; /* callback function possible? */
diff --git a/drivers/isdn/hardware/eicon/istream.c b/drivers/isdn/hardware/eicon/istream.c
index 18f8798442fa..7bd5baa547be 100644
--- a/drivers/isdn/hardware/eicon/istream.c
+++ b/drivers/isdn/hardware/eicon/istream.c
@@ -62,7 +62,7 @@ void diva_xdi_provide_istream_info (ADAPTER* a,
62 stream interface. 62 stream interface.
63 If synchronous service was requested, then function 63 If synchronous service was requested, then function
64 does return amount of data written to stream. 64 does return amount of data written to stream.
65 'final' does indicate that pice of data to be written is 65 'final' does indicate that piece of data to be written is
66 final part of frame (necessary only by structured datatransfer) 66 final part of frame (necessary only by structured datatransfer)
67 return 0 if zero lengh packet was written 67 return 0 if zero lengh packet was written
68 return -1 if stream is full 68 return -1 if stream is full
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index 341ef17c22ac..a3395986df3d 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -1198,7 +1198,6 @@ static byte connect_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
1198 word ch; 1198 word ch;
1199 word i; 1199 word i;
1200 word Info; 1200 word Info;
1201 word CIP;
1202 byte LinkLayer; 1201 byte LinkLayer;
1203 API_PARSE * ai; 1202 API_PARSE * ai;
1204 API_PARSE * bp; 1203 API_PARSE * bp;
@@ -1340,7 +1339,6 @@ static byte connect_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
1340 add_s(plci,BC,&parms[6]); 1339 add_s(plci,BC,&parms[6]);
1341 add_s(plci,LLC,&parms[7]); 1340 add_s(plci,LLC,&parms[7]);
1342 add_s(plci,HLC,&parms[8]); 1341 add_s(plci,HLC,&parms[8]);
1343 CIP = GET_WORD(parms[0].info);
1344 if (a->Info_Mask[appl->Id-1] & 0x200) 1342 if (a->Info_Mask[appl->Id-1] & 0x200)
1345 { 1343 {
1346 /* early B3 connect (CIP mask bit 9) no release after a disc */ 1344 /* early B3 connect (CIP mask bit 9) no release after a disc */
@@ -2639,7 +2637,7 @@ static byte connect_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
2639 } 2637 }
2640 else 2638 else
2641 { 2639 {
2642 /* local reply if assign unsuccessfull 2640 /* local reply if assign unsuccessful
2643 or B3 protocol allows only one layer 3 connection 2641 or B3 protocol allows only one layer 3 connection
2644 and already connected 2642 and already connected
2645 or B2 protocol not any LAPD 2643 or B2 protocol not any LAPD
@@ -4830,7 +4828,6 @@ static void sig_ind(PLCI *plci)
4830 dword x_Id; 4828 dword x_Id;
4831 dword Id; 4829 dword Id;
4832 dword rId; 4830 dword rId;
4833 word Number = 0;
4834 word i; 4831 word i;
4835 word cip; 4832 word cip;
4836 dword cip_mask; 4833 dword cip_mask;
@@ -5106,7 +5103,7 @@ static void sig_ind(PLCI *plci)
5106 } 5103 }
5107 } 5104 }
5108 5105
5109 if(plci->appl) Number = plci->appl->Number++; 5106 if(plci->appl) plci->appl->Number++;
5110 5107
5111 switch(plci->Sig.Ind) { 5108 switch(plci->Sig.Ind) {
5112 /* Response to Get_Supported_Services request */ 5109 /* Response to Get_Supported_Services request */
@@ -5894,7 +5891,6 @@ static void sig_ind(PLCI *plci)
5894 break; 5891 break;
5895 5892
5896 case TEL_CTRL: 5893 case TEL_CTRL:
5897 Number = 0;
5898 ie = multi_fac_parms[0]; /* inspect the facility hook indications */ 5894 ie = multi_fac_parms[0]; /* inspect the facility hook indications */
5899 if(plci->State==ADVANCED_VOICE_SIG && ie[0]){ 5895 if(plci->State==ADVANCED_VOICE_SIG && ie[0]){
5900 switch (ie[1]&0x91) { 5896 switch (ie[1]&0x91) {
@@ -8189,7 +8185,7 @@ static word add_b23(PLCI *plci, API_PARSE *bp)
8189 dlc[ 0] = 15; 8185 dlc[ 0] = 15;
8190 if(b2_config->length >= 8) { /* PIAFS control abilities */ 8186 if(b2_config->length >= 8) { /* PIAFS control abilities */
8191 dlc[ 7] = 10; 8187 dlc[ 7] = 10;
8192 dlc[16] = 2; /* Length of PIAFS extention */ 8188 dlc[16] = 2; /* Length of PIAFS extension */
8193 dlc[17] = PIAFS_UDATA_ABILITIES; /* control (UDATA) ability */ 8189 dlc[17] = PIAFS_UDATA_ABILITIES; /* control (UDATA) ability */
8194 dlc[18] = b2_config_parms[4].info[0]; /* value */ 8190 dlc[18] = b2_config_parms[4].info[0]; /* value */
8195 dlc[ 0] = 18; 8191 dlc[ 0] = 18;
@@ -10119,14 +10115,12 @@ static byte dtmf_request (dword Id, word Number, DIVA_CAPI_ADAPTER *a, PLCI
10119 10115
10120static void dtmf_confirmation (dword Id, PLCI *plci) 10116static void dtmf_confirmation (dword Id, PLCI *plci)
10121{ 10117{
10122 word Info;
10123 word i; 10118 word i;
10124 byte result[4]; 10119 byte result[4];
10125 10120
10126 dbug (1, dprintf ("[%06lx] %s,%d: dtmf_confirmation", 10121 dbug (1, dprintf ("[%06lx] %s,%d: dtmf_confirmation",
10127 UnMapId (Id), (char *)(FILE_), __LINE__)); 10122 UnMapId (Id), (char *)(FILE_), __LINE__));
10128 10123
10129 Info = GOOD;
10130 result[0] = 2; 10124 result[0] = 2;
10131 PUT_WORD (&result[1], DTMF_SUCCESS); 10125 PUT_WORD (&result[1], DTMF_SUCCESS);
10132 if (plci->dtmf_send_requests != 0) 10126 if (plci->dtmf_send_requests != 0)
@@ -11520,13 +11514,12 @@ static word mixer_restore_config (dword Id, PLCI *plci, byte Rc)
11520static void mixer_command (dword Id, PLCI *plci, byte Rc) 11514static void mixer_command (dword Id, PLCI *plci, byte Rc)
11521{ 11515{
11522 DIVA_CAPI_ADAPTER *a; 11516 DIVA_CAPI_ADAPTER *a;
11523 word i, internal_command, Info; 11517 word i, internal_command;
11524 11518
11525 dbug (1, dprintf ("[%06lx] %s,%d: mixer_command %02x %04x %04x", 11519 dbug (1, dprintf ("[%06lx] %s,%d: mixer_command %02x %04x %04x",
11526 UnMapId (Id), (char *)(FILE_), __LINE__, Rc, plci->internal_command, 11520 UnMapId (Id), (char *)(FILE_), __LINE__, Rc, plci->internal_command,
11527 plci->li_cmd)); 11521 plci->li_cmd));
11528 11522
11529 Info = GOOD;
11530 a = plci->adapter; 11523 a = plci->adapter;
11531 internal_command = plci->internal_command; 11524 internal_command = plci->internal_command;
11532 plci->internal_command = 0; 11525 plci->internal_command = 0;
@@ -11550,7 +11543,6 @@ static void mixer_command (dword Id, PLCI *plci, byte Rc)
11550 { 11543 {
11551 dbug (1, dprintf ("[%06lx] %s,%d: Load mixer failed", 11544 dbug (1, dprintf ("[%06lx] %s,%d: Load mixer failed",
11552 UnMapId (Id), (char *)(FILE_), __LINE__)); 11545 UnMapId (Id), (char *)(FILE_), __LINE__));
11553 Info = _FACILITY_NOT_SUPPORTED;
11554 break; 11546 break;
11555 } 11547 }
11556 if (plci->internal_command) 11548 if (plci->internal_command)
@@ -11592,7 +11584,6 @@ static void mixer_command (dword Id, PLCI *plci, byte Rc)
11592 } while ((plci->li_plci_b_write_pos != plci->li_plci_b_req_pos) 11584 } while ((plci->li_plci_b_write_pos != plci->li_plci_b_req_pos)
11593 && !(plci->li_plci_b_queue[i] & LI_PLCI_B_LAST_FLAG)); 11585 && !(plci->li_plci_b_queue[i] & LI_PLCI_B_LAST_FLAG));
11594 } 11586 }
11595 Info = _FACILITY_NOT_SUPPORTED;
11596 break; 11587 break;
11597 } 11588 }
11598 if (plci->internal_command) 11589 if (plci->internal_command)
@@ -11610,7 +11601,6 @@ static void mixer_command (dword Id, PLCI *plci, byte Rc)
11610 { 11601 {
11611 dbug (1, dprintf ("[%06lx] %s,%d: Unload mixer failed", 11602 dbug (1, dprintf ("[%06lx] %s,%d: Unload mixer failed",
11612 UnMapId (Id), (char *)(FILE_), __LINE__)); 11603 UnMapId (Id), (char *)(FILE_), __LINE__));
11613 Info = _FACILITY_NOT_SUPPORTED;
11614 break; 11604 break;
11615 } 11605 }
11616 if (plci->internal_command) 11606 if (plci->internal_command)
@@ -12448,13 +12438,11 @@ static byte mixer_request (dword Id, word Number, DIVA_CAPI_ADAPTER *a, PLCI
12448static void mixer_indication_coefs_set (dword Id, PLCI *plci) 12438static void mixer_indication_coefs_set (dword Id, PLCI *plci)
12449{ 12439{
12450 dword d; 12440 dword d;
12451 DIVA_CAPI_ADAPTER *a;
12452 byte result[12]; 12441 byte result[12];
12453 12442
12454 dbug (1, dprintf ("[%06lx] %s,%d: mixer_indication_coefs_set", 12443 dbug (1, dprintf ("[%06lx] %s,%d: mixer_indication_coefs_set",
12455 UnMapId (Id), (char *)(FILE_), __LINE__)); 12444 UnMapId (Id), (char *)(FILE_), __LINE__));
12456 12445
12457 a = plci->adapter;
12458 if (plci->li_plci_b_read_pos != plci->li_plci_b_req_pos) 12446 if (plci->li_plci_b_read_pos != plci->li_plci_b_req_pos)
12459 { 12447 {
12460 do 12448 do
@@ -14111,13 +14099,11 @@ static void select_b_command (dword Id, PLCI *plci, byte Rc)
14111 14099
14112static void fax_connect_ack_command (dword Id, PLCI *plci, byte Rc) 14100static void fax_connect_ack_command (dword Id, PLCI *plci, byte Rc)
14113{ 14101{
14114 word Info;
14115 word internal_command; 14102 word internal_command;
14116 14103
14117 dbug (1, dprintf ("[%06lx] %s,%d: fax_connect_ack_command %02x %04x", 14104 dbug (1, dprintf ("[%06lx] %s,%d: fax_connect_ack_command %02x %04x",
14118 UnMapId (Id), (char *)(FILE_), __LINE__, Rc, plci->internal_command)); 14105 UnMapId (Id), (char *)(FILE_), __LINE__, Rc, plci->internal_command));
14119 14106
14120 Info = GOOD;
14121 internal_command = plci->internal_command; 14107 internal_command = plci->internal_command;
14122 plci->internal_command = 0; 14108 plci->internal_command = 0;
14123 switch (internal_command) 14109 switch (internal_command)
@@ -14160,13 +14146,11 @@ static void fax_connect_ack_command (dword Id, PLCI *plci, byte Rc)
14160 14146
14161static void fax_edata_ack_command (dword Id, PLCI *plci, byte Rc) 14147static void fax_edata_ack_command (dword Id, PLCI *plci, byte Rc)
14162{ 14148{
14163 word Info;
14164 word internal_command; 14149 word internal_command;
14165 14150
14166 dbug (1, dprintf ("[%06lx] %s,%d: fax_edata_ack_command %02x %04x", 14151 dbug (1, dprintf ("[%06lx] %s,%d: fax_edata_ack_command %02x %04x",
14167 UnMapId (Id), (char *)(FILE_), __LINE__, Rc, plci->internal_command)); 14152 UnMapId (Id), (char *)(FILE_), __LINE__, Rc, plci->internal_command));
14168 14153
14169 Info = GOOD;
14170 internal_command = plci->internal_command; 14154 internal_command = plci->internal_command;
14171 plci->internal_command = 0; 14155 plci->internal_command = 0;
14172 switch (internal_command) 14156 switch (internal_command)
@@ -14395,13 +14379,11 @@ static void rtp_connect_b3_req_command (dword Id, PLCI *plci, byte Rc)
14395 14379
14396static void rtp_connect_b3_res_command (dword Id, PLCI *plci, byte Rc) 14380static void rtp_connect_b3_res_command (dword Id, PLCI *plci, byte Rc)
14397{ 14381{
14398 word Info;
14399 word internal_command; 14382 word internal_command;
14400 14383
14401 dbug (1, dprintf ("[%06lx] %s,%d: rtp_connect_b3_res_command %02x %04x", 14384 dbug (1, dprintf ("[%06lx] %s,%d: rtp_connect_b3_res_command %02x %04x",
14402 UnMapId (Id), (char *)(FILE_), __LINE__, Rc, plci->internal_command)); 14385 UnMapId (Id), (char *)(FILE_), __LINE__, Rc, plci->internal_command));
14403 14386
14404 Info = GOOD;
14405 internal_command = plci->internal_command; 14387 internal_command = plci->internal_command;
14406 plci->internal_command = 0; 14388 plci->internal_command = 0;
14407 switch (internal_command) 14389 switch (internal_command)
@@ -14423,7 +14405,6 @@ static void rtp_connect_b3_res_command (dword Id, PLCI *plci, byte Rc)
14423 { 14405 {
14424 dbug (1, dprintf ("[%06lx] %s,%d: RTP setting connect resp info failed %02x", 14406 dbug (1, dprintf ("[%06lx] %s,%d: RTP setting connect resp info failed %02x",
14425 UnMapId (Id), (char *)(FILE_), __LINE__, Rc)); 14407 UnMapId (Id), (char *)(FILE_), __LINE__, Rc));
14426 Info = _WRONG_STATE;
14427 break; 14408 break;
14428 } 14409 }
14429 if (plci_nl_busy (plci)) 14410 if (plci_nl_busy (plci))
diff --git a/drivers/isdn/hardware/eicon/pc.h b/drivers/isdn/hardware/eicon/pc.h
index 1c6945768a35..bf6b01812400 100644
--- a/drivers/isdn/hardware/eicon/pc.h
+++ b/drivers/isdn/hardware/eicon/pc.h
@@ -701,7 +701,7 @@ Byte | 8 7 6 5 4 3 2 1
701#define PROTCAP_FREE12 0x1000 /* not used */ 701#define PROTCAP_FREE12 0x1000 /* not used */
702#define PROTCAP_FREE13 0x2000 /* not used */ 702#define PROTCAP_FREE13 0x2000 /* not used */
703#define PROTCAP_FREE14 0x4000 /* not used */ 703#define PROTCAP_FREE14 0x4000 /* not used */
704#define PROTCAP_EXTENSION 0x8000 /* used for future extentions */ 704#define PROTCAP_EXTENSION 0x8000 /* used for future extensions */
705/* -----------------------------------------------------------* */ 705/* -----------------------------------------------------------* */
706/* Onhook data transmission ETS30065901 */ 706/* Onhook data transmission ETS30065901 */
707/* Message Type */ 707/* Message Type */
diff --git a/drivers/isdn/hardware/eicon/um_idi.c b/drivers/isdn/hardware/eicon/um_idi.c
index 6563db998d06..ac0bdd1f23fa 100644
--- a/drivers/isdn/hardware/eicon/um_idi.c
+++ b/drivers/isdn/hardware/eicon/um_idi.c
@@ -363,7 +363,7 @@ int diva_um_idi_read(void *entity,
363 363
364 if ((ret = (*cp_fn) (os_handle, dst, data, length)) >= 0) { 364 if ((ret = (*cp_fn) (os_handle, dst, data, length)) >= 0) {
365 /* 365 /*
366 Acknowledge only if read was successfull 366 Acknowledge only if read was successful
367 */ 367 */
368 diva_data_q_ack_segment4read(q); 368 diva_data_q_ack_segment4read(q);
369 } 369 }
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index 4e3780d78ac7..f6f3c87cc7c2 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -118,7 +118,7 @@
118 * -> See hfc_multi.h for HFC_IO_MODE_* values 118 * -> See hfc_multi.h for HFC_IO_MODE_* values
119 * By default, the IO mode is pci memory IO (MEMIO). 119 * By default, the IO mode is pci memory IO (MEMIO).
120 * Some cards require specific IO mode, so it cannot be changed. 120 * Some cards require specific IO mode, so it cannot be changed.
121 * It may be usefull to set IO mode to register io (REGIO) to solve 121 * It may be useful to set IO mode to register io (REGIO) to solve
122 * PCI bridge problems. 122 * PCI bridge problems.
123 * If unsure, don't give this parameter. 123 * If unsure, don't give this parameter.
124 * 124 *
@@ -903,7 +903,7 @@ vpm_echocan_off(struct hfc_multi *hc, int ch)
903/* 903/*
904 * Speech Design resync feature 904 * Speech Design resync feature
905 * NOTE: This is called sometimes outside interrupt handler. 905 * NOTE: This is called sometimes outside interrupt handler.
906 * We must lock irqsave, so no other interrupt (other card) will occurr! 906 * We must lock irqsave, so no other interrupt (other card) will occur!
907 * Also multiple interrupts may nest, so must lock each access (lists, card)! 907 * Also multiple interrupts may nest, so must lock each access (lists, card)!
908 */ 908 */
909static inline void 909static inline void
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index 15d323b8be60..b01a7be1300f 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -272,7 +272,7 @@ reset_hfcpci(struct hfc_pci *hc)
272 * D- and monitor/CI channel are not enabled 272 * D- and monitor/CI channel are not enabled
273 * STIO1 is used as output for data, B1+B2 from ST->IOM+HFC 273 * STIO1 is used as output for data, B1+B2 from ST->IOM+HFC
274 * STIO2 is used as data input, B1+B2 from IOM->ST 274 * STIO2 is used as data input, B1+B2 from IOM->ST
275 * ST B-channel send disabled -> continous 1s 275 * ST B-channel send disabled -> continuous 1s
276 * The IOM slots are always enabled 276 * The IOM slots are always enabled
277 */ 277 */
278 if (test_bit(HFC_CFG_PCM, &hc->cfg)) { 278 if (test_bit(HFC_CFG_PCM, &hc->cfg)) {
@@ -405,7 +405,7 @@ hfcpci_empty_bfifo(struct bchannel *bch, struct bzfifo *bz,
405 u_char *bdata, int count) 405 u_char *bdata, int count)
406{ 406{
407 u_char *ptr, *ptr1, new_f2; 407 u_char *ptr, *ptr1, new_f2;
408 int total, maxlen, new_z2; 408 int maxlen, new_z2;
409 struct zt *zp; 409 struct zt *zp;
410 410
411 if ((bch->debug & DEBUG_HW_BCHANNEL) && !(bch->debug & DEBUG_HW_BFIFO)) 411 if ((bch->debug & DEBUG_HW_BCHANNEL) && !(bch->debug & DEBUG_HW_BFIFO))
@@ -431,7 +431,6 @@ hfcpci_empty_bfifo(struct bchannel *bch, struct bzfifo *bz,
431 printk(KERN_WARNING "HFCPCI: receive out of memory\n"); 431 printk(KERN_WARNING "HFCPCI: receive out of memory\n");
432 return; 432 return;
433 } 433 }
434 total = count;
435 count -= 3; 434 count -= 3;
436 ptr = skb_put(bch->rx_skb, count); 435 ptr = skb_put(bch->rx_skb, count);
437 436
@@ -968,7 +967,6 @@ static void
968ph_state_nt(struct dchannel *dch) 967ph_state_nt(struct dchannel *dch)
969{ 968{
970 struct hfc_pci *hc = dch->hw; 969 struct hfc_pci *hc = dch->hw;
971 u_char val;
972 970
973 if (dch->debug) 971 if (dch->debug)
974 printk(KERN_DEBUG "%s: NT newstate %x\n", 972 printk(KERN_DEBUG "%s: NT newstate %x\n",
@@ -982,7 +980,7 @@ ph_state_nt(struct dchannel *dch)
982 hc->hw.int_m1 &= ~HFCPCI_INTS_TIMER; 980 hc->hw.int_m1 &= ~HFCPCI_INTS_TIMER;
983 Write_hfc(hc, HFCPCI_INT_M1, hc->hw.int_m1); 981 Write_hfc(hc, HFCPCI_INT_M1, hc->hw.int_m1);
984 /* Clear already pending ints */ 982 /* Clear already pending ints */
985 val = Read_hfc(hc, HFCPCI_INT_S1); 983 (void) Read_hfc(hc, HFCPCI_INT_S1);
986 Write_hfc(hc, HFCPCI_STATES, 4 | HFCPCI_LOAD_STATE); 984 Write_hfc(hc, HFCPCI_STATES, 4 | HFCPCI_LOAD_STATE);
987 udelay(10); 985 udelay(10);
988 Write_hfc(hc, HFCPCI_STATES, 4); 986 Write_hfc(hc, HFCPCI_STATES, 4);
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 8700474747e8..71a8eb6ef71e 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -118,14 +118,12 @@ static void
118ctrl_complete(struct urb *urb) 118ctrl_complete(struct urb *urb)
119{ 119{
120 struct hfcsusb *hw = (struct hfcsusb *) urb->context; 120 struct hfcsusb *hw = (struct hfcsusb *) urb->context;
121 struct ctrl_buf *buf;
122 121
123 if (debug & DBG_HFC_CALL_TRACE) 122 if (debug & DBG_HFC_CALL_TRACE)
124 printk(KERN_DEBUG "%s: %s\n", hw->name, __func__); 123 printk(KERN_DEBUG "%s: %s\n", hw->name, __func__);
125 124
126 urb->dev = hw->dev; 125 urb->dev = hw->dev;
127 if (hw->ctrl_cnt) { 126 if (hw->ctrl_cnt) {
128 buf = &hw->ctrl_buff[hw->ctrl_out_idx];
129 hw->ctrl_cnt--; /* decrement actual count */ 127 hw->ctrl_cnt--; /* decrement actual count */
130 if (++hw->ctrl_out_idx >= HFC_CTRL_BUFSIZE) 128 if (++hw->ctrl_out_idx >= HFC_CTRL_BUFSIZE)
131 hw->ctrl_out_idx = 0; /* pointer wrap */ 129 hw->ctrl_out_idx = 0; /* pointer wrap */
@@ -285,6 +283,7 @@ hfcsusb_ph_info(struct hfcsusb *hw)
285 _queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY, 283 _queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY,
286 sizeof(struct ph_info_dch) + dch->dev.nrbchan * 284 sizeof(struct ph_info_dch) + dch->dev.nrbchan *
287 sizeof(struct ph_info_ch), phi, GFP_ATOMIC); 285 sizeof(struct ph_info_ch), phi, GFP_ATOMIC);
286 kfree(phi);
288} 287}
289 288
290/* 289/*
@@ -1726,7 +1725,6 @@ hfcsusb_stop_endpoint(struct hfcsusb *hw, int channel)
1726static int 1725static int
1727setup_hfcsusb(struct hfcsusb *hw) 1726setup_hfcsusb(struct hfcsusb *hw)
1728{ 1727{
1729 int err;
1730 u_char b; 1728 u_char b;
1731 1729
1732 if (debug & DBG_HFC_CALL_TRACE) 1730 if (debug & DBG_HFC_CALL_TRACE)
@@ -1745,7 +1743,7 @@ setup_hfcsusb(struct hfcsusb *hw)
1745 } 1743 }
1746 1744
1747 /* first set the needed config, interface and alternate */ 1745 /* first set the needed config, interface and alternate */
1748 err = usb_set_interface(hw->dev, hw->if_used, hw->alt_used); 1746 (void) usb_set_interface(hw->dev, hw->if_used, hw->alt_used);
1749 1747
1750 hw->led_state = 0; 1748 hw->led_state = 0;
1751 1749
diff --git a/drivers/isdn/hardware/mISDN/ipac.h b/drivers/isdn/hardware/mISDN/ipac.h
index 74a6ccf9065c..8121e046b739 100644
--- a/drivers/isdn/hardware/mISDN/ipac.h
+++ b/drivers/isdn/hardware/mISDN/ipac.h
@@ -29,7 +29,7 @@ struct isac_hw {
29 u32 type; 29 u32 type;
30 u32 off; /* offset to isac regs */ 30 u32 off; /* offset to isac regs */
31 char *name; 31 char *name;
32 spinlock_t *hwlock; /* lock HW acccess */ 32 spinlock_t *hwlock; /* lock HW access */
33 read_reg_func *read_reg; 33 read_reg_func *read_reg;
34 write_reg_func *write_reg; 34 write_reg_func *write_reg;
35 fifo_func *read_fifo; 35 fifo_func *read_fifo;
@@ -70,7 +70,7 @@ struct ipac_hw {
70 struct hscx_hw hscx[2]; 70 struct hscx_hw hscx[2];
71 char *name; 71 char *name;
72 void *hw; 72 void *hw;
73 spinlock_t *hwlock; /* lock HW acccess */ 73 spinlock_t *hwlock; /* lock HW access */
74 struct module *owner; 74 struct module *owner;
75 u32 type; 75 u32 type;
76 read_reg_func *read_reg; 76 read_reg_func *read_reg;
diff --git a/drivers/isdn/hardware/mISDN/isar.h b/drivers/isdn/hardware/mISDN/isar.h
index 4a134acd44d0..9962bdf699c7 100644
--- a/drivers/isdn/hardware/mISDN/isar.h
+++ b/drivers/isdn/hardware/mISDN/isar.h
@@ -44,7 +44,7 @@ struct isar_ch {
44struct isar_hw { 44struct isar_hw {
45 struct isar_ch ch[2]; 45 struct isar_ch ch[2];
46 void *hw; 46 void *hw;
47 spinlock_t *hwlock; /* lock HW acccess */ 47 spinlock_t *hwlock; /* lock HW access */
48 char *name; 48 char *name;
49 struct module *owner; 49 struct module *owner;
50 read_reg_func *read_reg; 50 read_reg_func *read_reg;
diff --git a/drivers/isdn/hardware/mISDN/mISDNinfineon.c b/drivers/isdn/hardware/mISDN/mISDNinfineon.c
index af25e1f3efd4..bc0529ac88a1 100644
--- a/drivers/isdn/hardware/mISDN/mISDNinfineon.c
+++ b/drivers/isdn/hardware/mISDN/mISDNinfineon.c
@@ -420,7 +420,7 @@ enable_hwirq(struct inf_hw *hw)
420 break; 420 break;
421 case INF_NICCY: 421 case INF_NICCY:
422 val = inl((u32)hw->cfg.start + NICCY_IRQ_CTRL_REG); 422 val = inl((u32)hw->cfg.start + NICCY_IRQ_CTRL_REG);
423 val |= NICCY_IRQ_ENABLE;; 423 val |= NICCY_IRQ_ENABLE;
424 outl(val, (u32)hw->cfg.start + NICCY_IRQ_CTRL_REG); 424 outl(val, (u32)hw->cfg.start + NICCY_IRQ_CTRL_REG);
425 break; 425 break;
426 case INF_SCT_1: 426 case INF_SCT_1:
@@ -563,7 +563,7 @@ reset_inf(struct inf_hw *hw)
563 mdelay(10); 563 mdelay(10);
564 hw->ipac.isac.adf2 = 0x87; 564 hw->ipac.isac.adf2 = 0x87;
565 hw->ipac.hscx[0].slot = 0x1f; 565 hw->ipac.hscx[0].slot = 0x1f;
566 hw->ipac.hscx[0].slot = 0x23; 566 hw->ipac.hscx[1].slot = 0x23;
567 break; 567 break;
568 case INF_GAZEL_R753: 568 case INF_GAZEL_R753:
569 val = inl((u32)hw->cfg.start + GAZEL_CNTRL); 569 val = inl((u32)hw->cfg.start + GAZEL_CNTRL);
@@ -924,7 +924,7 @@ setup_instance(struct inf_hw *card)
924 mISDNipac_init(&card->ipac, card); 924 mISDNipac_init(&card->ipac, card);
925 925
926 if (card->ipac.isac.dch.dev.Bprotocols == 0) 926 if (card->ipac.isac.dch.dev.Bprotocols == 0)
927 goto error_setup;; 927 goto error_setup;
928 928
929 err = mISDN_register_device(&card->ipac.isac.dch.dev, 929 err = mISDN_register_device(&card->ipac.isac.dch.dev,
930 &card->pdev->dev, card->name); 930 &card->pdev->dev, card->name);
diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c b/drivers/isdn/hardware/mISDN/mISDNisar.c
index 38eb31439a73..d13fa5b119f5 100644
--- a/drivers/isdn/hardware/mISDN/mISDNisar.c
+++ b/drivers/isdn/hardware/mISDN/mISDNisar.c
@@ -264,7 +264,7 @@ load_firmware(struct isar_hw *isar, const u8 *buf, int size)
264 while (noc) { 264 while (noc) {
265 val = le16_to_cpu(*sp++); 265 val = le16_to_cpu(*sp++);
266 *mp++ = val >> 8; 266 *mp++ = val >> 8;
267 *mp++ = val & 0xFF;; 267 *mp++ = val & 0xFF;
268 noc--; 268 noc--;
269 } 269 }
270 spin_lock_irqsave(isar->hwlock, flags); 270 spin_lock_irqsave(isar->hwlock, flags);
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index 54ae71a907f9..db25b6b2ae39 100644
--- a/drivers/isdn/hardware/mISDN/netjet.c
+++ b/drivers/isdn/hardware/mISDN/netjet.c
@@ -1072,6 +1072,12 @@ nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1072 return -ENODEV; 1072 return -ENODEV;
1073 } 1073 }
1074 1074
1075 if (pdev->subsystem_vendor == 0xb100 &&
1076 pdev->subsystem_device == 0x0003 ) {
1077 pr_notice("Netjet: Digium TDM400P not handled yet\n");
1078 return -ENODEV;
1079 }
1080
1075 card = kzalloc(sizeof(struct tiger_hw), GFP_ATOMIC); 1081 card = kzalloc(sizeof(struct tiger_hw), GFP_ATOMIC);
1076 if (!card) { 1082 if (!card) {
1077 pr_info("No kmem for Netjet\n"); 1083 pr_info("No kmem for Netjet\n");
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index ab638b083df9..646368fe41c9 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -4,7 +4,7 @@
4 4
5# Define maximum number of cards 5# Define maximum number of cards
6 6
7EXTRA_CFLAGS += -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS) 7ccflags-y := -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS)
8 8
9obj-$(CONFIG_ISDN_DRV_HISAX) += hisax.o 9obj-$(CONFIG_ISDN_DRV_HISAX) += hisax.o
10obj-$(CONFIG_HISAX_SEDLBAUER_CS) += sedlbauer_cs.o 10obj-$(CONFIG_HISAX_SEDLBAUER_CS) += sedlbauer_cs.o
diff --git a/drivers/isdn/hisax/arcofi.c b/drivers/isdn/hisax/arcofi.c
index 85a8fd8dd0b7..21cbbe1d5563 100644
--- a/drivers/isdn/hisax/arcofi.c
+++ b/drivers/isdn/hisax/arcofi.c
@@ -30,8 +30,6 @@ add_arcofi_timer(struct IsdnCardState *cs) {
30 30
31static void 31static void
32send_arcofi(struct IsdnCardState *cs) { 32send_arcofi(struct IsdnCardState *cs) {
33 u_char val;
34
35 add_arcofi_timer(cs); 33 add_arcofi_timer(cs);
36 cs->dc.isac.mon_txp = 0; 34 cs->dc.isac.mon_txp = 0;
37 cs->dc.isac.mon_txc = cs->dc.isac.arcofi_list->len; 35 cs->dc.isac.mon_txc = cs->dc.isac.arcofi_list->len;
@@ -45,7 +43,7 @@ send_arcofi(struct IsdnCardState *cs) {
45 cs->dc.isac.mocr &= 0x0f; 43 cs->dc.isac.mocr &= 0x0f;
46 cs->dc.isac.mocr |= 0xa0; 44 cs->dc.isac.mocr |= 0xa0;
47 cs->writeisac(cs, ISAC_MOCR, cs->dc.isac.mocr); 45 cs->writeisac(cs, ISAC_MOCR, cs->dc.isac.mocr);
48 val = cs->readisac(cs, ISAC_MOSR); 46 (void) cs->readisac(cs, ISAC_MOSR);
49 cs->writeisac(cs, ISAC_MOX1, cs->dc.isac.mon_tx[cs->dc.isac.mon_txp++]); 47 cs->writeisac(cs, ISAC_MOX1, cs->dc.isac.mon_tx[cs->dc.isac.mon_txp++]);
50 cs->dc.isac.mocr |= 0x10; 48 cs->dc.isac.mocr |= 0x10;
51 cs->writeisac(cs, ISAC_MOCR, cs->dc.isac.mocr); 49 cs->writeisac(cs, ISAC_MOCR, cs->dc.isac.mocr);
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c
index fcf4ed1cb4b9..0e66af1decd4 100644
--- a/drivers/isdn/hisax/avm_pci.c
+++ b/drivers/isdn/hisax/avm_pci.c
@@ -314,7 +314,7 @@ hdlc_fill_fifo(struct BCState *bcs)
314 bcs->hw.hdlc.ctrl.sr.cmd |= HDLC_CMD_XME; 314 bcs->hw.hdlc.ctrl.sr.cmd |= HDLC_CMD_XME;
315 } 315 }
316 if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO)) 316 if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
317 debugl1(cs, "hdlc_fill_fifo %d/%ld", count, bcs->tx_skb->len); 317 debugl1(cs, "hdlc_fill_fifo %d/%u", count, bcs->tx_skb->len);
318 p = bcs->tx_skb->data; 318 p = bcs->tx_skb->data;
319 ptr = (u_int *)p; 319 ptr = (u_int *)p;
320 skb_pull(bcs->tx_skb, count); 320 skb_pull(bcs->tx_skb, count);
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 94263c22b874..8f0ad2a52e87 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -20,7 +20,6 @@
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/system.h> 21#include <asm/system.h>
22 22
23#include <pcmcia/cs.h>
24#include <pcmcia/cistpl.h> 23#include <pcmcia/cistpl.h>
25#include <pcmcia/ds.h> 24#include <pcmcia/ds.h>
26#include "hisax_cfg.h" 25#include "hisax_cfg.h"
@@ -40,67 +39,22 @@ module_param(isdnprot, int, 0);
40 39
41/*====================================================================*/ 40/*====================================================================*/
42 41
43/*
44 The event() function is this driver's Card Services event handler.
45 It will be called by Card Services when an appropriate card status
46 event is received. The config() and release() entry points are
47 used to configure or release a socket, in response to card insertion
48 and ejection events. They are invoked from the skeleton event
49 handler.
50*/
51
52static int avma1cs_config(struct pcmcia_device *link) __devinit ; 42static int avma1cs_config(struct pcmcia_device *link) __devinit ;
53static void avma1cs_release(struct pcmcia_device *link); 43static void avma1cs_release(struct pcmcia_device *link);
54
55/*
56 The attach() and detach() entry points are used to create and destroy
57 "instances" of the driver, where each instance represents everything
58 needed to manage one actual PCMCIA card.
59*/
60
61static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ; 44static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ;
62 45
63
64/*======================================================================
65
66 avma1cs_attach() creates an "instance" of the driver, allocating
67 local data structures for one device. The device is registered
68 with Card Services.
69
70 The dev_link structure is initialized, but we don't actually
71 configure the card at this point -- we wait until we receive a
72 card insertion event.
73
74======================================================================*/
75
76static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) 46static int __devinit avma1cs_probe(struct pcmcia_device *p_dev)
77{ 47{
78 dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); 48 dev_dbg(&p_dev->dev, "avma1cs_attach()\n");
79 49
80 /* The io structure describes IO port mapping */
81 p_dev->resource[0]->end = 16;
82 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
83 p_dev->resource[1]->end = 16;
84 p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16;
85
86 /* General socket configuration */ 50 /* General socket configuration */
87 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 51 p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
88 p_dev->conf.IntType = INT_MEMORY_AND_IO; 52 p_dev->config_index = 1;
89 p_dev->conf.ConfigIndex = 1; 53 p_dev->config_regs = PRESENT_OPTION;
90 p_dev->conf.Present = PRESENT_OPTION;
91 54
92 return avma1cs_config(p_dev); 55 return avma1cs_config(p_dev);
93} /* avma1cs_attach */ 56} /* avma1cs_attach */
94 57
95/*======================================================================
96
97 This deletes a driver "instance". The device is de-registered
98 with Card Services. If it has been released, all local data
99 structures are freed. Otherwise, the structures will be freed
100 when the device is released.
101
102======================================================================*/
103
104static void __devexit avma1cs_detach(struct pcmcia_device *link) 58static void __devexit avma1cs_detach(struct pcmcia_device *link)
105{ 59{
106 dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link); 60 dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link);
@@ -108,26 +62,13 @@ static void __devexit avma1cs_detach(struct pcmcia_device *link)
108 kfree(link->priv); 62 kfree(link->priv);
109} /* avma1cs_detach */ 63} /* avma1cs_detach */
110 64
111/*====================================================================== 65static int avma1cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
112
113 avma1cs_config() is scheduled to run after a CARD_INSERTION event
114 is received, to configure the PCMCIA socket, and to make the
115 ethernet device available to the system.
116
117======================================================================*/
118
119static int avma1cs_configcheck(struct pcmcia_device *p_dev,
120 cistpl_cftable_entry_t *cf,
121 cistpl_cftable_entry_t *dflt,
122 unsigned int vcc,
123 void *priv_data)
124{ 66{
125 if (cf->io.nwin <= 0) 67 p_dev->resource[0]->end = 16;
126 return -ENODEV; 68 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
127 69 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
128 p_dev->resource[0]->start = cf->io.win[0].base;
129 p_dev->resource[0]->end = cf->io.win[0].len;
130 p_dev->io_lines = 5; 70 p_dev->io_lines = 5;
71
131 return pcmcia_request_io(p_dev); 72 return pcmcia_request_io(p_dev);
132} 73}
133 74
@@ -161,7 +102,7 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
161 /* 102 /*
162 * configure the PCMCIA socket 103 * configure the PCMCIA socket
163 */ 104 */
164 i = pcmcia_request_configuration(link, &link->conf); 105 i = pcmcia_enable_device(link);
165 if (i != 0) { 106 if (i != 0) {
166 pcmcia_disable_device(link); 107 pcmcia_disable_device(link);
167 break; 108 break;
@@ -175,9 +116,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
175 return -ENODEV; 116 return -ENODEV;
176 } 117 }
177 118
178 printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n",
179 (unsigned int) link->resource[0]->start, link->irq);
180
181 icard.para[0] = link->irq; 119 icard.para[0] = link->irq;
182 icard.para[1] = link->resource[0]->start; 120 icard.para[1] = link->resource[0]->start;
183 icard.protocol = isdnprot; 121 icard.protocol = isdnprot;
@@ -196,14 +134,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
196 return 0; 134 return 0;
197} /* avma1cs_config */ 135} /* avma1cs_config */
198 136
199/*======================================================================
200
201 After a card is removed, avma1cs_release() will unregister the net
202 device, and release the PCMCIA configuration. If the device is
203 still open, this will be postponed until it is closed.
204
205======================================================================*/
206
207static void avma1cs_release(struct pcmcia_device *link) 137static void avma1cs_release(struct pcmcia_device *link)
208{ 138{
209 unsigned long minor = (unsigned long) link->priv; 139 unsigned long minor = (unsigned long) link->priv;
@@ -216,8 +146,7 @@ static void avma1cs_release(struct pcmcia_device *link)
216 pcmcia_disable_device(link); 146 pcmcia_disable_device(link);
217} /* avma1cs_release */ 147} /* avma1cs_release */
218 148
219 149static const struct pcmcia_device_id avma1cs_ids[] = {
220static struct pcmcia_device_id avma1cs_ids[] = {
221 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), 150 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb),
222 PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b), 151 PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b),
223 PCMCIA_DEVICE_NULL 152 PCMCIA_DEVICE_NULL
@@ -226,19 +155,15 @@ MODULE_DEVICE_TABLE(pcmcia, avma1cs_ids);
226 155
227static struct pcmcia_driver avma1cs_driver = { 156static struct pcmcia_driver avma1cs_driver = {
228 .owner = THIS_MODULE, 157 .owner = THIS_MODULE,
229 .drv = { 158 .name = "avma1_cs",
230 .name = "avma1_cs",
231 },
232 .probe = avma1cs_probe, 159 .probe = avma1cs_probe,
233 .remove = __devexit_p(avma1cs_detach), 160 .remove = __devexit_p(avma1cs_detach),
234 .id_table = avma1cs_ids, 161 .id_table = avma1cs_ids,
235}; 162};
236 163
237/*====================================================================*/
238
239static int __init init_avma1_cs(void) 164static int __init init_avma1_cs(void)
240{ 165{
241 return(pcmcia_register_driver(&avma1cs_driver)); 166 return pcmcia_register_driver(&avma1cs_driver);
242} 167}
243 168
244static void __exit exit_avma1_cs(void) 169static void __exit exit_avma1_cs(void)
diff --git a/drivers/isdn/hisax/callc.c b/drivers/isdn/hisax/callc.c
index f150330b5a23..37e685eafd24 100644
--- a/drivers/isdn/hisax/callc.c
+++ b/drivers/isdn/hisax/callc.c
@@ -65,7 +65,7 @@ hisax_findcard(int driverid)
65 return (struct IsdnCardState *) 0; 65 return (struct IsdnCardState *) 0;
66} 66}
67 67
68static void 68static __attribute__((format(printf, 3, 4))) void
69link_debug(struct Channel *chanp, int direction, char *fmt, ...) 69link_debug(struct Channel *chanp, int direction, char *fmt, ...)
70{ 70{
71 va_list args; 71 va_list args;
@@ -1068,7 +1068,7 @@ init_d_st(struct Channel *chanp)
1068 return 0; 1068 return 0;
1069} 1069}
1070 1070
1071static void 1071static __attribute__((format(printf, 2, 3))) void
1072callc_debug(struct FsmInst *fi, char *fmt, ...) 1072callc_debug(struct FsmInst *fi, char *fmt, ...)
1073{ 1073{
1074 va_list args; 1074 va_list args;
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index 6f9afcd5ca4e..c110f8679bab 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -801,6 +801,16 @@ static void closecard(int cardnr)
801 ll_unload(csta); 801 ll_unload(csta);
802} 802}
803 803
804static irqreturn_t card_irq(int intno, void *dev_id)
805{
806 struct IsdnCardState *cs = dev_id;
807 irqreturn_t ret = cs->irq_func(intno, cs);
808
809 if (ret == IRQ_HANDLED)
810 cs->irq_cnt++;
811 return ret;
812}
813
804static int init_card(struct IsdnCardState *cs) 814static int init_card(struct IsdnCardState *cs)
805{ 815{
806 int irq_cnt, cnt = 3, ret; 816 int irq_cnt, cnt = 3, ret;
@@ -809,10 +819,10 @@ static int init_card(struct IsdnCardState *cs)
809 ret = cs->cardmsg(cs, CARD_INIT, NULL); 819 ret = cs->cardmsg(cs, CARD_INIT, NULL);
810 return(ret); 820 return(ret);
811 } 821 }
812 irq_cnt = kstat_irqs(cs->irq); 822 irq_cnt = cs->irq_cnt = 0;
813 printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ], 823 printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ],
814 cs->irq, irq_cnt); 824 cs->irq, irq_cnt);
815 if (request_irq(cs->irq, cs->irq_func, cs->irq_flags, "HiSax", cs)) { 825 if (request_irq(cs->irq, card_irq, cs->irq_flags, "HiSax", cs)) {
816 printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n", 826 printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n",
817 cs->irq); 827 cs->irq);
818 return 1; 828 return 1;
@@ -822,8 +832,8 @@ static int init_card(struct IsdnCardState *cs)
822 /* Timeout 10ms */ 832 /* Timeout 10ms */
823 msleep(10); 833 msleep(10);
824 printk(KERN_INFO "%s: IRQ %d count %d\n", 834 printk(KERN_INFO "%s: IRQ %d count %d\n",
825 CardType[cs->typ], cs->irq, kstat_irqs(cs->irq)); 835 CardType[cs->typ], cs->irq, cs->irq_cnt);
826 if (kstat_irqs(cs->irq) == irq_cnt) { 836 if (cs->irq_cnt == irq_cnt) {
827 printk(KERN_WARNING 837 printk(KERN_WARNING
828 "%s: IRQ(%d) getting no interrupts during init %d\n", 838 "%s: IRQ(%d) getting no interrupts during init %d\n",
829 CardType[cs->typ], cs->irq, 4 - cnt); 839 CardType[cs->typ], cs->irq, 4 - cnt);
@@ -1907,7 +1917,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if)
1907#ifdef CONFIG_PCI 1917#ifdef CONFIG_PCI
1908#include <linux/pci.h> 1918#include <linux/pci.h>
1909 1919
1910static struct pci_device_id hisax_pci_tbl[] __devinitdata = { 1920static struct pci_device_id hisax_pci_tbl[] __devinitdata __used = {
1911#ifdef CONFIG_HISAX_FRITZPCI 1921#ifdef CONFIG_HISAX_FRITZPCI
1912 {PCI_VDEVICE(AVM, PCI_DEVICE_ID_AVM_A1) }, 1922 {PCI_VDEVICE(AVM, PCI_DEVICE_ID_AVM_A1) },
1913#endif 1923#endif
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index b3c08aaf41c4..f0b6c0ef99bb 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -46,7 +46,6 @@
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/system.h> 47#include <asm/system.h>
48 48
49#include <pcmcia/cs.h>
50#include <pcmcia/cistpl.h> 49#include <pcmcia/cistpl.h>
51#include <pcmcia/cisreg.h> 50#include <pcmcia/cisreg.h>
52#include <pcmcia/ds.h> 51#include <pcmcia/ds.h>
@@ -64,26 +63,8 @@ MODULE_LICENSE("Dual MPL/GPL");
64static int protocol = 2; /* EURO-ISDN Default */ 63static int protocol = 2; /* EURO-ISDN Default */
65module_param(protocol, int, 0); 64module_param(protocol, int, 0);
66 65
67/*====================================================================*/
68
69/*
70 The event() function is this driver's Card Services event handler.
71 It will be called by Card Services when an appropriate card status
72 event is received. The config() and release() entry points are
73 used to configure or release a socket, in response to card insertion
74 and ejection events. They are invoked from the elsa_cs event
75 handler.
76*/
77
78static int elsa_cs_config(struct pcmcia_device *link) __devinit ; 66static int elsa_cs_config(struct pcmcia_device *link) __devinit ;
79static void elsa_cs_release(struct pcmcia_device *link); 67static void elsa_cs_release(struct pcmcia_device *link);
80
81/*
82 The attach() and detach() entry points are used to create and destroy
83 "instances" of the driver, where each instance represents everything
84 needed to manage one actual PCMCIA card.
85*/
86
87static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit; 68static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit;
88 69
89typedef struct local_info_t { 70typedef struct local_info_t {
@@ -92,18 +73,6 @@ typedef struct local_info_t {
92 int cardnr; 73 int cardnr;
93} local_info_t; 74} local_info_t;
94 75
95/*======================================================================
96
97 elsa_cs_attach() creates an "instance" of the driver, allocatingx
98 local data structures for one device. The device is registered
99 with Card Services.
100
101 The dev_link structure is initialized, but we don't actually
102 configure the card at this point -- we wait until we receive a
103 card insertion event.
104
105======================================================================*/
106
107static int __devinit elsa_cs_probe(struct pcmcia_device *link) 76static int __devinit elsa_cs_probe(struct pcmcia_device *link)
108{ 77{
109 local_info_t *local; 78 local_info_t *local;
@@ -119,31 +88,9 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link)
119 88
120 local->cardnr = -1; 89 local->cardnr = -1;
121 90
122 /*
123 General socket configuration defaults can go here. In this
124 client, we assume very little, and rely on the CIS for almost
125 everything. In most clients, many details (i.e., number, sizes,
126 and attributes of IO windows) are fixed by the nature of the
127 device, and can be hard-wired here.
128 */
129 link->resource[0]->end = 8;
130 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
131
132 link->conf.Attributes = CONF_ENABLE_IRQ;
133 link->conf.IntType = INT_MEMORY_AND_IO;
134
135 return elsa_cs_config(link); 91 return elsa_cs_config(link);
136} /* elsa_cs_attach */ 92} /* elsa_cs_attach */
137 93
138/*======================================================================
139
140 This deletes a driver "instance". The device is de-registered
141 with Card Services. If it has been released, all local data
142 structures are freed. Otherwise, the structures will be freed
143 when the device is released.
144
145======================================================================*/
146
147static void __devexit elsa_cs_detach(struct pcmcia_device *link) 94static void __devexit elsa_cs_detach(struct pcmcia_device *link)
148{ 95{
149 local_info_t *info = link->priv; 96 local_info_t *info = link->priv;
@@ -156,27 +103,17 @@ static void __devexit elsa_cs_detach(struct pcmcia_device *link)
156 kfree(info); 103 kfree(info);
157} /* elsa_cs_detach */ 104} /* elsa_cs_detach */
158 105
159/*====================================================================== 106static int elsa_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
160
161 elsa_cs_config() is scheduled to run after a CARD_INSERTION event
162 is received, to configure the PCMCIA socket, and to make the
163 device available to the system.
164
165======================================================================*/
166
167static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
168 cistpl_cftable_entry_t *cf,
169 cistpl_cftable_entry_t *dflt,
170 unsigned int vcc,
171 void *priv_data)
172{ 107{
173 int j; 108 int j;
174 109
175 p_dev->io_lines = 3; 110 p_dev->io_lines = 3;
111 p_dev->resource[0]->end = 8;
112 p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH;
113 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
176 114
177 if ((cf->io.nwin > 0) && cf->io.win[0].base) { 115 if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) {
178 printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); 116 printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n");
179 p_dev->resource[0]->start = cf->io.win[0].base;
180 if (!pcmcia_request_io(p_dev)) 117 if (!pcmcia_request_io(p_dev))
181 return 0; 118 return 0;
182 } else { 119 } else {
@@ -192,12 +129,12 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
192 129
193static int __devinit elsa_cs_config(struct pcmcia_device *link) 130static int __devinit elsa_cs_config(struct pcmcia_device *link)
194{ 131{
195 local_info_t *dev;
196 int i; 132 int i;
197 IsdnCard_t icard; 133 IsdnCard_t icard;
198 134
199 dev_dbg(&link->dev, "elsa_config(0x%p)\n", link); 135 dev_dbg(&link->dev, "elsa_config(0x%p)\n", link);
200 dev = link->priv; 136
137 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
201 138
202 i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); 139 i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL);
203 if (i != 0) 140 if (i != 0)
@@ -206,21 +143,10 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link)
206 if (!link->irq) 143 if (!link->irq)
207 goto failed; 144 goto failed;
208 145
209 i = pcmcia_request_configuration(link, &link->conf); 146 i = pcmcia_enable_device(link);
210 if (i != 0) 147 if (i != 0)
211 goto failed; 148 goto failed;
212 149
213 /* Finally, report what we've done */
214 dev_info(&link->dev, "index 0x%02x: ",
215 link->conf.ConfigIndex);
216 if (link->conf.Attributes & CONF_ENABLE_IRQ)
217 printk(", irq %d", link->irq);
218 if (link->resource[0])
219 printk(" & %pR", link->resource[0]);
220 if (link->resource[1])
221 printk(" & %pR", link->resource[1]);
222 printk("\n");
223
224 icard.para[0] = link->irq; 150 icard.para[0] = link->irq;
225 icard.para[1] = link->resource[0]->start; 151 icard.para[1] = link->resource[0]->start;
226 icard.protocol = protocol; 152 icard.protocol = protocol;
@@ -240,14 +166,6 @@ failed:
240 return -ENODEV; 166 return -ENODEV;
241} /* elsa_cs_config */ 167} /* elsa_cs_config */
242 168
243/*======================================================================
244
245 After a card is removed, elsa_cs_release() will unregister the net
246 device, and release the PCMCIA configuration. If the device is
247 still open, this will be postponed until it is closed.
248
249======================================================================*/
250
251static void elsa_cs_release(struct pcmcia_device *link) 169static void elsa_cs_release(struct pcmcia_device *link)
252{ 170{
253 local_info_t *local = link->priv; 171 local_info_t *local = link->priv;
@@ -282,7 +200,7 @@ static int elsa_resume(struct pcmcia_device *link)
282 return 0; 200 return 0;
283} 201}
284 202
285static struct pcmcia_device_id elsa_ids[] = { 203static const struct pcmcia_device_id elsa_ids[] = {
286 PCMCIA_DEVICE_PROD_ID12("ELSA AG (Aachen, Germany)", "MicroLink ISDN/MC ", 0x983de2c4, 0x333ba257), 204 PCMCIA_DEVICE_PROD_ID12("ELSA AG (Aachen, Germany)", "MicroLink ISDN/MC ", 0x983de2c4, 0x333ba257),
287 PCMCIA_DEVICE_PROD_ID12("ELSA GmbH, Aachen", "MicroLink ISDN/MC ", 0x639e5718, 0x333ba257), 205 PCMCIA_DEVICE_PROD_ID12("ELSA GmbH, Aachen", "MicroLink ISDN/MC ", 0x639e5718, 0x333ba257),
288 PCMCIA_DEVICE_NULL 206 PCMCIA_DEVICE_NULL
@@ -291,9 +209,7 @@ MODULE_DEVICE_TABLE(pcmcia, elsa_ids);
291 209
292static struct pcmcia_driver elsa_cs_driver = { 210static struct pcmcia_driver elsa_cs_driver = {
293 .owner = THIS_MODULE, 211 .owner = THIS_MODULE,
294 .drv = { 212 .name = "elsa_cs",
295 .name = "elsa_cs",
296 },
297 .probe = elsa_cs_probe, 213 .probe = elsa_cs_probe,
298 .remove = __devexit_p(elsa_cs_detach), 214 .remove = __devexit_p(elsa_cs_detach),
299 .id_table = elsa_ids, 215 .id_table = elsa_ids,
diff --git a/drivers/isdn/hisax/elsa_ser.c b/drivers/isdn/hisax/elsa_ser.c
index cbda3790a10d..3fa9f6171095 100644
--- a/drivers/isdn/hisax/elsa_ser.c
+++ b/drivers/isdn/hisax/elsa_ser.c
@@ -109,11 +109,10 @@ static void change_speed(struct IsdnCardState *cs, int baud)
109{ 109{
110 int quot = 0, baud_base; 110 int quot = 0, baud_base;
111 unsigned cval, fcr = 0; 111 unsigned cval, fcr = 0;
112 int bits;
113 112
114 113
115 /* byte size and parity */ 114 /* byte size and parity */
116 cval = 0x03; bits = 10; 115 cval = 0x03;
117 /* Determine divisor based on baud rate */ 116 /* Determine divisor based on baud rate */
118 baud_base = BASE_BAUD; 117 baud_base = BASE_BAUD;
119 quot = baud_base / baud; 118 quot = baud_base / baud;
diff --git a/drivers/isdn/hisax/hfc_2bds0.c b/drivers/isdn/hisax/hfc_2bds0.c
index 7250f56a5246..a16459a1332c 100644
--- a/drivers/isdn/hisax/hfc_2bds0.c
+++ b/drivers/isdn/hisax/hfc_2bds0.c
@@ -292,7 +292,7 @@ hfc_fill_fifo(struct BCState *bcs)
292 } 292 }
293 count = GetFreeFifoBytes_B(bcs); 293 count = GetFreeFifoBytes_B(bcs);
294 if (cs->debug & L1_DEB_HSCX) 294 if (cs->debug & L1_DEB_HSCX)
295 debugl1(cs, "hfc_fill_fifo %d count(%ld/%d),%lx", 295 debugl1(cs, "hfc_fill_fifo %d count(%u/%d),%lx",
296 bcs->channel, bcs->tx_skb->len, 296 bcs->channel, bcs->tx_skb->len,
297 count, current->state); 297 count, current->state);
298 if (count < bcs->tx_skb->len) { 298 if (count < bcs->tx_skb->len) {
@@ -719,7 +719,7 @@ hfc_fill_dfifo(struct IsdnCardState *cs)
719 } 719 }
720 count = GetFreeFifoBytes_D(cs); 720 count = GetFreeFifoBytes_D(cs);
721 if (cs->debug & L1_DEB_ISAC) 721 if (cs->debug & L1_DEB_ISAC)
722 debugl1(cs, "hfc_fill_Dfifo count(%ld/%d)", 722 debugl1(cs, "hfc_fill_Dfifo count(%u/%d)",
723 cs->tx_skb->len, count); 723 cs->tx_skb->len, count);
724 if (count < cs->tx_skb->len) { 724 if (count < cs->tx_skb->len) {
725 if (cs->debug & L1_DEB_ISAC) 725 if (cs->debug & L1_DEB_ISAC)
diff --git a/drivers/isdn/hisax/hfc_2bs0.c b/drivers/isdn/hisax/hfc_2bs0.c
index b1f6481e1193..626f85df302b 100644
--- a/drivers/isdn/hisax/hfc_2bs0.c
+++ b/drivers/isdn/hisax/hfc_2bs0.c
@@ -282,7 +282,7 @@ hfc_fill_fifo(struct BCState *bcs)
282 count += cs->hw.hfc.fifosize; 282 count += cs->hw.hfc.fifosize;
283 } /* L1_MODE_TRANS */ 283 } /* L1_MODE_TRANS */
284 if (cs->debug & L1_DEB_HSCX) 284 if (cs->debug & L1_DEB_HSCX)
285 debugl1(cs, "hfc_fill_fifo %d count(%ld/%d)", 285 debugl1(cs, "hfc_fill_fifo %d count(%u/%d)",
286 bcs->channel, bcs->tx_skb->len, 286 bcs->channel, bcs->tx_skb->len,
287 count); 287 count);
288 if (count < bcs->tx_skb->len) { 288 if (count < bcs->tx_skb->len) {
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index 917cc84065bd..0cb0546ead88 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -146,7 +146,7 @@ reset_hfcpci(struct IsdnCardState *cs)
146 /* D- and monitor/CI channel are not enabled */ 146 /* D- and monitor/CI channel are not enabled */
147 /* STIO1 is used as output for data, B1+B2 from ST->IOM+HFC */ 147 /* STIO1 is used as output for data, B1+B2 from ST->IOM+HFC */
148 /* STIO2 is used as data input, B1+B2 from IOM->ST */ 148 /* STIO2 is used as data input, B1+B2 from IOM->ST */
149 /* ST B-channel send disabled -> continous 1s */ 149 /* ST B-channel send disabled -> continuous 1s */
150 /* The IOM slots are always enabled */ 150 /* The IOM slots are always enabled */
151 cs->hw.hfcpci.conn = 0x36; /* set data flow directions */ 151 cs->hw.hfcpci.conn = 0x36; /* set data flow directions */
152 Write_hfc(cs, HFCPCI_CONNECT, cs->hw.hfcpci.conn); 152 Write_hfc(cs, HFCPCI_CONNECT, cs->hw.hfcpci.conn);
@@ -550,7 +550,7 @@ hfcpci_fill_dfifo(struct IsdnCardState *cs)
550 count += D_FIFO_SIZE; /* count now contains available bytes */ 550 count += D_FIFO_SIZE; /* count now contains available bytes */
551 551
552 if (cs->debug & L1_DEB_ISAC) 552 if (cs->debug & L1_DEB_ISAC)
553 debugl1(cs, "hfcpci_fill_Dfifo count(%ld/%d)", 553 debugl1(cs, "hfcpci_fill_Dfifo count(%u/%d)",
554 cs->tx_skb->len, count); 554 cs->tx_skb->len, count);
555 if (count < cs->tx_skb->len) { 555 if (count < cs->tx_skb->len) {
556 if (cs->debug & L1_DEB_ISAC) 556 if (cs->debug & L1_DEB_ISAC)
@@ -681,7 +681,7 @@ hfcpci_fill_fifo(struct BCState *bcs)
681 count += B_FIFO_SIZE; /* count now contains available bytes */ 681 count += B_FIFO_SIZE; /* count now contains available bytes */
682 682
683 if (cs->debug & L1_DEB_HSCX) 683 if (cs->debug & L1_DEB_HSCX)
684 debugl1(cs, "hfcpci_fill_fifo %d count(%ld/%d),%lx", 684 debugl1(cs, "hfcpci_fill_fifo %d count(%u/%d),%lx",
685 bcs->channel, bcs->tx_skb->len, 685 bcs->channel, bcs->tx_skb->len,
686 count, current->state); 686 count, current->state);
687 687
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c
index be5faf4aa868..156d7c63d944 100644
--- a/drivers/isdn/hisax/hfc_sx.c
+++ b/drivers/isdn/hisax/hfc_sx.c
@@ -179,7 +179,7 @@ write_fifo(struct IsdnCardState *cs, struct sk_buff *skb, u_char fifo, int trans
179 count += fifo_size; /* count now contains available bytes */ 179 count += fifo_size; /* count now contains available bytes */
180 180
181 if (cs->debug & L1_DEB_ISAC_FIFO) 181 if (cs->debug & L1_DEB_ISAC_FIFO)
182 debugl1(cs, "hfcsx_write_fifo %d count(%ld/%d)", 182 debugl1(cs, "hfcsx_write_fifo %d count(%u/%d)",
183 fifo, skb->len, count); 183 fifo, skb->len, count);
184 if (count < skb->len) { 184 if (count < skb->len) {
185 if (cs->debug & L1_DEB_ISAC_FIFO) 185 if (cs->debug & L1_DEB_ISAC_FIFO)
@@ -234,13 +234,14 @@ read_fifo(struct IsdnCardState *cs, u_char fifo, int trans_max)
234 count++; 234 count++;
235 if (count > trans_max) 235 if (count > trans_max)
236 count = trans_max; /* limit length */ 236 count = trans_max; /* limit length */
237 if ((skb = dev_alloc_skb(count))) { 237 skb = dev_alloc_skb(count);
238 dst = skb_put(skb, count); 238 if (skb) {
239 while (count--) 239 dst = skb_put(skb, count);
240 while (count--)
240 *dst++ = Read_hfc(cs, HFCSX_FIF_DRD); 241 *dst++ = Read_hfc(cs, HFCSX_FIF_DRD);
241 return(skb); 242 return skb;
242 } 243 } else
243 else return(NULL); /* no memory */ 244 return NULL; /* no memory */
244 } 245 }
245 246
246 do { 247 do {
@@ -264,7 +265,7 @@ read_fifo(struct IsdnCardState *cs, u_char fifo, int trans_max)
264 count++; 265 count++;
265 266
266 if (cs->debug & L1_DEB_ISAC_FIFO) 267 if (cs->debug & L1_DEB_ISAC_FIFO)
267 debugl1(cs, "hfcsx_read_fifo %d count %ld)", 268 debugl1(cs, "hfcsx_read_fifo %d count %u)",
268 fifo, count); 269 fifo, count);
269 270
270 if ((count > fifo_size) || (count < 4)) { 271 if ((count > fifo_size) || (count < 4)) {
@@ -398,7 +399,7 @@ reset_hfcsx(struct IsdnCardState *cs)
398 /* D- and monitor/CI channel are not enabled */ 399 /* D- and monitor/CI channel are not enabled */
399 /* STIO1 is used as output for data, B1+B2 from ST->IOM+HFC */ 400 /* STIO1 is used as output for data, B1+B2 from ST->IOM+HFC */
400 /* STIO2 is used as data input, B1+B2 from IOM->ST */ 401 /* STIO2 is used as data input, B1+B2 from IOM->ST */
401 /* ST B-channel send disabled -> continous 1s */ 402 /* ST B-channel send disabled -> continuous 1s */
402 /* The IOM slots are always enabled */ 403 /* The IOM slots are always enabled */
403 cs->hw.hfcsx.conn = 0x36; /* set data flow directions */ 404 cs->hw.hfcsx.conn = 0x36; /* set data flow directions */
404 Write_hfc(cs, HFCSX_CONNECT, cs->hw.hfcsx.conn); 405 Write_hfc(cs, HFCSX_CONNECT, cs->hw.hfcsx.conn);
@@ -985,7 +986,7 @@ HFCSX_l1hw(struct PStack *st, int pr, void *arg)
985 default: 986 default:
986 spin_unlock_irqrestore(&cs->lock, flags); 987 spin_unlock_irqrestore(&cs->lock, flags);
987 if (cs->debug & L1_DEB_WARN) 988 if (cs->debug & L1_DEB_WARN)
988 debugl1(cs, "hfcsx_l1hw loop invalid %4lx", arg); 989 debugl1(cs, "hfcsx_l1hw loop invalid %4lx", (unsigned long)arg);
989 return; 990 return;
990 } 991 }
991 cs->hw.hfcsx.trm |= 0x80; /* enable IOM-loop */ 992 cs->hw.hfcsx.trm |= 0x80; /* enable IOM-loop */
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index ed9527aa5f2c..f407de0e006d 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -258,11 +258,9 @@ static void
258ctrl_complete(struct urb *urb) 258ctrl_complete(struct urb *urb)
259{ 259{
260 hfcusb_data *hfc = (hfcusb_data *) urb->context; 260 hfcusb_data *hfc = (hfcusb_data *) urb->context;
261 ctrl_buft *buf;
262 261
263 urb->dev = hfc->dev; 262 urb->dev = hfc->dev;
264 if (hfc->ctrl_cnt) { 263 if (hfc->ctrl_cnt) {
265 buf = &hfc->ctrl_buff[hfc->ctrl_out_idx];
266 hfc->ctrl_cnt--; /* decrement actual count */ 264 hfc->ctrl_cnt--; /* decrement actual count */
267 if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE) 265 if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE)
268 hfc->ctrl_out_idx = 0; /* pointer wrap */ 266 hfc->ctrl_out_idx = 0; /* pointer wrap */
@@ -1097,7 +1095,7 @@ static int
1097hfc_usb_init(hfcusb_data * hfc) 1095hfc_usb_init(hfcusb_data * hfc)
1098{ 1096{
1099 usb_fifo *fifo; 1097 usb_fifo *fifo;
1100 int i, err; 1098 int i;
1101 u_char b; 1099 u_char b;
1102 struct hisax_b_if *p_b_if[2]; 1100 struct hisax_b_if *p_b_if[2];
1103 1101
@@ -1112,7 +1110,7 @@ hfc_usb_init(hfcusb_data * hfc)
1112 } 1110 }
1113 1111
1114 /* first set the needed config, interface and alternate */ 1112 /* first set the needed config, interface and alternate */
1115 err = usb_set_interface(hfc->dev, hfc->if_used, hfc->alt_used); 1113 usb_set_interface(hfc->dev, hfc->if_used, hfc->alt_used);
1116 1114
1117 /* do Chip reset */ 1115 /* do Chip reset */
1118 write_usb(hfc, HFCUSB_CIRM, 8); 1116 write_usb(hfc, HFCUSB_CIRM, 8);
diff --git a/drivers/isdn/hisax/hfc_usb.h b/drivers/isdn/hisax/hfc_usb.h
index e79f56568d30..2f581c0b4693 100644
--- a/drivers/isdn/hisax/hfc_usb.h
+++ b/drivers/isdn/hisax/hfc_usb.h
@@ -126,7 +126,7 @@ static struct hfcusb_symbolic_list urb_errlist[] = {
126 126
127 127
128/* 128/*
129 * device dependant information to support different 129 * device dependent information to support different
130 * ISDN Ta's using the HFC-S USB chip 130 * ISDN Ta's using the HFC-S USB chip
131 */ 131 */
132 132
diff --git a/drivers/isdn/hisax/hisax.h b/drivers/isdn/hisax/hisax.h
index 832a87855ffb..de1c669c7b13 100644
--- a/drivers/isdn/hisax/hisax.h
+++ b/drivers/isdn/hisax/hisax.h
@@ -959,6 +959,7 @@ struct IsdnCardState {
959 u_long event; 959 u_long event;
960 struct work_struct tqueue; 960 struct work_struct tqueue;
961 struct timer_list dbusytimer; 961 struct timer_list dbusytimer;
962 unsigned int irq_cnt;
962#ifdef ERROR_STATISTIC 963#ifdef ERROR_STATISTIC
963 int err_crc; 964 int err_crc;
964 int err_tx; 965 int err_tx;
@@ -1285,7 +1286,9 @@ int jiftime(char *s, long mark);
1285 1286
1286int HiSax_command(isdn_ctrl * ic); 1287int HiSax_command(isdn_ctrl * ic);
1287int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb); 1288int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb);
1289__attribute__((format(printf, 3, 4)))
1288void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...); 1290void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...);
1291__attribute__((format(printf, 3, 0)))
1289void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, va_list args); 1292void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, va_list args);
1290void HiSax_reportcard(int cardnr, int sel); 1293void HiSax_reportcard(int cardnr, int sel);
1291int QuickHex(char *txt, u_char * p, int cnt); 1294int QuickHex(char *txt, u_char * p, int cnt);
diff --git a/drivers/isdn/hisax/ipacx.c b/drivers/isdn/hisax/ipacx.c
index 751b25f2ff58..690840444184 100644
--- a/drivers/isdn/hisax/ipacx.c
+++ b/drivers/isdn/hisax/ipacx.c
@@ -96,7 +96,7 @@ dch_l2l1(struct PStack *st, int pr, void *arg)
96{ 96{
97 struct IsdnCardState *cs = (struct IsdnCardState *) st->l1.hardware; 97 struct IsdnCardState *cs = (struct IsdnCardState *) st->l1.hardware;
98 struct sk_buff *skb = arg; 98 struct sk_buff *skb = arg;
99 u_char cda1_cr, cda2_cr; 99 u_char cda1_cr;
100 100
101 switch (pr) { 101 switch (pr) {
102 case (PH_DATA |REQUEST): 102 case (PH_DATA |REQUEST):
@@ -163,7 +163,7 @@ dch_l2l1(struct PStack *st, int pr, void *arg)
163 cs->writeisac(cs, IPACX_CDA_TSDP10, 0x80); // Timeslot 0 is B1 163 cs->writeisac(cs, IPACX_CDA_TSDP10, 0x80); // Timeslot 0 is B1
164 cs->writeisac(cs, IPACX_CDA_TSDP11, 0x81); // Timeslot 0 is B1 164 cs->writeisac(cs, IPACX_CDA_TSDP11, 0x81); // Timeslot 0 is B1
165 cda1_cr = cs->readisac(cs, IPACX_CDA1_CR); 165 cda1_cr = cs->readisac(cs, IPACX_CDA1_CR);
166 cda2_cr = cs->readisac(cs, IPACX_CDA2_CR); 166 (void) cs->readisac(cs, IPACX_CDA2_CR);
167 if ((long)arg &1) { // loop B1 167 if ((long)arg &1) { // loop B1
168 cs->writeisac(cs, IPACX_CDA1_CR, cda1_cr |0x0a); 168 cs->writeisac(cs, IPACX_CDA1_CR, cda1_cr |0x0a);
169 } 169 }
@@ -717,7 +717,7 @@ bch_mode(struct BCState *bcs, int mode, int bc)
717 717
718 bc = bc ? 1 : 0; // in case bc is greater than 1 718 bc = bc ? 1 : 0; // in case bc is greater than 1
719 if (cs->debug & L1_DEB_HSCX) 719 if (cs->debug & L1_DEB_HSCX)
720 debugl1(cs, "mode_bch() switch B-% mode %d chan %d", hscx, mode, bc); 720 debugl1(cs, "mode_bch() switch B-%d mode %d chan %d", hscx, mode, bc);
721 bcs->mode = mode; 721 bcs->mode = mode;
722 bcs->channel = bc; 722 bcs->channel = bc;
723 723
diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c
index 40b914bded8c..d4cce337add2 100644
--- a/drivers/isdn/hisax/isar.c
+++ b/drivers/isdn/hisax/isar.c
@@ -189,7 +189,7 @@ ISARVersion(struct IsdnCardState *cs, char *s)
189static int 189static int
190isar_load_firmware(struct IsdnCardState *cs, u_char __user *buf) 190isar_load_firmware(struct IsdnCardState *cs, u_char __user *buf)
191{ 191{
192 int ret, size, cnt, debug; 192 int cfu_ret, ret, size, cnt, debug;
193 u_char len, nom, noc; 193 u_char len, nom, noc;
194 u_short sadr, left, *sp; 194 u_short sadr, left, *sp;
195 u_char __user *p = buf; 195 u_char __user *p = buf;
@@ -212,9 +212,10 @@ isar_load_firmware(struct IsdnCardState *cs, u_char __user *buf)
212 cs->debug &= ~(L1_DEB_HSCX | L1_DEB_HSCX_FIFO); 212 cs->debug &= ~(L1_DEB_HSCX | L1_DEB_HSCX_FIFO);
213#endif 213#endif
214 214
215 if ((ret = copy_from_user(&size, p, sizeof(int)))) { 215 cfu_ret = copy_from_user(&size, p, sizeof(int));
216 printk(KERN_ERR"isar_load_firmware copy_from_user ret %d\n", ret); 216 if (cfu_ret) {
217 return ret; 217 printk(KERN_ERR"isar_load_firmware copy_from_user ret %d\n", cfu_ret);
218 return -EFAULT;
218 } 219 }
219 p += sizeof(int); 220 p += sizeof(int);
220 printk(KERN_DEBUG"isar_load_firmware size: %d\n", size); 221 printk(KERN_DEBUG"isar_load_firmware size: %d\n", size);
@@ -953,7 +954,7 @@ isar_pump_statev_modem(struct BCState *bcs, u_char devt) {
953 break; 954 break;
954 case PSEV_GSTN_CLR: 955 case PSEV_GSTN_CLR:
955 if (cs->debug & L1_DEB_HSCX) 956 if (cs->debug & L1_DEB_HSCX)
956 debugl1(cs, "pump stev GSTN CLEAR", devt); 957 debugl1(cs, "pump stev GSTN CLEAR");
957 break; 958 break;
958 default: 959 default:
959 if (cs->debug & L1_DEB_HSCX) 960 if (cs->debug & L1_DEB_HSCX)
@@ -1268,7 +1269,7 @@ isar_int_main(struct IsdnCardState *cs)
1268static void 1269static void
1269ftimer_handler(struct BCState *bcs) { 1270ftimer_handler(struct BCState *bcs) {
1270 if (bcs->cs->debug) 1271 if (bcs->cs->debug)
1271 debugl1(bcs->cs, "ftimer flags %04x", 1272 debugl1(bcs->cs, "ftimer flags %04lx",
1272 bcs->Flag); 1273 bcs->Flag);
1273 test_and_clear_bit(BC_FLG_FTI_RUN, &bcs->Flag); 1274 test_and_clear_bit(BC_FLG_FTI_RUN, &bcs->Flag);
1274 if (test_and_clear_bit(BC_FLG_LL_CONN, &bcs->Flag)) { 1275 if (test_and_clear_bit(BC_FLG_LL_CONN, &bcs->Flag)) {
@@ -1427,8 +1428,8 @@ modeisar(struct BCState *bcs, int mode, int bc)
1427 &bcs->hw.isar.reg->Flags)) 1428 &bcs->hw.isar.reg->Flags))
1428 bcs->hw.isar.dpath = 1; 1429 bcs->hw.isar.dpath = 1;
1429 else { 1430 else {
1430 printk(KERN_WARNING"isar modeisar analog funktions only with DP1\n"); 1431 printk(KERN_WARNING"isar modeisar analog functions only with DP1\n");
1431 debugl1(cs, "isar modeisar analog funktions only with DP1"); 1432 debugl1(cs, "isar modeisar analog functions only with DP1");
1432 return(1); 1433 return(1);
1433 } 1434 }
1434 break; 1435 break;
@@ -1748,7 +1749,7 @@ isar_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic) {
1748 struct BCState *bcs; 1749 struct BCState *bcs;
1749 1750
1750 if (cs->debug & L1_DEB_HSCX) 1751 if (cs->debug & L1_DEB_HSCX)
1751 debugl1(cs, "isar_auxcmd cmd/ch %x/%d", ic->command, ic->arg); 1752 debugl1(cs, "isar_auxcmd cmd/ch %x/%ld", ic->command, ic->arg);
1752 switch (ic->command) { 1753 switch (ic->command) {
1753 case (ISDN_CMD_FAXCMD): 1754 case (ISDN_CMD_FAXCMD):
1754 bcs = cs->channel[ic->arg].bcs; 1755 bcs = cs->channel[ic->arg].bcs;
diff --git a/drivers/isdn/hisax/isdnl1.h b/drivers/isdn/hisax/isdnl1.h
index 172ad4c8c961..425d86116f2b 100644
--- a/drivers/isdn/hisax/isdnl1.h
+++ b/drivers/isdn/hisax/isdnl1.h
@@ -21,6 +21,7 @@
21#define B_XMTBUFREADY 1 21#define B_XMTBUFREADY 1
22#define B_ACKPENDING 2 22#define B_ACKPENDING 2
23 23
24__attribute__((format(printf, 2, 3)))
24void debugl1(struct IsdnCardState *cs, char *fmt, ...); 25void debugl1(struct IsdnCardState *cs, char *fmt, ...);
25void DChannel_proc_xmt(struct IsdnCardState *cs); 26void DChannel_proc_xmt(struct IsdnCardState *cs);
26void DChannel_proc_rcv(struct IsdnCardState *cs); 27void DChannel_proc_rcv(struct IsdnCardState *cs);
diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c
index 0858791978d8..cfff0c41d298 100644
--- a/drivers/isdn/hisax/isdnl2.c
+++ b/drivers/isdn/hisax/isdnl2.c
@@ -1247,10 +1247,10 @@ static void
1247l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) 1247l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
1248{ 1248{
1249 struct PStack *st = fi->userdata; 1249 struct PStack *st = fi->userdata;
1250 struct sk_buff *skb, *oskb; 1250 struct sk_buff *skb;
1251 struct Layer2 *l2 = &st->l2; 1251 struct Layer2 *l2 = &st->l2;
1252 u_char header[MAX_HEADER_LEN]; 1252 u_char header[MAX_HEADER_LEN];
1253 int i; 1253 int i, hdr_space_needed;
1254 int unsigned p1; 1254 int unsigned p1;
1255 u_long flags; 1255 u_long flags;
1256 1256
@@ -1261,6 +1261,16 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
1261 if (!skb) 1261 if (!skb)
1262 return; 1262 return;
1263 1263
1264 hdr_space_needed = l2headersize(l2, 0);
1265 if (hdr_space_needed > skb_headroom(skb)) {
1266 struct sk_buff *orig_skb = skb;
1267
1268 skb = skb_realloc_headroom(skb, hdr_space_needed);
1269 if (!skb) {
1270 dev_kfree_skb(orig_skb);
1271 return;
1272 }
1273 }
1264 spin_lock_irqsave(&l2->lock, flags); 1274 spin_lock_irqsave(&l2->lock, flags);
1265 if(test_bit(FLG_MOD128, &l2->flag)) 1275 if(test_bit(FLG_MOD128, &l2->flag))
1266 p1 = (l2->vs - l2->va) % 128; 1276 p1 = (l2->vs - l2->va) % 128;
@@ -1285,19 +1295,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
1285 l2->vs = (l2->vs + 1) % 8; 1295 l2->vs = (l2->vs + 1) % 8;
1286 } 1296 }
1287 spin_unlock_irqrestore(&l2->lock, flags); 1297 spin_unlock_irqrestore(&l2->lock, flags);
1288 p1 = skb->data - skb->head; 1298 memcpy(skb_push(skb, i), header, i);
1289 if (p1 >= i)
1290 memcpy(skb_push(skb, i), header, i);
1291 else {
1292 printk(KERN_WARNING
1293 "isdl2 pull_iqueue skb header(%d/%d) too short\n", i, p1);
1294 oskb = skb;
1295 skb = alloc_skb(oskb->len + i, GFP_ATOMIC);
1296 memcpy(skb_put(skb, i), header, i);
1297 skb_copy_from_linear_data(oskb,
1298 skb_put(skb, oskb->len), oskb->len);
1299 dev_kfree_skb(oskb);
1300 }
1301 st->l2.l2l1(st, PH_PULL | INDICATION, skb); 1299 st->l2.l2l1(st, PH_PULL | INDICATION, skb);
1302 test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); 1300 test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag);
1303 if (!test_and_set_bit(FLG_T200_RUN, &st->l2.flag)) { 1301 if (!test_and_set_bit(FLG_T200_RUN, &st->l2.flag)) {
diff --git a/drivers/isdn/hisax/isdnl3.c b/drivers/isdn/hisax/isdnl3.c
index fd0b643ab740..ad291f21b201 100644
--- a/drivers/isdn/hisax/isdnl3.c
+++ b/drivers/isdn/hisax/isdnl3.c
@@ -66,7 +66,7 @@ static char *strL3Event[] =
66 "EV_TIMEOUT", 66 "EV_TIMEOUT",
67}; 67};
68 68
69static void 69static __attribute__((format(printf, 2, 3))) void
70l3m_debug(struct FsmInst *fi, char *fmt, ...) 70l3m_debug(struct FsmInst *fi, char *fmt, ...)
71{ 71{
72 va_list args; 72 va_list args;
diff --git a/drivers/isdn/hisax/jade.c b/drivers/isdn/hisax/jade.c
index ea8f840871d0..a06cea09158b 100644
--- a/drivers/isdn/hisax/jade.c
+++ b/drivers/isdn/hisax/jade.c
@@ -23,10 +23,9 @@
23int 23int
24JadeVersion(struct IsdnCardState *cs, char *s) 24JadeVersion(struct IsdnCardState *cs, char *s)
25{ 25{
26 int ver,i; 26 int ver;
27 int to = 50; 27 int to = 50;
28 cs->BC_Write_Reg(cs, -1, 0x50, 0x19); 28 cs->BC_Write_Reg(cs, -1, 0x50, 0x19);
29 i=0;
30 while (to) { 29 while (to) {
31 udelay(1); 30 udelay(1);
32 ver = cs->BC_Read_Reg(cs, -1, 0x60); 31 ver = cs->BC_Read_Reg(cs, -1, 0x60);
diff --git a/drivers/isdn/hisax/l3_1tr6.c b/drivers/isdn/hisax/l3_1tr6.c
index b0554f80bfb3..ee4dae1382e0 100644
--- a/drivers/isdn/hisax/l3_1tr6.c
+++ b/drivers/isdn/hisax/l3_1tr6.c
@@ -164,11 +164,9 @@ l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg)
164 char tmp[80]; 164 char tmp[80];
165 struct sk_buff *skb = arg; 165 struct sk_buff *skb = arg;
166 166
167 p = skb->data;
168
169 /* Channel Identification */ 167 /* Channel Identification */
170 p = skb->data; 168 p = findie(skb->data, skb->len, WE0_chanID, 0);
171 if ((p = findie(p, skb->len, WE0_chanID, 0))) { 169 if (p) {
172 if (p[1] != 1) { 170 if (p[1] != 1) {
173 l3_1tr6_error(pc, "setup wrong chanID len", skb); 171 l3_1tr6_error(pc, "setup wrong chanID len", skb);
174 return; 172 return;
diff --git a/drivers/isdn/hisax/l3dss1.c b/drivers/isdn/hisax/l3dss1.c
index cc6ee2d39880..b0d9ab1f21c0 100644
--- a/drivers/isdn/hisax/l3dss1.c
+++ b/drivers/isdn/hisax/l3dss1.c
@@ -1595,7 +1595,7 @@ l3dss1_setup(struct l3_process *pc, u_char pr, void *arg)
1595 * Bearer Capabilities 1595 * Bearer Capabilities
1596 */ 1596 */
1597 p = skb->data; 1597 p = skb->data;
1598 /* only the first occurence 'll be detected ! */ 1598 /* only the first occurrence 'll be detected ! */
1599 if ((p = findie(p, skb->len, 0x04, 0))) { 1599 if ((p = findie(p, skb->len, 0x04, 0))) {
1600 if ((p[1] < 2) || (p[1] > 11)) 1600 if ((p[1] < 2) || (p[1] > 11))
1601 err = 1; 1601 err = 1;
@@ -2161,7 +2161,7 @@ static void l3dss1_redir_req_early(struct l3_process *pc, u_char pr, void *arg)
2161 2161
2162/***********************************************/ 2162/***********************************************/
2163/* handle special commands for this protocol. */ 2163/* handle special commands for this protocol. */
2164/* Examples are call independant services like */ 2164/* Examples are call independent services like */
2165/* remote operations with dummy callref. */ 2165/* remote operations with dummy callref. */
2166/***********************************************/ 2166/***********************************************/
2167static int l3dss1_cmd_global(struct PStack *st, isdn_ctrl *ic) 2167static int l3dss1_cmd_global(struct PStack *st, isdn_ctrl *ic)
@@ -2943,7 +2943,7 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb)
2943static void 2943static void
2944dss1up(struct PStack *st, int pr, void *arg) 2944dss1up(struct PStack *st, int pr, void *arg)
2945{ 2945{
2946 int i, mt, cr, cause, callState; 2946 int i, mt, cr, callState;
2947 char *ptr; 2947 char *ptr;
2948 u_char *p; 2948 u_char *p;
2949 struct sk_buff *skb = arg; 2949 struct sk_buff *skb = arg;
@@ -3034,12 +3034,10 @@ dss1up(struct PStack *st, int pr, void *arg)
3034 return; 3034 return;
3035 } 3035 }
3036 } else if (mt == MT_STATUS) { 3036 } else if (mt == MT_STATUS) {
3037 cause = 0;
3038 if ((ptr = findie(skb->data, skb->len, IE_CAUSE, 0)) != NULL) { 3037 if ((ptr = findie(skb->data, skb->len, IE_CAUSE, 0)) != NULL) {
3039 ptr++; 3038 ptr++;
3040 if (*ptr++ == 2) 3039 if (*ptr++ == 2)
3041 ptr++; 3040 ptr++;
3042 cause = *ptr & 0x7f;
3043 } 3041 }
3044 callState = 0; 3042 callState = 0;
3045 if ((ptr = findie(skb->data, skb->len, IE_CALL_STATE, 0)) != NULL) { 3043 if ((ptr = findie(skb->data, skb->len, IE_CALL_STATE, 0)) != NULL) {
diff --git a/drivers/isdn/hisax/l3ni1.c b/drivers/isdn/hisax/l3ni1.c
index f9584491fe8e..092dcbb39d94 100644
--- a/drivers/isdn/hisax/l3ni1.c
+++ b/drivers/isdn/hisax/l3ni1.c
@@ -1449,7 +1449,7 @@ l3ni1_setup(struct l3_process *pc, u_char pr, void *arg)
1449 * Bearer Capabilities 1449 * Bearer Capabilities
1450 */ 1450 */
1451 p = skb->data; 1451 p = skb->data;
1452 /* only the first occurence 'll be detected ! */ 1452 /* only the first occurrence 'll be detected ! */
1453 if ((p = findie(p, skb->len, 0x04, 0))) { 1453 if ((p = findie(p, skb->len, 0x04, 0))) {
1454 if ((p[1] < 2) || (p[1] > 11)) 1454 if ((p[1] < 2) || (p[1] > 11))
1455 err = 1; 1455 err = 1;
@@ -2017,7 +2017,7 @@ static void l3ni1_redir_req_early(struct l3_process *pc, u_char pr, void *arg)
2017 2017
2018/***********************************************/ 2018/***********************************************/
2019/* handle special commands for this protocol. */ 2019/* handle special commands for this protocol. */
2020/* Examples are call independant services like */ 2020/* Examples are call independent services like */
2021/* remote operations with dummy callref. */ 2021/* remote operations with dummy callref. */
2022/***********************************************/ 2022/***********************************************/
2023static int l3ni1_cmd_global(struct PStack *st, isdn_ctrl *ic) 2023static int l3ni1_cmd_global(struct PStack *st, isdn_ctrl *ic)
@@ -2883,7 +2883,7 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb)
2883static void 2883static void
2884ni1up(struct PStack *st, int pr, void *arg) 2884ni1up(struct PStack *st, int pr, void *arg)
2885{ 2885{
2886 int i, mt, cr, cause, callState; 2886 int i, mt, cr, callState;
2887 char *ptr; 2887 char *ptr;
2888 u_char *p; 2888 u_char *p;
2889 struct sk_buff *skb = arg; 2889 struct sk_buff *skb = arg;
@@ -2986,12 +2986,10 @@ ni1up(struct PStack *st, int pr, void *arg)
2986 return; 2986 return;
2987 } 2987 }
2988 } else if (mt == MT_STATUS) { 2988 } else if (mt == MT_STATUS) {
2989 cause = 0;
2990 if ((ptr = findie(skb->data, skb->len, IE_CAUSE, 0)) != NULL) { 2989 if ((ptr = findie(skb->data, skb->len, IE_CAUSE, 0)) != NULL) {
2991 ptr++; 2990 ptr++;
2992 if (*ptr++ == 2) 2991 if (*ptr++ == 2)
2993 ptr++; 2992 ptr++;
2994 cause = *ptr & 0x7f;
2995 } 2993 }
2996 callState = 0; 2994 callState = 0;
2997 if ((ptr = findie(skb->data, skb->len, IE_CALL_STATE, 0)) != NULL) { 2995 if ((ptr = findie(skb->data, skb->len, IE_CALL_STATE, 0)) != NULL) {
diff --git a/drivers/isdn/hisax/netjet.c b/drivers/isdn/hisax/netjet.c
index 5d7f0f2ff9b9..644891efc26f 100644
--- a/drivers/isdn/hisax/netjet.c
+++ b/drivers/isdn/hisax/netjet.c
@@ -254,7 +254,7 @@ static int make_raw_data(struct BCState *bcs) {
254 val >>= 1; 254 val >>= 1;
255 } 255 }
256 if (bcs->cs->debug & L1_DEB_HSCX) 256 if (bcs->cs->debug & L1_DEB_HSCX)
257 debugl1(bcs->cs,"tiger make_raw: in %ld out %d.%d", 257 debugl1(bcs->cs,"tiger make_raw: in %u out %d.%d",
258 bcs->tx_skb->len, s_cnt, bitcnt); 258 bcs->tx_skb->len, s_cnt, bitcnt);
259 if (bitcnt) { 259 if (bitcnt) {
260 while (8>bitcnt++) { 260 while (8>bitcnt++) {
@@ -361,7 +361,7 @@ static int make_raw_data_56k(struct BCState *bcs) {
361 val >>= 1; 361 val >>= 1;
362 } 362 }
363 if (bcs->cs->debug & L1_DEB_HSCX) 363 if (bcs->cs->debug & L1_DEB_HSCX)
364 debugl1(bcs->cs,"tiger make_raw_56k: in %ld out %d.%d", 364 debugl1(bcs->cs,"tiger make_raw_56k: in %u out %d.%d",
365 bcs->tx_skb->len, s_cnt, bitcnt); 365 bcs->tx_skb->len, s_cnt, bitcnt);
366 if (bitcnt) { 366 if (bitcnt) {
367 while (8>bitcnt++) { 367 while (8>bitcnt++) {
@@ -612,7 +612,7 @@ void netjet_fill_dma(struct BCState *bcs)
612 if (!bcs->tx_skb) 612 if (!bcs->tx_skb)
613 return; 613 return;
614 if (bcs->cs->debug & L1_DEB_HSCX) 614 if (bcs->cs->debug & L1_DEB_HSCX)
615 debugl1(bcs->cs,"tiger fill_dma1: c%d %4x", bcs->channel, 615 debugl1(bcs->cs,"tiger fill_dma1: c%d %4lx", bcs->channel,
616 bcs->Flag); 616 bcs->Flag);
617 if (test_and_set_bit(BC_FLG_BUSY, &bcs->Flag)) 617 if (test_and_set_bit(BC_FLG_BUSY, &bcs->Flag))
618 return; 618 return;
@@ -625,7 +625,7 @@ void netjet_fill_dma(struct BCState *bcs)
625 return; 625 return;
626 }; 626 };
627 if (bcs->cs->debug & L1_DEB_HSCX) 627 if (bcs->cs->debug & L1_DEB_HSCX)
628 debugl1(bcs->cs,"tiger fill_dma2: c%d %4x", bcs->channel, 628 debugl1(bcs->cs,"tiger fill_dma2: c%d %4lx", bcs->channel,
629 bcs->Flag); 629 bcs->Flag);
630 if (test_and_clear_bit(BC_FLG_NOFRAME, &bcs->Flag)) { 630 if (test_and_clear_bit(BC_FLG_NOFRAME, &bcs->Flag)) {
631 write_raw(bcs, bcs->hw.tiger.sendp, bcs->hw.tiger.free); 631 write_raw(bcs, bcs->hw.tiger.sendp, bcs->hw.tiger.free);
@@ -667,7 +667,7 @@ void netjet_fill_dma(struct BCState *bcs)
667 write_raw(bcs, p, cnt); 667 write_raw(bcs, p, cnt);
668 } 668 }
669 if (bcs->cs->debug & L1_DEB_HSCX) 669 if (bcs->cs->debug & L1_DEB_HSCX)
670 debugl1(bcs->cs,"tiger fill_dma3: c%d %4x", bcs->channel, 670 debugl1(bcs->cs,"tiger fill_dma3: c%d %4lx", bcs->channel,
671 bcs->Flag); 671 bcs->Flag);
672} 672}
673 673
diff --git a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c
index 2344e7b33448..a1b89524b505 100644
--- a/drivers/isdn/hisax/nj_s.c
+++ b/drivers/isdn/hisax/nj_s.c
@@ -167,7 +167,7 @@ static int __devinit njs_pci_probe(struct pci_dev *dev_netjet,
167 return(0); 167 return(0);
168 } 168 }
169 /* the TJ300 and TJ320 must be detected, the IRQ handling is different 169 /* the TJ300 and TJ320 must be detected, the IRQ handling is different
170 * unfortunatly the chips use the same device ID, but the TJ320 has 170 * unfortunately the chips use the same device ID, but the TJ320 has
171 * the bit20 in status PCI cfg register set 171 * the bit20 in status PCI cfg register set
172 */ 172 */
173 pci_read_config_dword(dev_netjet, 0x04, &cfg); 173 pci_read_config_dword(dev_netjet, 0x04, &cfg);
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index a024192b672a..06473f81f039 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -46,7 +46,6 @@
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/system.h> 47#include <asm/system.h>
48 48
49#include <pcmcia/cs.h>
50#include <pcmcia/cistpl.h> 49#include <pcmcia/cistpl.h>
51#include <pcmcia/cisreg.h> 50#include <pcmcia/cisreg.h>
52#include <pcmcia/ds.h> 51#include <pcmcia/ds.h>
@@ -64,26 +63,9 @@ MODULE_LICENSE("Dual MPL/GPL");
64static int protocol = 2; /* EURO-ISDN Default */ 63static int protocol = 2; /* EURO-ISDN Default */
65module_param(protocol, int, 0); 64module_param(protocol, int, 0);
66 65
67/*====================================================================*/
68
69/*
70 The event() function is this driver's Card Services event handler.
71 It will be called by Card Services when an appropriate card status
72 event is received. The config() and release() entry points are
73 used to configure or release a socket, in response to card
74 insertion and ejection events. They are invoked from the sedlbauer
75 event handler.
76*/
77
78static int sedlbauer_config(struct pcmcia_device *link) __devinit ; 66static int sedlbauer_config(struct pcmcia_device *link) __devinit ;
79static void sedlbauer_release(struct pcmcia_device *link); 67static void sedlbauer_release(struct pcmcia_device *link);
80 68
81/*
82 The attach() and detach() entry points are used to create and destroy
83 "instances" of the driver, where each instance represents everything
84 needed to manage one actual PCMCIA card.
85*/
86
87static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit; 69static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit;
88 70
89typedef struct local_info_t { 71typedef struct local_info_t {
@@ -92,18 +74,6 @@ typedef struct local_info_t {
92 int cardnr; 74 int cardnr;
93} local_info_t; 75} local_info_t;
94 76
95/*======================================================================
96
97 sedlbauer_attach() creates an "instance" of the driver, allocating
98 local data structures for one device. The device is registered
99 with Card Services.
100
101 The dev_link structure is initialized, but we don't actually
102 configure the card at this point -- we wait until we receive a
103 card insertion event.
104
105======================================================================*/
106
107static int __devinit sedlbauer_probe(struct pcmcia_device *link) 77static int __devinit sedlbauer_probe(struct pcmcia_device *link)
108{ 78{
109 local_info_t *local; 79 local_info_t *local;
@@ -118,35 +88,9 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link)
118 local->p_dev = link; 88 local->p_dev = link;
119 link->priv = local; 89 link->priv = local;
120 90
121 /*
122 General socket configuration defaults can go here. In this
123 client, we assume very little, and rely on the CIS for almost
124 everything. In most clients, many details (i.e., number, sizes,
125 and attributes of IO windows) are fixed by the nature of the
126 device, and can be hard-wired here.
127 */
128
129 /* from old sedl_cs
130 */
131 /* The io structure describes IO port mapping */
132 link->resource[0]->end = 8;
133 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
134
135 link->conf.Attributes = 0;
136 link->conf.IntType = INT_MEMORY_AND_IO;
137
138 return sedlbauer_config(link); 91 return sedlbauer_config(link);
139} /* sedlbauer_attach */ 92} /* sedlbauer_attach */
140 93
141/*======================================================================
142
143 This deletes a driver "instance". The device is de-registered
144 with Card Services. If it has been released, all local data
145 structures are freed. Otherwise, the structures will be freed
146 when the device is released.
147
148======================================================================*/
149
150static void __devexit sedlbauer_detach(struct pcmcia_device *link) 94static void __devexit sedlbauer_detach(struct pcmcia_device *link)
151{ 95{
152 dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link); 96 dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link);
@@ -158,70 +102,15 @@ static void __devexit sedlbauer_detach(struct pcmcia_device *link)
158 kfree(link->priv); 102 kfree(link->priv);
159} /* sedlbauer_detach */ 103} /* sedlbauer_detach */
160 104
161/*====================================================================== 105static int sedlbauer_config_check(struct pcmcia_device *p_dev, void *priv_data)
162
163 sedlbauer_config() is scheduled to run after a CARD_INSERTION event
164 is received, to configure the PCMCIA socket, and to make the
165 device available to the system.
166
167======================================================================*/
168static int sedlbauer_config_check(struct pcmcia_device *p_dev,
169 cistpl_cftable_entry_t *cfg,
170 cistpl_cftable_entry_t *dflt,
171 unsigned int vcc,
172 void *priv_data)
173{ 106{
174 if (cfg->index == 0) 107 if (p_dev->config_index == 0)
175 return -ENODEV; 108 return -EINVAL;
176
177 /* Does this card need audio output? */
178 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
179 p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
180 p_dev->conf.Status = CCSR_AUDIO_ENA;
181 }
182 109
183 /* Use power settings for Vcc and Vpp if present */ 110 p_dev->io_lines = 3;
184 /* Note that the CIS values need to be rescaled */ 111 return pcmcia_request_io(p_dev);
185 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
186 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
187 return -ENODEV;
188 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
189 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
190 return -ENODEV;
191 }
192
193 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
194 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
195 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
196 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
197
198 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
199
200 /* IO window settings */
201 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
202 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
203 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
204 p_dev->resource[0]->start = io->win[0].base;
205 p_dev->resource[0]->end = io->win[0].len;
206 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
207 p_dev->resource[0]->flags |=
208 pcmcia_io_cfg_data_width(io->flags);
209 if (io->nwin > 1) {
210 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
211 p_dev->resource[1]->start = io->win[1].base;
212 p_dev->resource[1]->end = io->win[1].len;
213 }
214 /* This reserves IO space but doesn't actually enable it */
215 p_dev->io_lines = 3;
216 if (pcmcia_request_io(p_dev) != 0)
217 return -ENODEV;
218 }
219
220 return 0;
221} 112}
222 113
223
224
225static int __devinit sedlbauer_config(struct pcmcia_device *link) 114static int __devinit sedlbauer_config(struct pcmcia_device *link)
226{ 115{
227 int ret; 116 int ret;
@@ -229,44 +118,17 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link)
229 118
230 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); 119 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link);
231 120
232 /* 121 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC |
233 In this loop, we scan the CIS for configuration table entries, 122 CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO;
234 each of which describes a valid card configuration, including 123
235 voltage, IO window, memory window, and interrupt settings.
236
237 We make no assumptions about the card to be configured: we use
238 just the information available in the CIS. In an ideal world,
239 this would work for any PCMCIA card, but it requires a complete
240 and accurate CIS. In practice, a driver usually "knows" most of
241 these things without consulting the CIS, and most client drivers
242 will only use the CIS to fill in implementation-defined details.
243 */
244 ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL); 124 ret = pcmcia_loop_config(link, sedlbauer_config_check, NULL);
245 if (ret) 125 if (ret)
246 goto failed; 126 goto failed;
247 127
248 /* 128 ret = pcmcia_enable_device(link);
249 This actually configures the PCMCIA socket -- setting up
250 the I/O windows and the interrupt mapping, and putting the
251 card and host interface into "Memory and IO" mode.
252 */
253 ret = pcmcia_request_configuration(link, &link->conf);
254 if (ret) 129 if (ret)
255 goto failed; 130 goto failed;
256 131
257 /* Finally, report what we've done */
258 dev_info(&link->dev, "index 0x%02x:",
259 link->conf.ConfigIndex);
260 if (link->conf.Vpp)
261 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
262 if (link->conf.Attributes & CONF_ENABLE_IRQ)
263 printk(", irq %d", link->irq);
264 if (link->resource[0])
265 printk(" & %pR", link->resource[0]);
266 if (link->resource[1])
267 printk(" & %pR", link->resource[1]);
268 printk("\n");
269
270 icard.para[0] = link->irq; 132 icard.para[0] = link->irq;
271 icard.para[1] = link->resource[0]->start; 133 icard.para[1] = link->resource[0]->start;
272 icard.protocol = protocol; 134 icard.protocol = protocol;
@@ -290,14 +152,6 @@ failed:
290 152
291} /* sedlbauer_config */ 153} /* sedlbauer_config */
292 154
293/*======================================================================
294
295 After a card is removed, sedlbauer_release() will unregister the
296 device, and release the PCMCIA configuration. If the device is
297 still open, this will be postponed until it is closed.
298
299======================================================================*/
300
301static void sedlbauer_release(struct pcmcia_device *link) 155static void sedlbauer_release(struct pcmcia_device *link)
302{ 156{
303 local_info_t *local = link->priv; 157 local_info_t *local = link->priv;
@@ -332,7 +186,7 @@ static int sedlbauer_resume(struct pcmcia_device *link)
332} 186}
333 187
334 188
335static struct pcmcia_device_id sedlbauer_ids[] = { 189static const struct pcmcia_device_id sedlbauer_ids[] = {
336 PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "speed star II", "V 3.1", 0x81fb79f5, 0xf3612e1d, 0x6b95c78a), 190 PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "speed star II", "V 3.1", 0x81fb79f5, 0xf3612e1d, 0x6b95c78a),
337 PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "ISDN-Adapter", "4D67", 0x81fb79f5, 0xe4e9bc12, 0x397b7e90), 191 PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "ISDN-Adapter", "4D67", 0x81fb79f5, 0xe4e9bc12, 0x397b7e90),
338 PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "ISDN-Adapter", "4D98", 0x81fb79f5, 0xe4e9bc12, 0x2e5c7fce), 192 PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "ISDN-Adapter", "4D98", 0x81fb79f5, 0xe4e9bc12, 0x2e5c7fce),
@@ -346,9 +200,7 @@ MODULE_DEVICE_TABLE(pcmcia, sedlbauer_ids);
346 200
347static struct pcmcia_driver sedlbauer_driver = { 201static struct pcmcia_driver sedlbauer_driver = {
348 .owner = THIS_MODULE, 202 .owner = THIS_MODULE,
349 .drv = { 203 .name = "sedlbauer_cs",
350 .name = "sedlbauer_cs",
351 },
352 .probe = sedlbauer_probe, 204 .probe = sedlbauer_probe,
353 .remove = __devexit_p(sedlbauer_detach), 205 .remove = __devexit_p(sedlbauer_detach),
354 .id_table = sedlbauer_ids, 206 .id_table = sedlbauer_ids,
diff --git a/drivers/isdn/hisax/st5481.h b/drivers/isdn/hisax/st5481.h
index 64f78a8c28c5..b9054cb7a0da 100644
--- a/drivers/isdn/hisax/st5481.h
+++ b/drivers/isdn/hisax/st5481.h
@@ -377,7 +377,6 @@ struct st5481_bcs {
377}; 377};
378 378
379struct st5481_adapter { 379struct st5481_adapter {
380 struct list_head list;
381 int number_of_leds; 380 int number_of_leds;
382 struct usb_device *usb_dev; 381 struct usb_device *usb_dev;
383 struct hisax_d_if hisax_d_if; 382 struct hisax_d_if hisax_d_if;
diff --git a/drivers/isdn/hisax/st5481_b.c b/drivers/isdn/hisax/st5481_b.c
index e56e5af889b6..ed4bc564dc63 100644
--- a/drivers/isdn/hisax/st5481_b.c
+++ b/drivers/isdn/hisax/st5481_b.c
@@ -124,7 +124,7 @@ static void usb_b_out(struct st5481_bcs *bcs,int buf_nr)
124} 124}
125 125
126/* 126/*
127 * Start transfering (flags or data) on the B channel, since 127 * Start transferring (flags or data) on the B channel, since
128 * FIFO counters has been set to a non-zero value. 128 * FIFO counters has been set to a non-zero value.
129 */ 129 */
130static void st5481B_start_xfer(void *context) 130static void st5481B_start_xfer(void *context)
diff --git a/drivers/isdn/hisax/st5481_d.c b/drivers/isdn/hisax/st5481_d.c
index b7876b19fe73..44082637a09f 100644
--- a/drivers/isdn/hisax/st5481_d.c
+++ b/drivers/isdn/hisax/st5481_d.c
@@ -167,7 +167,8 @@ static struct FsmNode L1FnList[] __initdata =
167 {ST_L1_F8, EV_IND_RSY, l1_ignore}, 167 {ST_L1_F8, EV_IND_RSY, l1_ignore},
168}; 168};
169 169
170static void l1m_debug(struct FsmInst *fi, char *fmt, ...) 170static __attribute__((format(printf, 2, 3)))
171void l1m_debug(struct FsmInst *fi, char *fmt, ...)
171{ 172{
172 va_list args; 173 va_list args;
173 char buf[256]; 174 char buf[256];
@@ -269,7 +270,8 @@ static char *strDoutEvent[] =
269 "EV_DOUT_UNDERRUN", 270 "EV_DOUT_UNDERRUN",
270}; 271};
271 272
272static void dout_debug(struct FsmInst *fi, char *fmt, ...) 273static __attribute__((format(printf, 2, 3)))
274void dout_debug(struct FsmInst *fi, char *fmt, ...)
273{ 275{
274 va_list args; 276 va_list args;
275 char buf[256]; 277 char buf[256];
diff --git a/drivers/isdn/hisax/st5481_init.c b/drivers/isdn/hisax/st5481_init.c
index 13751237bfcd..9f7fd18ff773 100644
--- a/drivers/isdn/hisax/st5481_init.c
+++ b/drivers/isdn/hisax/st5481_init.c
@@ -46,8 +46,6 @@ module_param(debug, int, 0);
46#endif 46#endif
47int st5481_debug; 47int st5481_debug;
48 48
49static LIST_HEAD(adapter_list);
50
51/* ====================================================================== 49/* ======================================================================
52 * registration/deregistration with the USB layer 50 * registration/deregistration with the USB layer
53 */ 51 */
@@ -86,7 +84,6 @@ static int probe_st5481(struct usb_interface *intf,
86 adapter->bcs[i].b_if.ifc.priv = &adapter->bcs[i]; 84 adapter->bcs[i].b_if.ifc.priv = &adapter->bcs[i];
87 adapter->bcs[i].b_if.ifc.l2l1 = st5481_b_l2l1; 85 adapter->bcs[i].b_if.ifc.l2l1 = st5481_b_l2l1;
88 } 86 }
89 list_add(&adapter->list, &adapter_list);
90 87
91 retval = st5481_setup_usb(adapter); 88 retval = st5481_setup_usb(adapter);
92 if (retval < 0) 89 if (retval < 0)
@@ -125,6 +122,7 @@ static int probe_st5481(struct usb_interface *intf,
125 err_usb: 122 err_usb:
126 st5481_release_usb(adapter); 123 st5481_release_usb(adapter);
127 err: 124 err:
125 kfree(adapter);
128 return -EIO; 126 return -EIO;
129} 127}
130 128
@@ -142,8 +140,6 @@ static void disconnect_st5481(struct usb_interface *intf)
142 if (!adapter) 140 if (!adapter)
143 return; 141 return;
144 142
145 list_del(&adapter->list);
146
147 st5481_stop(adapter); 143 st5481_stop(adapter);
148 st5481_release_b(&adapter->bcs[1]); 144 st5481_release_b(&adapter->bcs[1]);
149 st5481_release_b(&adapter->bcs[0]); 145 st5481_release_b(&adapter->bcs[0]);
diff --git a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c
index 10d41c5d73ed..159e8fa00fd6 100644
--- a/drivers/isdn/hisax/st5481_usb.c
+++ b/drivers/isdn/hisax/st5481_usb.c
@@ -470,7 +470,7 @@ void st5481_release_isocpipes(struct urb* urb[2])
470 470
471/* 471/*
472 * Decode frames received on the B/D channel. 472 * Decode frames received on the B/D channel.
473 * Note that this function will be called continously 473 * Note that this function will be called continuously
474 * with 64Kbit/s / 16Kbit/s of data and hence it will be 474 * with 64Kbit/s / 16Kbit/s of data and hence it will be
475 * called 50 times per second with 20 ISOC descriptors. 475 * called 50 times per second with 20 ISOC descriptors.
476 * Called at interrupt. 476 * Called at interrupt.
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 7296102ca255..161a1938552e 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -9,7 +9,7 @@
9 Also inspired by ELSA PCMCIA driver 9 Also inspired by ELSA PCMCIA driver
10 by Klaus Lichtenwalder <Lichtenwalder@ACM.org> 10 by Klaus Lichtenwalder <Lichtenwalder@ACM.org>
11 11
12 Extentions to new hisax_pcmcia by Karsten Keil 12 Extensions to new hisax_pcmcia by Karsten Keil
13 13
14 minor changes to be compatible with kernel 2.4.x 14 minor changes to be compatible with kernel 2.4.x
15 by Jan.Schubert@GMX.li 15 by Jan.Schubert@GMX.li
@@ -27,7 +27,6 @@
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/system.h> 28#include <asm/system.h>
29 29
30#include <pcmcia/cs.h>
31#include <pcmcia/cistpl.h> 30#include <pcmcia/cistpl.h>
32#include <pcmcia/cisreg.h> 31#include <pcmcia/cisreg.h>
33#include <pcmcia/ds.h> 32#include <pcmcia/ds.h>
@@ -45,26 +44,8 @@ MODULE_LICENSE("GPL");
45static int protocol = 2; /* EURO-ISDN Default */ 44static int protocol = 2; /* EURO-ISDN Default */
46module_param(protocol, int, 0); 45module_param(protocol, int, 0);
47 46
48/*====================================================================*/
49
50/*
51 The event() function is this driver's Card Services event handler.
52 It will be called by Card Services when an appropriate card status
53 event is received. The config() and release() entry points are
54 used to configure or release a socket, in response to card insertion
55 and ejection events. They are invoked from the teles_cs event
56 handler.
57*/
58
59static int teles_cs_config(struct pcmcia_device *link) __devinit ; 47static int teles_cs_config(struct pcmcia_device *link) __devinit ;
60static void teles_cs_release(struct pcmcia_device *link); 48static void teles_cs_release(struct pcmcia_device *link);
61
62/*
63 The attach() and detach() entry points are used to create and destroy
64 "instances" of the driver, where each instance represents everything
65 needed to manage one actual PCMCIA card.
66*/
67
68static void teles_detach(struct pcmcia_device *p_dev) __devexit ; 49static void teles_detach(struct pcmcia_device *p_dev) __devexit ;
69 50
70typedef struct local_info_t { 51typedef struct local_info_t {
@@ -73,18 +54,6 @@ typedef struct local_info_t {
73 int cardnr; 54 int cardnr;
74} local_info_t; 55} local_info_t;
75 56
76/*======================================================================
77
78 teles_attach() creates an "instance" of the driver, allocatingx
79 local data structures for one device. The device is registered
80 with Card Services.
81
82 The dev_link structure is initialized, but we don't actually
83 configure the card at this point -- we wait until we receive a
84 card insertion event.
85
86======================================================================*/
87
88static int __devinit teles_probe(struct pcmcia_device *link) 57static int __devinit teles_probe(struct pcmcia_device *link)
89{ 58{
90 local_info_t *local; 59 local_info_t *local;
@@ -99,31 +68,11 @@ static int __devinit teles_probe(struct pcmcia_device *link)
99 local->p_dev = link; 68 local->p_dev = link;
100 link->priv = local; 69 link->priv = local;
101 70
102 /* 71 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
103 General socket configuration defaults can go here. In this
104 client, we assume very little, and rely on the CIS for almost
105 everything. In most clients, many details (i.e., number, sizes,
106 and attributes of IO windows) are fixed by the nature of the
107 device, and can be hard-wired here.
108 */
109 link->resource[0]->end = 96;
110 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
111
112 link->conf.Attributes = CONF_ENABLE_IRQ;
113 link->conf.IntType = INT_MEMORY_AND_IO;
114 72
115 return teles_cs_config(link); 73 return teles_cs_config(link);
116} /* teles_attach */ 74} /* teles_attach */
117 75
118/*======================================================================
119
120 This deletes a driver "instance". The device is de-registered
121 with Card Services. If it has been released, all local data
122 structures are freed. Otherwise, the structures will be freed
123 when the device is released.
124
125======================================================================*/
126
127static void __devexit teles_detach(struct pcmcia_device *link) 76static void __devexit teles_detach(struct pcmcia_device *link)
128{ 77{
129 local_info_t *info = link->priv; 78 local_info_t *info = link->priv;
@@ -136,27 +85,17 @@ static void __devexit teles_detach(struct pcmcia_device *link)
136 kfree(info); 85 kfree(info);
137} /* teles_detach */ 86} /* teles_detach */
138 87
139/*====================================================================== 88static int teles_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
140
141 teles_cs_config() is scheduled to run after a CARD_INSERTION event
142 is received, to configure the PCMCIA socket, and to make the
143 device available to the system.
144
145======================================================================*/
146
147static int teles_cs_configcheck(struct pcmcia_device *p_dev,
148 cistpl_cftable_entry_t *cf,
149 cistpl_cftable_entry_t *dflt,
150 unsigned int vcc,
151 void *priv_data)
152{ 89{
153 int j; 90 int j;
154 91
155 p_dev->io_lines = 5; 92 p_dev->io_lines = 5;
93 p_dev->resource[0]->end = 96;
94 p_dev->resource[0]->flags &= IO_DATA_PATH_WIDTH;
95 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
156 96
157 if ((cf->io.nwin > 0) && cf->io.win[0].base) { 97 if ((p_dev->resource[0]->end) && p_dev->resource[0]->start) {
158 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); 98 printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
159 p_dev->resource[0]->start = cf->io.win[0].base;
160 if (!pcmcia_request_io(p_dev)) 99 if (!pcmcia_request_io(p_dev))
161 return 0; 100 return 0;
162 } else { 101 } else {
@@ -172,12 +111,10 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev,
172 111
173static int __devinit teles_cs_config(struct pcmcia_device *link) 112static int __devinit teles_cs_config(struct pcmcia_device *link)
174{ 113{
175 local_info_t *dev;
176 int i; 114 int i;
177 IsdnCard_t icard; 115 IsdnCard_t icard;
178 116
179 dev_dbg(&link->dev, "teles_config(0x%p)\n", link); 117 dev_dbg(&link->dev, "teles_config(0x%p)\n", link);
180 dev = link->priv;
181 118
182 i = pcmcia_loop_config(link, teles_cs_configcheck, NULL); 119 i = pcmcia_loop_config(link, teles_cs_configcheck, NULL);
183 if (i != 0) 120 if (i != 0)
@@ -186,21 +123,10 @@ static int __devinit teles_cs_config(struct pcmcia_device *link)
186 if (!link->irq) 123 if (!link->irq)
187 goto cs_failed; 124 goto cs_failed;
188 125
189 i = pcmcia_request_configuration(link, &link->conf); 126 i = pcmcia_enable_device(link);
190 if (i != 0) 127 if (i != 0)
191 goto cs_failed; 128 goto cs_failed;
192 129
193 /* Finally, report what we've done */
194 dev_info(&link->dev, "index 0x%02x:",
195 link->conf.ConfigIndex);
196 if (link->conf.Attributes & CONF_ENABLE_IRQ)
197 printk(", irq %d", link->irq);
198 if (link->resource[0])
199 printk(" & %pR", link->resource[0]);
200 if (link->resource[1])
201 printk(" & %pR", link->resource[1]);
202 printk("\n");
203
204 icard.para[0] = link->irq; 130 icard.para[0] = link->irq;
205 icard.para[1] = link->resource[0]->start; 131 icard.para[1] = link->resource[0]->start;
206 icard.protocol = protocol; 132 icard.protocol = protocol;
@@ -222,14 +148,6 @@ cs_failed:
222 return -ENODEV; 148 return -ENODEV;
223} /* teles_cs_config */ 149} /* teles_cs_config */
224 150
225/*======================================================================
226
227 After a card is removed, teles_cs_release() will unregister the net
228 device, and release the PCMCIA configuration. If the device is
229 still open, this will be postponed until it is closed.
230
231======================================================================*/
232
233static void teles_cs_release(struct pcmcia_device *link) 151static void teles_cs_release(struct pcmcia_device *link)
234{ 152{
235 local_info_t *local = link->priv; 153 local_info_t *local = link->priv;
@@ -265,7 +183,7 @@ static int teles_resume(struct pcmcia_device *link)
265} 183}
266 184
267 185
268static struct pcmcia_device_id teles_ids[] = { 186static const struct pcmcia_device_id teles_ids[] = {
269 PCMCIA_DEVICE_PROD_ID12("TELES", "S0/PC", 0x67b50eae, 0xe9e70119), 187 PCMCIA_DEVICE_PROD_ID12("TELES", "S0/PC", 0x67b50eae, 0xe9e70119),
270 PCMCIA_DEVICE_NULL, 188 PCMCIA_DEVICE_NULL,
271}; 189};
@@ -273,9 +191,7 @@ MODULE_DEVICE_TABLE(pcmcia, teles_ids);
273 191
274static struct pcmcia_driver teles_cs_driver = { 192static struct pcmcia_driver teles_cs_driver = {
275 .owner = THIS_MODULE, 193 .owner = THIS_MODULE,
276 .drv = { 194 .name = "teles_cs",
277 .name = "teles_cs",
278 },
279 .probe = teles_probe, 195 .probe = teles_probe,
280 .remove = __devexit_p(teles_detach), 196 .remove = __devexit_p(teles_detach),
281 .id_table = teles_ids, 197 .id_table = teles_ids,
diff --git a/drivers/isdn/hysdn/hysdn_defs.h b/drivers/isdn/hysdn/hysdn_defs.h
index 729df4089385..18b801ad97a4 100644
--- a/drivers/isdn/hysdn/hysdn_defs.h
+++ b/drivers/isdn/hysdn/hysdn_defs.h
@@ -227,7 +227,6 @@ extern hysdn_card *card_root; /* pointer to first card */
227/*************************/ 227/*************************/
228/* im/exported functions */ 228/* im/exported functions */
229/*************************/ 229/*************************/
230extern char *hysdn_getrev(const char *);
231 230
232/* hysdn_procconf.c */ 231/* hysdn_procconf.c */
233extern int hysdn_procconf_init(void); /* init proc config filesys */ 232extern int hysdn_procconf_init(void); /* init proc config filesys */
@@ -259,7 +258,6 @@ extern int hysdn_tx_cfgline(hysdn_card *, unsigned char *,
259 258
260/* hysdn_net.c */ 259/* hysdn_net.c */
261extern unsigned int hynet_enable; 260extern unsigned int hynet_enable;
262extern char *hysdn_net_revision;
263extern int hysdn_net_create(hysdn_card *); /* create a new net device */ 261extern int hysdn_net_create(hysdn_card *); /* create a new net device */
264extern int hysdn_net_release(hysdn_card *); /* delete the device */ 262extern int hysdn_net_release(hysdn_card *); /* delete the device */
265extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */ 263extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */
diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c
index b7cc5c2f08c6..0ab42ace1692 100644
--- a/drivers/isdn/hysdn/hysdn_init.c
+++ b/drivers/isdn/hysdn/hysdn_init.c
@@ -36,7 +36,6 @@ MODULE_DESCRIPTION("ISDN4Linux: Driver for HYSDN cards");
36MODULE_AUTHOR("Werner Cornelius"); 36MODULE_AUTHOR("Werner Cornelius");
37MODULE_LICENSE("GPL"); 37MODULE_LICENSE("GPL");
38 38
39static char *hysdn_init_revision = "$Revision: 1.6.6.6 $";
40static int cardmax; /* number of found cards */ 39static int cardmax; /* number of found cards */
41hysdn_card *card_root = NULL; /* pointer to first card */ 40hysdn_card *card_root = NULL; /* pointer to first card */
42static hysdn_card *card_last = NULL; /* pointer to first card */ 41static hysdn_card *card_last = NULL; /* pointer to first card */
@@ -49,25 +48,6 @@ static hysdn_card *card_last = NULL; /* pointer to first card */
49/* Additionally newer versions may be activated without rebooting. */ 48/* Additionally newer versions may be activated without rebooting. */
50/****************************************************************************/ 49/****************************************************************************/
51 50
52/******************************************************/
53/* extract revision number from string for log output */
54/******************************************************/
55char *
56hysdn_getrev(const char *revision)
57{
58 char *rev;
59 char *p;
60
61 if ((p = strchr(revision, ':'))) {
62 rev = p + 2;
63 p = strchr(rev, '$');
64 *--p = 0;
65 } else
66 rev = "???";
67 return rev;
68}
69
70
71/****************************************************************************/ 51/****************************************************************************/
72/* init_module is called once when the module is loaded to do all necessary */ 52/* init_module is called once when the module is loaded to do all necessary */
73/* things like autodetect... */ 53/* things like autodetect... */
@@ -175,13 +155,9 @@ static int hysdn_have_procfs;
175static int __init 155static int __init
176hysdn_init(void) 156hysdn_init(void)
177{ 157{
178 char tmp[50];
179 int rc; 158 int rc;
180 159
181 strcpy(tmp, hysdn_init_revision); 160 printk(KERN_NOTICE "HYSDN: module loaded\n");
182 printk(KERN_NOTICE "HYSDN: module Rev: %s loaded\n", hysdn_getrev(tmp));
183 strcpy(tmp, hysdn_net_revision);
184 printk(KERN_NOTICE "HYSDN: network interface Rev: %s \n", hysdn_getrev(tmp));
185 161
186 rc = pci_register_driver(&hysdn_pci_driver); 162 rc = pci_register_driver(&hysdn_pci_driver);
187 if (rc) 163 if (rc)
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c
index feec8d89d719..11f2cce26005 100644
--- a/drivers/isdn/hysdn/hysdn_net.c
+++ b/drivers/isdn/hysdn/hysdn_net.c
@@ -26,9 +26,6 @@
26unsigned int hynet_enable = 0xffffffff; 26unsigned int hynet_enable = 0xffffffff;
27module_param(hynet_enable, uint, 0); 27module_param(hynet_enable, uint, 0);
28 28
29/* store the actual version for log reporting */
30char *hysdn_net_revision = "$Revision: 1.8.6.4 $";
31
32#define MAX_SKB_BUFFERS 20 /* number of buffers for keeping TX-data */ 29#define MAX_SKB_BUFFERS 20 /* number of buffers for keeping TX-data */
33 30
34/****************************************************************************/ 31/****************************************************************************/
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c
index 96b3e39c3356..5fe83bd42061 100644
--- a/drivers/isdn/hysdn/hysdn_procconf.c
+++ b/drivers/isdn/hysdn/hysdn_procconf.c
@@ -23,7 +23,6 @@
23#include "hysdn_defs.h" 23#include "hysdn_defs.h"
24 24
25static DEFINE_MUTEX(hysdn_conf_mutex); 25static DEFINE_MUTEX(hysdn_conf_mutex);
26static char *hysdn_procconf_revision = "$Revision: 1.8.6.4 $";
27 26
28#define INFO_OUT_LEN 80 /* length of info line including lf */ 27#define INFO_OUT_LEN 80 /* length of info line including lf */
29 28
@@ -404,7 +403,7 @@ hysdn_procconf_init(void)
404 card = card->next; /* next entry */ 403 card = card->next; /* next entry */
405 } 404 }
406 405
407 printk(KERN_NOTICE "HYSDN: procfs Rev. %s initialised\n", hysdn_getrev(hysdn_procconf_revision)); 406 printk(KERN_NOTICE "HYSDN: procfs initialised\n");
408 return (0); 407 return (0);
409} /* hysdn_procconf_init */ 408} /* hysdn_procconf_init */
410 409
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
index 2ee93d04b2dd..236cc7dadfd0 100644
--- a/drivers/isdn/hysdn/hysdn_proclog.c
+++ b/drivers/isdn/hysdn/hysdn_proclog.c
@@ -155,7 +155,6 @@ put_log_buffer(hysdn_card * card, char *cp)
155static ssize_t 155static ssize_t
156hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) 156hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
157{ 157{
158 unsigned long u = 0;
159 int rc; 158 int rc;
160 unsigned char valbuf[128]; 159 unsigned char valbuf[128];
161 hysdn_card *card = file->private_data; 160 hysdn_card *card = file->private_data;
@@ -167,12 +166,10 @@ hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t
167 166
168 valbuf[count] = 0; /* terminating 0 */ 167 valbuf[count] = 0; /* terminating 0 */
169 168
170 rc = strict_strtoul(valbuf, 0, &u); 169 rc = kstrtoul(valbuf, 0, &card->debug_flags);
171 170 if (rc < 0)
172 if (rc == 0) { 171 return rc;
173 card->debug_flags = u; /* remember debug flags */ 172 hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags);
174 hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags);
175 }
176 return (count); 173 return (count);
177} /* hysdn_log_write */ 174} /* hysdn_log_write */
178 175
diff --git a/drivers/isdn/hysdn/hysdn_sched.c b/drivers/isdn/hysdn/hysdn_sched.c
index 81db4a190d41..3674d30d6a03 100644
--- a/drivers/isdn/hysdn/hysdn_sched.c
+++ b/drivers/isdn/hysdn/hysdn_sched.c
@@ -143,7 +143,7 @@ hysdn_sched_tx(hysdn_card *card, unsigned char *buf,
143/* send one config line to the card and return 0 if successful, otherwise a */ 143/* send one config line to the card and return 0 if successful, otherwise a */
144/* negative error code. */ 144/* negative error code. */
145/* The function works with timeouts perhaps not giving the greatest speed */ 145/* The function works with timeouts perhaps not giving the greatest speed */
146/* sending the line, but this should be meaningless beacuse only some lines */ 146/* sending the line, but this should be meaningless because only some lines */
147/* are to be sent and this happens very seldom. */ 147/* are to be sent and this happens very seldom. */
148/*****************************************************************************/ 148/*****************************************************************************/
149int 149int
diff --git a/drivers/isdn/i4l/isdn_audio.c b/drivers/isdn/i4l/isdn_audio.c
index 861bdf3421f2..d5013935ac62 100644
--- a/drivers/isdn/i4l/isdn_audio.c
+++ b/drivers/isdn/i4l/isdn_audio.c
@@ -439,7 +439,7 @@ isdn_audio_xlaw2adpcm(adpcm_state * s, int fmt, unsigned char *in,
439 439
440/* 440/*
441 * Goertzel algorithm. 441 * Goertzel algorithm.
442 * See http://ptolemy.eecs.berkeley.edu/~pino/Ptolemy/papers/96/dtmf_ict/ 442 * See http://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/
443 * for more info. 443 * for more info.
444 * Result is stored into an sk_buff and queued up for later 444 * Result is stored into an sk_buff and queued up for later
445 * evaluation. 445 * evaluation.
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 15632bd2f643..6ed82add6ffa 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -399,13 +399,8 @@ isdn_all_eaz(int di, int ch)
399#include <linux/isdn/capicmd.h> 399#include <linux/isdn/capicmd.h>
400 400
401static int 401static int
402isdn_capi_rec_hl_msg(capi_msg *cm) { 402isdn_capi_rec_hl_msg(capi_msg *cm)
403 403{
404 int di;
405 int ch;
406
407 di = (cm->adr.Controller & 0x7f) -1;
408 ch = isdn_dc2minor(di, (cm->adr.Controller>>8)& 0x7f);
409 switch(cm->Command) { 404 switch(cm->Command) {
410 case CAPI_FACILITY: 405 case CAPI_FACILITY:
411 /* in the moment only handled in tty */ 406 /* in the moment only handled in tty */
@@ -1278,7 +1273,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
1278 uint minor = iminor(file->f_path.dentry->d_inode); 1273 uint minor = iminor(file->f_path.dentry->d_inode);
1279 isdn_ctrl c; 1274 isdn_ctrl c;
1280 int drvidx; 1275 int drvidx;
1281 int chidx;
1282 int ret; 1276 int ret;
1283 int i; 1277 int i;
1284 char __user *p; 1278 char __user *p;
@@ -1340,7 +1334,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
1340 drvidx = isdn_minor2drv(minor); 1334 drvidx = isdn_minor2drv(minor);
1341 if (drvidx < 0) 1335 if (drvidx < 0)
1342 return -ENODEV; 1336 return -ENODEV;
1343 chidx = isdn_minor2chan(minor);
1344 if (!(dev->drv[drvidx]->flags & DRV_FLAG_RUNNING)) 1337 if (!(dev->drv[drvidx]->flags & DRV_FLAG_RUNNING))
1345 return -ENODEV; 1338 return -ENODEV;
1346 return 0; 1339 return 0;
diff --git a/drivers/isdn/i4l/isdn_concap.c b/drivers/isdn/i4l/isdn_concap.c
index 46048e55f241..d568689669f8 100644
--- a/drivers/isdn/i4l/isdn_concap.c
+++ b/drivers/isdn/i4l/isdn_concap.c
@@ -61,7 +61,7 @@ static int isdn_concap_dl_data_req(struct concap_proto *concap, struct sk_buff *
61static int isdn_concap_dl_connect_req(struct concap_proto *concap) 61static int isdn_concap_dl_connect_req(struct concap_proto *concap)
62{ 62{
63 struct net_device *ndev = concap -> net_dev; 63 struct net_device *ndev = concap -> net_dev;
64 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev); 64 isdn_net_local *lp = netdev_priv(ndev);
65 int ret; 65 int ret;
66 IX25DEBUG( "isdn_concap_dl_connect_req: %s \n", ndev -> name); 66 IX25DEBUG( "isdn_concap_dl_connect_req: %s \n", ndev -> name);
67 67
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 26d44c3ca1d8..97988111e45a 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -827,7 +827,7 @@ isdn_net_dial(void)
827void 827void
828isdn_net_hangup(struct net_device *d) 828isdn_net_hangup(struct net_device *d)
829{ 829{
830 isdn_net_local *lp = (isdn_net_local *) netdev_priv(d); 830 isdn_net_local *lp = netdev_priv(d);
831 isdn_ctrl cmd; 831 isdn_ctrl cmd;
832#ifdef CONFIG_ISDN_X25 832#ifdef CONFIG_ISDN_X25
833 struct concap_proto *cprot = lp->netdev->cprot; 833 struct concap_proto *cprot = lp->netdev->cprot;
@@ -1052,7 +1052,7 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
1052{ 1052{
1053 isdn_net_dev *nd; 1053 isdn_net_dev *nd;
1054 isdn_net_local *slp; 1054 isdn_net_local *slp;
1055 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev); 1055 isdn_net_local *lp = netdev_priv(ndev);
1056 int retv = NETDEV_TX_OK; 1056 int retv = NETDEV_TX_OK;
1057 1057
1058 if (((isdn_net_local *) netdev_priv(ndev))->master) { 1058 if (((isdn_net_local *) netdev_priv(ndev))->master) {
@@ -1116,7 +1116,7 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
1116static void 1116static void
1117isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev) 1117isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev)
1118{ 1118{
1119 isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); 1119 isdn_net_local *lp = netdev_priv(dev);
1120 if (!skb) 1120 if (!skb)
1121 return; 1121 return;
1122 if (lp->p_encap == ISDN_NET_ENCAP_ETHER) { 1122 if (lp->p_encap == ISDN_NET_ENCAP_ETHER) {
@@ -1131,7 +1131,7 @@ isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev)
1131 1131
1132static void isdn_net_tx_timeout(struct net_device * ndev) 1132static void isdn_net_tx_timeout(struct net_device * ndev)
1133{ 1133{
1134 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev); 1134 isdn_net_local *lp = netdev_priv(ndev);
1135 1135
1136 printk(KERN_WARNING "isdn_tx_timeout dev %s dialstate %d\n", ndev->name, lp->dialstate); 1136 printk(KERN_WARNING "isdn_tx_timeout dev %s dialstate %d\n", ndev->name, lp->dialstate);
1137 if (!lp->dialstate){ 1137 if (!lp->dialstate){
@@ -1165,7 +1165,7 @@ static void isdn_net_tx_timeout(struct net_device * ndev)
1165static netdev_tx_t 1165static netdev_tx_t
1166isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) 1166isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1167{ 1167{
1168 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev); 1168 isdn_net_local *lp = netdev_priv(ndev);
1169#ifdef CONFIG_ISDN_X25 1169#ifdef CONFIG_ISDN_X25
1170 struct concap_proto * cprot = lp -> netdev -> cprot; 1170 struct concap_proto * cprot = lp -> netdev -> cprot;
1171/* At this point hard_start_xmit() passes control to the encapsulation 1171/* At this point hard_start_xmit() passes control to the encapsulation
@@ -1347,7 +1347,7 @@ isdn_net_close(struct net_device *dev)
1347static struct net_device_stats * 1347static struct net_device_stats *
1348isdn_net_get_stats(struct net_device *dev) 1348isdn_net_get_stats(struct net_device *dev)
1349{ 1349{
1350 isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); 1350 isdn_net_local *lp = netdev_priv(dev);
1351 return &lp->stats; 1351 return &lp->stats;
1352} 1352}
1353 1353
@@ -1426,7 +1426,7 @@ isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len)
1426static int 1426static int
1427isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 1427isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1428{ 1428{
1429 isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); 1429 isdn_net_local *lp = netdev_priv(dev);
1430 unsigned long len = 0; 1430 unsigned long len = 0;
1431 unsigned long expires = 0; 1431 unsigned long expires = 0;
1432 int tmp = 0; 1432 int tmp = 0;
@@ -1493,7 +1493,7 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1493static int isdn_net_ioctl(struct net_device *dev, 1493static int isdn_net_ioctl(struct net_device *dev,
1494 struct ifreq *ifr, int cmd) 1494 struct ifreq *ifr, int cmd)
1495{ 1495{
1496 isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); 1496 isdn_net_local *lp = netdev_priv(dev);
1497 1497
1498 switch (lp->p_encap) { 1498 switch (lp->p_encap) {
1499#ifdef CONFIG_ISDN_PPP 1499#ifdef CONFIG_ISDN_PPP
@@ -1530,7 +1530,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
1530 printk (KERN_WARNING 1530 printk (KERN_WARNING
1531 "UPDOWN: Line protocol on Interface %s," 1531 "UPDOWN: Line protocol on Interface %s,"
1532 " changed state to down\n", lp->netdev->dev->name); 1532 " changed state to down\n", lp->netdev->dev->name);
1533 /* should stop routing higher-level data accross */ 1533 /* should stop routing higher-level data across */
1534 } else if ((!lp->cisco_line_state) && 1534 } else if ((!lp->cisco_line_state) &&
1535 (myseq_diff >= 0) && (myseq_diff <= 2)) { 1535 (myseq_diff >= 0) && (myseq_diff <= 2)) {
1536 /* line down -> up */ 1536 /* line down -> up */
@@ -1538,7 +1538,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
1538 printk (KERN_WARNING 1538 printk (KERN_WARNING
1539 "UPDOWN: Line protocol on Interface %s," 1539 "UPDOWN: Line protocol on Interface %s,"
1540 " changed state to up\n", lp->netdev->dev->name); 1540 " changed state to up\n", lp->netdev->dev->name);
1541 /* restart routing higher-level data accross */ 1541 /* restart routing higher-level data across */
1542 } 1542 }
1543 1543
1544 if (lp->cisco_debserint) 1544 if (lp->cisco_debserint)
@@ -1678,7 +1678,6 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
1678 u32 your_seq; 1678 u32 your_seq;
1679 __be32 local; 1679 __be32 local;
1680 __be32 *addr, *mask; 1680 __be32 *addr, *mask;
1681 u16 unused;
1682 1681
1683 if (skb->len < 14) 1682 if (skb->len < 14)
1684 return; 1683 return;
@@ -1722,7 +1721,6 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
1722 lp->cisco_last_slarp_in = jiffies; 1721 lp->cisco_last_slarp_in = jiffies;
1723 my_seq = be32_to_cpup((__be32 *)(p + 0)); 1722 my_seq = be32_to_cpup((__be32 *)(p + 0));
1724 your_seq = be32_to_cpup((__be32 *)(p + 4)); 1723 your_seq = be32_to_cpup((__be32 *)(p + 4));
1725 unused = be16_to_cpup((__be16 *)(p + 8));
1726 p += 10; 1724 p += 10;
1727 lp->cisco_yourseq = my_seq; 1725 lp->cisco_yourseq = my_seq;
1728 lp->cisco_mineseen = your_seq; 1726 lp->cisco_mineseen = your_seq;
@@ -1786,7 +1784,7 @@ isdn_net_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
1786static void 1784static void
1787isdn_net_receive(struct net_device *ndev, struct sk_buff *skb) 1785isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
1788{ 1786{
1789 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev); 1787 isdn_net_local *lp = netdev_priv(ndev);
1790 isdn_net_local *olp = lp; /* original 'lp' */ 1788 isdn_net_local *olp = lp; /* original 'lp' */
1791#ifdef CONFIG_ISDN_X25 1789#ifdef CONFIG_ISDN_X25
1792 struct concap_proto *cprot = lp -> netdev -> cprot; 1790 struct concap_proto *cprot = lp -> netdev -> cprot;
@@ -1800,7 +1798,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
1800 * handle master's statistics and hangup-timeout 1798 * handle master's statistics and hangup-timeout
1801 */ 1799 */
1802 ndev = lp->master; 1800 ndev = lp->master;
1803 lp = (isdn_net_local *) netdev_priv(ndev); 1801 lp = netdev_priv(ndev);
1804 lp->stats.rx_packets++; 1802 lp->stats.rx_packets++;
1805 lp->stats.rx_bytes += skb->len; 1803 lp->stats.rx_bytes += skb->len;
1806 } 1804 }
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index fe824e0cbb25..1b002b0002a4 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -1147,15 +1147,14 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
1147 } 1147 }
1148 1148
1149 if (is->pass_filter 1149 if (is->pass_filter
1150 && sk_run_filter(skb, is->pass_filter, is->pass_len) == 0) { 1150 && sk_run_filter(skb, is->pass_filter) == 0) {
1151 if (is->debug & 0x2) 1151 if (is->debug & 0x2)
1152 printk(KERN_DEBUG "IPPP: inbound frame filtered.\n"); 1152 printk(KERN_DEBUG "IPPP: inbound frame filtered.\n");
1153 kfree_skb(skb); 1153 kfree_skb(skb);
1154 return; 1154 return;
1155 } 1155 }
1156 if (!(is->active_filter 1156 if (!(is->active_filter
1157 && sk_run_filter(skb, is->active_filter, 1157 && sk_run_filter(skb, is->active_filter) == 0)) {
1158 is->active_len) == 0)) {
1159 if (is->debug & 0x2) 1158 if (is->debug & 0x2)
1160 printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n"); 1159 printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n");
1161 lp->huptimer = 0; 1160 lp->huptimer = 0;
@@ -1221,7 +1220,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
1221 struct ippp_struct *ipt,*ipts; 1220 struct ippp_struct *ipt,*ipts;
1222 int slot, retval = NETDEV_TX_OK; 1221 int slot, retval = NETDEV_TX_OK;
1223 1222
1224 mlp = (isdn_net_local *) netdev_priv(netdev); 1223 mlp = netdev_priv(netdev);
1225 nd = mlp->netdev; /* get master lp */ 1224 nd = mlp->netdev; /* get master lp */
1226 1225
1227 slot = mlp->ppp_slot; 1226 slot = mlp->ppp_slot;
@@ -1294,15 +1293,14 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
1294 } 1293 }
1295 1294
1296 if (ipt->pass_filter 1295 if (ipt->pass_filter
1297 && sk_run_filter(skb, ipt->pass_filter, ipt->pass_len) == 0) { 1296 && sk_run_filter(skb, ipt->pass_filter) == 0) {
1298 if (ipt->debug & 0x4) 1297 if (ipt->debug & 0x4)
1299 printk(KERN_DEBUG "IPPP: outbound frame filtered.\n"); 1298 printk(KERN_DEBUG "IPPP: outbound frame filtered.\n");
1300 kfree_skb(skb); 1299 kfree_skb(skb);
1301 goto unlock; 1300 goto unlock;
1302 } 1301 }
1303 if (!(ipt->active_filter 1302 if (!(ipt->active_filter
1304 && sk_run_filter(skb, ipt->active_filter, 1303 && sk_run_filter(skb, ipt->active_filter) == 0)) {
1305 ipt->active_len) == 0)) {
1306 if (ipt->debug & 0x4) 1304 if (ipt->debug & 0x4)
1307 printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n"); 1305 printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n");
1308 lp->huptimer = 0; 1306 lp->huptimer = 0;
@@ -1492,9 +1490,9 @@ int isdn_ppp_autodial_filter(struct sk_buff *skb, isdn_net_local *lp)
1492 } 1490 }
1493 1491
1494 drop |= is->pass_filter 1492 drop |= is->pass_filter
1495 && sk_run_filter(skb, is->pass_filter, is->pass_len) == 0; 1493 && sk_run_filter(skb, is->pass_filter) == 0;
1496 drop |= is->active_filter 1494 drop |= is->active_filter
1497 && sk_run_filter(skb, is->active_filter, is->active_len) == 0; 1495 && sk_run_filter(skb, is->active_filter) == 0;
1498 1496
1499 skb_push(skb, IPPP_MAX_HEADER - 4); 1497 skb_push(skb, IPPP_MAX_HEADER - 4);
1500 return drop; 1498 return drop;
@@ -1516,7 +1514,7 @@ int isdn_ppp_autodial_filter(struct sk_buff *skb, isdn_net_local *lp)
1516#define MP_LONGSEQ_MAXBIT ((MP_LONGSEQ_MASK+1)>>1) 1514#define MP_LONGSEQ_MAXBIT ((MP_LONGSEQ_MASK+1)>>1)
1517#define MP_SHORTSEQ_MAXBIT ((MP_SHORTSEQ_MASK+1)>>1) 1515#define MP_SHORTSEQ_MAXBIT ((MP_SHORTSEQ_MASK+1)>>1)
1518 1516
1519/* sequence-wrap safe comparisions (for long sequence)*/ 1517/* sequence-wrap safe comparisons (for long sequence)*/
1520#define MP_LT(a,b) ((a-b)&MP_LONGSEQ_MAXBIT) 1518#define MP_LT(a,b) ((a-b)&MP_LONGSEQ_MAXBIT)
1521#define MP_LE(a,b) !((b-a)&MP_LONGSEQ_MAXBIT) 1519#define MP_LE(a,b) !((b-a)&MP_LONGSEQ_MAXBIT)
1522#define MP_GT(a,b) ((b-a)&MP_LONGSEQ_MAXBIT) 1520#define MP_GT(a,b) ((b-a)&MP_LONGSEQ_MAXBIT)
@@ -1748,7 +1746,7 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
1748 * then next fragment should be the start of new reassembly 1746 * then next fragment should be the start of new reassembly
1749 * if sequence is contiguous, but we haven't reassembled yet, 1747 * if sequence is contiguous, but we haven't reassembled yet,
1750 * keep going. 1748 * keep going.
1751 * if sequence is not contiguous, either clear everyting 1749 * if sequence is not contiguous, either clear everything
1752 * below low watermark and set start to the next frag or 1750 * below low watermark and set start to the next frag or
1753 * clear start ptr. 1751 * clear start ptr.
1754 */ 1752 */
@@ -1985,7 +1983,7 @@ isdn_ppp_dev_ioctl_stats(int slot, struct ifreq *ifr, struct net_device *dev)
1985{ 1983{
1986 struct ppp_stats __user *res = ifr->ifr_data; 1984 struct ppp_stats __user *res = ifr->ifr_data;
1987 struct ppp_stats t; 1985 struct ppp_stats t;
1988 isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); 1986 isdn_net_local *lp = netdev_priv(dev);
1989 1987
1990 if (!access_ok(VERIFY_WRITE, res, sizeof(struct ppp_stats))) 1988 if (!access_ok(VERIFY_WRITE, res, sizeof(struct ppp_stats)))
1991 return -EFAULT; 1989 return -EFAULT;
@@ -2024,7 +2022,7 @@ isdn_ppp_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2024{ 2022{
2025 int error=0; 2023 int error=0;
2026 int len; 2024 int len;
2027 isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); 2025 isdn_net_local *lp = netdev_priv(dev);
2028 2026
2029 2027
2030 if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) 2028 if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP)
@@ -2091,7 +2089,7 @@ isdn_ppp_dial_slave(char *name)
2091 2089
2092 sdev = lp->slave; 2090 sdev = lp->slave;
2093 while (sdev) { 2091 while (sdev) {
2094 isdn_net_local *mlp = (isdn_net_local *) netdev_priv(sdev); 2092 isdn_net_local *mlp = netdev_priv(sdev);
2095 if (!(mlp->flags & ISDN_NET_CONNECTED)) 2093 if (!(mlp->flags & ISDN_NET_CONNECTED))
2096 break; 2094 break;
2097 sdev = mlp->slave; 2095 sdev = mlp->slave;
@@ -2099,7 +2097,7 @@ isdn_ppp_dial_slave(char *name)
2099 if (!sdev) 2097 if (!sdev)
2100 return 2; 2098 return 2;
2101 2099
2102 isdn_net_dial_req((isdn_net_local *) netdev_priv(sdev)); 2100 isdn_net_dial_req(netdev_priv(sdev));
2103 return 0; 2101 return 0;
2104#else 2102#else
2105 return -1; 2103 return -1;
@@ -2122,7 +2120,7 @@ isdn_ppp_hangup_slave(char *name)
2122 2120
2123 sdev = lp->slave; 2121 sdev = lp->slave;
2124 while (sdev) { 2122 while (sdev) {
2125 isdn_net_local *mlp = (isdn_net_local *) netdev_priv(sdev); 2123 isdn_net_local *mlp = netdev_priv(sdev);
2126 2124
2127 if (mlp->slave) { /* find last connected link in chain */ 2125 if (mlp->slave) { /* find last connected link in chain */
2128 isdn_net_local *nlp = ISDN_SLAVE_PRIV(mlp); 2126 isdn_net_local *nlp = ISDN_SLAVE_PRIV(mlp);
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index 51dc60da333b..d8504279e502 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -14,7 +14,7 @@
14#include <linux/isdn.h> 14#include <linux/isdn.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/smp_lock.h> 17#include <linux/mutex.h>
18#include "isdn_common.h" 18#include "isdn_common.h"
19#include "isdn_tty.h" 19#include "isdn_tty.h"
20#ifdef CONFIG_ISDN_AUDIO 20#ifdef CONFIG_ISDN_AUDIO
@@ -28,6 +28,7 @@
28 28
29/* Prototypes */ 29/* Prototypes */
30 30
31static DEFINE_MUTEX(modem_info_mutex);
31static int isdn_tty_edit_at(const char *, int, modem_info *); 32static int isdn_tty_edit_at(const char *, int, modem_info *);
32static void isdn_tty_check_esc(const u_char *, u_char, int, int *, u_long *); 33static void isdn_tty_check_esc(const u_char *, u_char, int, int *, u_long *);
33static void isdn_tty_modem_reset_regs(modem_info *, int); 34static void isdn_tty_modem_reset_regs(modem_info *, int);
@@ -791,7 +792,7 @@ isdn_tty_suspend(char *id, modem_info * info, atemu * m)
791} 792}
792 793
793/* isdn_tty_resume() tries to resume a suspended call 794/* isdn_tty_resume() tries to resume a suspended call
794 * setup of the lower levels before that. unfortunatly here is no 795 * setup of the lower levels before that. unfortunately here is no
795 * checking for compatibility of used protocols implemented by Q931 796 * checking for compatibility of used protocols implemented by Q931
796 * It does the same things like isdn_tty_dial, the last command 797 * It does the same things like isdn_tty_dial, the last command
797 * is different, may be we can merge it. 798 * is different, may be we can merge it.
@@ -997,7 +998,6 @@ isdn_tty_change_speed(modem_info * info)
997{ 998{
998 uint cflag, 999 uint cflag,
999 cval, 1000 cval,
1000 fcr,
1001 quot; 1001 quot;
1002 int i; 1002 int i;
1003 1003
@@ -1036,7 +1036,6 @@ isdn_tty_change_speed(modem_info * info)
1036 cval |= UART_LCR_PARITY; 1036 cval |= UART_LCR_PARITY;
1037 if (!(cflag & PARODD)) 1037 if (!(cflag & PARODD))
1038 cval |= UART_LCR_EPAR; 1038 cval |= UART_LCR_EPAR;
1039 fcr = 0;
1040 1039
1041 /* CTS flow control flag and modem status interrupts */ 1040 /* CTS flow control flag and modem status interrupts */
1042 if (cflag & CRTSCTS) { 1041 if (cflag & CRTSCTS) {
@@ -1344,7 +1343,7 @@ isdn_tty_get_lsr_info(modem_info * info, uint __user * value)
1344 1343
1345 1344
1346static int 1345static int
1347isdn_tty_tiocmget(struct tty_struct *tty, struct file *file) 1346isdn_tty_tiocmget(struct tty_struct *tty)
1348{ 1347{
1349 modem_info *info = (modem_info *) tty->driver_data; 1348 modem_info *info = (modem_info *) tty->driver_data;
1350 u_char control, status; 1349 u_char control, status;
@@ -1354,14 +1353,14 @@ isdn_tty_tiocmget(struct tty_struct *tty, struct file *file)
1354 if (tty->flags & (1 << TTY_IO_ERROR)) 1353 if (tty->flags & (1 << TTY_IO_ERROR))
1355 return -EIO; 1354 return -EIO;
1356 1355
1357 lock_kernel(); 1356 mutex_lock(&modem_info_mutex);
1358#ifdef ISDN_DEBUG_MODEM_IOCTL 1357#ifdef ISDN_DEBUG_MODEM_IOCTL
1359 printk(KERN_DEBUG "ttyI%d ioctl TIOCMGET\n", info->line); 1358 printk(KERN_DEBUG "ttyI%d ioctl TIOCMGET\n", info->line);
1360#endif 1359#endif
1361 1360
1362 control = info->mcr; 1361 control = info->mcr;
1363 status = info->msr; 1362 status = info->msr;
1364 unlock_kernel(); 1363 mutex_unlock(&modem_info_mutex);
1365 return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) 1364 return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0)
1366 | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) 1365 | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0)
1367 | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) 1366 | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0)
@@ -1371,7 +1370,7 @@ isdn_tty_tiocmget(struct tty_struct *tty, struct file *file)
1371} 1370}
1372 1371
1373static int 1372static int
1374isdn_tty_tiocmset(struct tty_struct *tty, struct file *file, 1373isdn_tty_tiocmset(struct tty_struct *tty,
1375 unsigned int set, unsigned int clear) 1374 unsigned int set, unsigned int clear)
1376{ 1375{
1377 modem_info *info = (modem_info *) tty->driver_data; 1376 modem_info *info = (modem_info *) tty->driver_data;
@@ -1385,7 +1384,7 @@ isdn_tty_tiocmset(struct tty_struct *tty, struct file *file,
1385 printk(KERN_DEBUG "ttyI%d ioctl TIOCMxxx: %x %x\n", info->line, set, clear); 1384 printk(KERN_DEBUG "ttyI%d ioctl TIOCMxxx: %x %x\n", info->line, set, clear);
1386#endif 1385#endif
1387 1386
1388 lock_kernel(); 1387 mutex_lock(&modem_info_mutex);
1389 if (set & TIOCM_RTS) 1388 if (set & TIOCM_RTS)
1390 info->mcr |= UART_MCR_RTS; 1389 info->mcr |= UART_MCR_RTS;
1391 if (set & TIOCM_DTR) { 1390 if (set & TIOCM_DTR) {
@@ -1407,13 +1406,12 @@ isdn_tty_tiocmset(struct tty_struct *tty, struct file *file,
1407 isdn_tty_modem_hup(info, 1); 1406 isdn_tty_modem_hup(info, 1);
1408 } 1407 }
1409 } 1408 }
1410 unlock_kernel(); 1409 mutex_unlock(&modem_info_mutex);
1411 return 0; 1410 return 0;
1412} 1411}
1413 1412
1414static int 1413static int
1415isdn_tty_ioctl(struct tty_struct *tty, struct file *file, 1414isdn_tty_ioctl(struct tty_struct *tty, uint cmd, ulong arg)
1416 uint cmd, ulong arg)
1417{ 1415{
1418 modem_info *info = (modem_info *) tty->driver_data; 1416 modem_info *info = (modem_info *) tty->driver_data;
1419 int retval; 1417 int retval;
@@ -3515,7 +3513,7 @@ isdn_tty_parse_at(modem_info * info)
3515{ 3513{
3516 atemu *m = &info->emu; 3514 atemu *m = &info->emu;
3517 char *p; 3515 char *p;
3518 char ds[40]; 3516 char ds[ISDN_MSNLEN];
3519 3517
3520#ifdef ISDN_DEBUG_AT 3518#ifdef ISDN_DEBUG_AT
3521 printk(KERN_DEBUG "AT: '%s'\n", m->mdmcmd); 3519 printk(KERN_DEBUG "AT: '%s'\n", m->mdmcmd);
@@ -3594,7 +3592,7 @@ isdn_tty_parse_at(modem_info * info)
3594 break; 3592 break;
3595 case '3': 3593 case '3':
3596 p++; 3594 p++;
3597 sprintf(ds, "\r\n%d", info->emu.charge); 3595 snprintf(ds, sizeof(ds), "\r\n%d", info->emu.charge);
3598 isdn_tty_at_cout(ds, info); 3596 isdn_tty_at_cout(ds, info);
3599 break; 3597 break;
3600 default:; 3598 default:;
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 2e847a90bad0..1f355bb85e54 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -1627,7 +1627,7 @@ __setup("icn=", icn_setup);
1627static int __init icn_init(void) 1627static int __init icn_init(void)
1628{ 1628{
1629 char *p; 1629 char *p;
1630 char rev[10]; 1630 char rev[21];
1631 1631
1632 memset(&dev, 0, sizeof(icn_dev)); 1632 memset(&dev, 0, sizeof(icn_dev));
1633 dev.memaddr = (membase & 0x0ffc000); 1633 dev.memaddr = (membase & 0x0ffc000);
@@ -1637,9 +1637,11 @@ static int __init icn_init(void)
1637 spin_lock_init(&dev.devlock); 1637 spin_lock_init(&dev.devlock);
1638 1638
1639 if ((p = strchr(revision, ':'))) { 1639 if ((p = strchr(revision, ':'))) {
1640 strcpy(rev, p + 1); 1640 strncpy(rev, p + 1, 20);
1641 rev[20] = '\0';
1641 p = strchr(rev, '$'); 1642 p = strchr(rev, '$');
1642 *p = 0; 1643 if (p)
1644 *p = 0;
1643 } else 1645 } else
1644 strcpy(rev, " ??? "); 1646 strcpy(rev, " ??? ");
1645 printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08lx\n", rev, 1647 printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08lx\n", rev,
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index b8a1098b66ed..d497db0a26d0 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -954,7 +954,7 @@ isdnloop_parse_cmd(isdnloop_card * card)
954/* 954/*
955 * Put command-strings into the of the 'card'. In reality, execute them 955 * Put command-strings into the of the 'card'. In reality, execute them
956 * right in place by calling isdnloop_parse_cmd(). Also copy every 956 * right in place by calling isdnloop_parse_cmd(). Also copy every
957 * command to the read message ringbuffer, preceeding it with a '>'. 957 * command to the read message ringbuffer, preceding it with a '>'.
958 * These mesagges can be read at /dev/isdnctrl. 958 * These mesagges can be read at /dev/isdnctrl.
959 * 959 *
960 * Parameter: 960 * Parameter:
diff --git a/drivers/isdn/mISDN/dsp.h b/drivers/isdn/mISDN/dsp.h
index 18af86879c05..8549431430f0 100644
--- a/drivers/isdn/mISDN/dsp.h
+++ b/drivers/isdn/mISDN/dsp.h
@@ -21,7 +21,7 @@
21/* options may be: 21/* options may be:
22 * 22 *
23 * bit 0 = use ulaw instead of alaw 23 * bit 0 = use ulaw instead of alaw
24 * bit 1 = enable hfc hardware accelleration for all channels 24 * bit 1 = enable hfc hardware acceleration for all channels
25 * 25 *
26 */ 26 */
27#define DSP_OPT_ULAW (1<<0) 27#define DSP_OPT_ULAW (1<<0)
diff --git a/drivers/isdn/mISDN/dsp_cmx.c b/drivers/isdn/mISDN/dsp_cmx.c
index 713ef2b805a2..4d395dea32f3 100644
--- a/drivers/isdn/mISDN/dsp_cmx.c
+++ b/drivers/isdn/mISDN/dsp_cmx.c
@@ -112,7 +112,7 @@
112 * Disable rx-data: 112 * Disable rx-data:
113 * If cmx is realized in hardware, rx data will be disabled if requested by 113 * If cmx is realized in hardware, rx data will be disabled if requested by
114 * the upper layer. If dtmf decoding is done by software and enabled, rx data 114 * the upper layer. If dtmf decoding is done by software and enabled, rx data
115 * will not be diabled but blocked to the upper layer. 115 * will not be disabled but blocked to the upper layer.
116 * 116 *
117 * HFC conference engine: 117 * HFC conference engine:
118 * If it is possible to realize all features using hardware, hardware will be 118 * If it is possible to realize all features using hardware, hardware will be
@@ -1237,6 +1237,7 @@ dsp_cmx_receive(struct dsp *dsp, struct sk_buff *skb)
1237 if (dsp->cmx_delay) 1237 if (dsp->cmx_delay)
1238 dsp->rx_W = (dsp->rx_R + dsp->cmx_delay) 1238 dsp->rx_W = (dsp->rx_R + dsp->cmx_delay)
1239 & CMX_BUFF_MASK; 1239 & CMX_BUFF_MASK;
1240 else
1240 dsp->rx_W = (dsp->rx_R + (dsp_poll >> 1)) 1241 dsp->rx_W = (dsp->rx_R + (dsp_poll >> 1))
1241 & CMX_BUFF_MASK; 1242 & CMX_BUFF_MASK;
1242 } else { 1243 } else {
@@ -1512,7 +1513,7 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members)
1512 /* -> if echo is NOT enabled */ 1513 /* -> if echo is NOT enabled */
1513 if (!dsp->echo.software) { 1514 if (!dsp->echo.software) {
1514 /* 1515 /*
1515 * -> substract rx-data from conf-data, 1516 * -> subtract rx-data from conf-data,
1516 * if tx-data is available, mix 1517 * if tx-data is available, mix
1517 */ 1518 */
1518 while (r != rr && t != tt) { 1519 while (r != rr && t != tt) {
@@ -1571,7 +1572,7 @@ dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members)
1571send_packet: 1572send_packet:
1572 /* 1573 /*
1573 * send tx-data if enabled - don't filter, 1574 * send tx-data if enabled - don't filter,
1574 * becuase we want what we send, not what we filtered 1575 * because we want what we send, not what we filtered
1575 */ 1576 */
1576 if (dsp->tx_data) { 1577 if (dsp->tx_data) {
1577 if (tx_data_only) { 1578 if (tx_data_only) {
diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c
index 6f5b54864283..2877291a9ed8 100644
--- a/drivers/isdn/mISDN/dsp_core.c
+++ b/drivers/isdn/mISDN/dsp_core.c
@@ -115,7 +115,7 @@
115 * 115 *
116 * The CMX has special functions for conferences with one, two and more 116 * The CMX has special functions for conferences with one, two and more
117 * members. It will allow different types of data flow. Receive and transmit 117 * members. It will allow different types of data flow. Receive and transmit
118 * data to/form upper layer may be swithed on/off individually without loosing 118 * data to/form upper layer may be swithed on/off individually without losing
119 * features of CMX, Tones and DTMF. 119 * features of CMX, Tones and DTMF.
120 * 120 *
121 * Echo Cancellation: Sometimes we like to cancel echo from the interface. 121 * Echo Cancellation: Sometimes we like to cancel echo from the interface.
@@ -127,9 +127,9 @@
127 * 127 *
128 * If all used features can be realized in hardware, and if transmit and/or 128 * If all used features can be realized in hardware, and if transmit and/or
129 * receive data ist disabled, the card may not send/receive any data at all. 129 * receive data ist disabled, the card may not send/receive any data at all.
130 * Not receiving is usefull if only announcements are played. Not sending is 130 * Not receiving is useful if only announcements are played. Not sending is
131 * usefull if an answering machine records audio. Not sending and receiving is 131 * useful if an answering machine records audio. Not sending and receiving is
132 * usefull during most states of the call. If supported by hardware, tones 132 * useful during most states of the call. If supported by hardware, tones
133 * will be played without cpu load. Small PBXs and NT-Mode applications will 133 * will be played without cpu load. Small PBXs and NT-Mode applications will
134 * not need expensive hardware when processing calls. 134 * not need expensive hardware when processing calls.
135 * 135 *
diff --git a/drivers/isdn/mISDN/dsp_dtmf.c b/drivers/isdn/mISDN/dsp_dtmf.c
index 9ae2d33b06f7..5b484c3f4af6 100644
--- a/drivers/isdn/mISDN/dsp_dtmf.c
+++ b/drivers/isdn/mISDN/dsp_dtmf.c
@@ -106,7 +106,7 @@ void dsp_dtmf_hardware(struct dsp *dsp)
106 * tested it allot. it even works with very short tones (40ms). the only 106 * tested it allot. it even works with very short tones (40ms). the only
107 * disadvantage is, that it doesn't work good with different volumes of both 107 * disadvantage is, that it doesn't work good with different volumes of both
108 * tones. this will happen, if accoustically coupled dialers are used. 108 * tones. this will happen, if accoustically coupled dialers are used.
109 * it sometimes detects tones during speach, which is normal for decoders. 109 * it sometimes detects tones during speech, which is normal for decoders.
110 * use sequences to given commands during calls. 110 * use sequences to given commands during calls.
111 * 111 *
112 * dtmf - points to a structure of the current dtmf state 112 * dtmf - points to a structure of the current dtmf state
@@ -244,7 +244,7 @@ coefficients:
244 if (result[i] < tresh) { 244 if (result[i] < tresh) {
245 lowgroup = -1; 245 lowgroup = -1;
246 highgroup = -1; 246 highgroup = -1;
247 break; /* noise inbetween */ 247 break; /* noise in between */
248 } 248 }
249 /* good level found. This is allowed only one time per group */ 249 /* good level found. This is allowed only one time per group */
250 if (i < NCOEFF/2) { 250 if (i < NCOEFF/2) {
diff --git a/drivers/isdn/mISDN/dsp_tones.c b/drivers/isdn/mISDN/dsp_tones.c
index 7dbe54ed1deb..4e4440e8bae5 100644
--- a/drivers/isdn/mISDN/dsp_tones.c
+++ b/drivers/isdn/mISDN/dsp_tones.c
@@ -394,7 +394,7 @@ void dsp_tone_copy(struct dsp *dsp, u8 *data, int len)
394 while (len) { 394 while (len) {
395 /* find sample to start with */ 395 /* find sample to start with */
396 while (42) { 396 while (42) {
397 /* warp arround */ 397 /* wrap around */
398 if (!pat->seq[index]) { 398 if (!pat->seq[index]) {
399 count = 0; 399 count = 0;
400 index = 0; 400 index = 0;
diff --git a/drivers/isdn/mISDN/hwchannel.c b/drivers/isdn/mISDN/hwchannel.c
index 307bd6e8988b..f6e108d0125f 100644
--- a/drivers/isdn/mISDN/hwchannel.c
+++ b/drivers/isdn/mISDN/hwchannel.c
@@ -110,7 +110,7 @@ mISDN_freedchannel(struct dchannel *ch)
110 } 110 }
111 skb_queue_purge(&ch->squeue); 111 skb_queue_purge(&ch->squeue);
112 skb_queue_purge(&ch->rqueue); 112 skb_queue_purge(&ch->rqueue);
113 flush_scheduled_work(); 113 flush_work_sync(&ch->workq);
114 return 0; 114 return 0;
115} 115}
116EXPORT_SYMBOL(mISDN_freedchannel); 116EXPORT_SYMBOL(mISDN_freedchannel);
@@ -143,7 +143,7 @@ mISDN_freebchannel(struct bchannel *ch)
143 mISDN_clear_bchannel(ch); 143 mISDN_clear_bchannel(ch);
144 skb_queue_purge(&ch->rqueue); 144 skb_queue_purge(&ch->rqueue);
145 ch->rcount = 0; 145 ch->rcount = 0;
146 flush_scheduled_work(); 146 flush_work_sync(&ch->workq);
147 return 0; 147 return 0;
148} 148}
149EXPORT_SYMBOL(mISDN_freebchannel); 149EXPORT_SYMBOL(mISDN_freebchannel);
@@ -206,7 +206,7 @@ recv_Bchannel(struct bchannel *bch, unsigned int id)
206 hh->id = id; 206 hh->id = id;
207 if (bch->rcount >= 64) { 207 if (bch->rcount >= 64) {
208 printk(KERN_WARNING "B-channel %p receive queue overflow, " 208 printk(KERN_WARNING "B-channel %p receive queue overflow, "
209 "fushing!\n", bch); 209 "flushing!\n", bch);
210 skb_queue_purge(&bch->rqueue); 210 skb_queue_purge(&bch->rqueue);
211 bch->rcount = 0; 211 bch->rcount = 0;
212 return; 212 return;
@@ -231,7 +231,7 @@ recv_Bchannel_skb(struct bchannel *bch, struct sk_buff *skb)
231{ 231{
232 if (bch->rcount >= 64) { 232 if (bch->rcount >= 64) {
233 printk(KERN_WARNING "B-channel %p receive queue overflow, " 233 printk(KERN_WARNING "B-channel %p receive queue overflow, "
234 "fushing!\n", bch); 234 "flushing!\n", bch);
235 skb_queue_purge(&bch->rqueue); 235 skb_queue_purge(&bch->rqueue);
236 bch->rcount = 0; 236 bch->rcount = 0;
237 } 237 }
@@ -279,7 +279,7 @@ confirm_Bsend(struct bchannel *bch)
279 279
280 if (bch->rcount >= 64) { 280 if (bch->rcount >= 64) {
281 printk(KERN_WARNING "B-channel %p receive queue overflow, " 281 printk(KERN_WARNING "B-channel %p receive queue overflow, "
282 "fushing!\n", bch); 282 "flushing!\n", bch);
283 skb_queue_purge(&bch->rqueue); 283 skb_queue_purge(&bch->rqueue);
284 bch->rcount = 0; 284 bch->rcount = 0;
285 } 285 }
diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c
index 22f38e48ac4e..22f8ec8b9247 100644
--- a/drivers/isdn/mISDN/l1oip_core.c
+++ b/drivers/isdn/mISDN/l1oip_core.c
@@ -179,7 +179,7 @@ NOTE: A value of 0 equals 256 bytes of data.
179- Time Base = Timestamp of first sample in frame 179- Time Base = Timestamp of first sample in frame
180The "Time Base" is used to rearange packets and to detect packet loss. 180The "Time Base" is used to rearange packets and to detect packet loss.
181The 16 bits are sent in network order (MSB first) and count 1/8000 th of a 181The 16 bits are sent in network order (MSB first) and count 1/8000 th of a
182second. This causes a wrap arround each 8,192 seconds. There is no requirement 182second. This causes a wrap around each 8,192 seconds. There is no requirement
183for the initial "Time Base", but 0 should be used for the first packet. 183for the initial "Time Base", but 0 should be used for the first packet.
184In case of HDLC data, this timestamp counts the packet or byte number. 184In case of HDLC data, this timestamp counts the packet or byte number.
185 185
@@ -205,7 +205,7 @@ On Demand:
205 205
206If the ondemand parameter is given, the remote IP is set to 0 on timeout. 206If the ondemand parameter is given, the remote IP is set to 0 on timeout.
207This will stop keepalive traffic to remote. If the remote is online again, 207This will stop keepalive traffic to remote. If the remote is online again,
208traffic will continue to the remote address. This is usefull for road warriors. 208traffic will continue to the remote address. This is useful for road warriors.
209This feature only works with ID set, otherwhise it is highly unsecure. 209This feature only works with ID set, otherwhise it is highly unsecure.
210 210
211 211
@@ -590,7 +590,7 @@ multiframe:
590 return; 590 return;
591 } 591 }
592 } else 592 } else
593 mlen = len-2; /* single frame, substract timebase */ 593 mlen = len-2; /* single frame, subtract timebase */
594 594
595 if (len < 2) { 595 if (len < 2) {
596 printk(KERN_WARNING "%s: packet error - packet too short, time " 596 printk(KERN_WARNING "%s: packet error - packet too short, time "
@@ -972,7 +972,7 @@ channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq)
972 if (debug & DEBUG_L1OIP_SOCKET) 972 if (debug & DEBUG_L1OIP_SOCKET)
973 printk(KERN_DEBUG "%s: got new ip address from user " 973 printk(KERN_DEBUG "%s: got new ip address from user "
974 "space.\n", __func__); 974 "space.\n", __func__);
975 l1oip_socket_open(hc); 975 l1oip_socket_open(hc);
976 break; 976 break;
977 case MISDN_CTRL_UNSETPEER: 977 case MISDN_CTRL_UNSETPEER:
978 if (debug & DEBUG_L1OIP_SOCKET) 978 if (debug & DEBUG_L1OIP_SOCKET)
@@ -1269,6 +1269,8 @@ release_card(struct l1oip *hc)
1269 if (timer_pending(&hc->timeout_tl)) 1269 if (timer_pending(&hc->timeout_tl))
1270 del_timer(&hc->timeout_tl); 1270 del_timer(&hc->timeout_tl);
1271 1271
1272 cancel_work_sync(&hc->workq);
1273
1272 if (hc->socket_thread) 1274 if (hc->socket_thread)
1273 l1oip_socket_close(hc); 1275 l1oip_socket_close(hc);
1274 1276
diff --git a/drivers/isdn/mISDN/layer1.c b/drivers/isdn/mISDN/layer1.c
index ac4aa18c632b..5cc7c001c523 100644
--- a/drivers/isdn/mISDN/layer1.c
+++ b/drivers/isdn/mISDN/layer1.c
@@ -99,12 +99,16 @@ static void
99l1m_debug(struct FsmInst *fi, char *fmt, ...) 99l1m_debug(struct FsmInst *fi, char *fmt, ...)
100{ 100{
101 struct layer1 *l1 = fi->userdata; 101 struct layer1 *l1 = fi->userdata;
102 struct va_format vaf;
102 va_list va; 103 va_list va;
103 104
104 va_start(va, fmt); 105 va_start(va, fmt);
105 printk(KERN_DEBUG "%s: ", dev_name(&l1->dch->dev.dev)); 106
106 vprintk(fmt, va); 107 vaf.fmt = fmt;
107 printk("\n"); 108 vaf.va = &va;
109
110 printk(KERN_DEBUG "%s: %pV\n", dev_name(&l1->dch->dev.dev), &vaf);
111
108 va_end(va); 112 va_end(va);
109} 113}
110 114
diff --git a/drivers/isdn/mISDN/layer2.c b/drivers/isdn/mISDN/layer2.c
index c97371788764..5bc00156315e 100644
--- a/drivers/isdn/mISDN/layer2.c
+++ b/drivers/isdn/mISDN/layer2.c
@@ -95,14 +95,20 @@ static void
95l2m_debug(struct FsmInst *fi, char *fmt, ...) 95l2m_debug(struct FsmInst *fi, char *fmt, ...)
96{ 96{
97 struct layer2 *l2 = fi->userdata; 97 struct layer2 *l2 = fi->userdata;
98 struct va_format vaf;
98 va_list va; 99 va_list va;
99 100
100 if (!(*debug & DEBUG_L2_FSM)) 101 if (!(*debug & DEBUG_L2_FSM))
101 return; 102 return;
103
102 va_start(va, fmt); 104 va_start(va, fmt);
103 printk(KERN_DEBUG "l2 (sapi %d tei %d): ", l2->sapi, l2->tei); 105
104 vprintk(fmt, va); 106 vaf.fmt = fmt;
105 printk("\n"); 107 vaf.va = &va;
108
109 printk(KERN_DEBUG "l2 (sapi %d tei %d): %pV\n",
110 l2->sapi, l2->tei, &vaf);
111
106 va_end(va); 112 va_end(va);
107} 113}
108 114
@@ -1634,7 +1640,7 @@ l2_tei_remove(struct FsmInst *fi, int event, void *arg)
1634} 1640}
1635 1641
1636static void 1642static void
1637l2_st14_persistant_da(struct FsmInst *fi, int event, void *arg) 1643l2_st14_persistent_da(struct FsmInst *fi, int event, void *arg)
1638{ 1644{
1639 struct layer2 *l2 = fi->userdata; 1645 struct layer2 *l2 = fi->userdata;
1640 struct sk_buff *skb = arg; 1646 struct sk_buff *skb = arg;
@@ -1648,7 +1654,7 @@ l2_st14_persistant_da(struct FsmInst *fi, int event, void *arg)
1648} 1654}
1649 1655
1650static void 1656static void
1651l2_st5_persistant_da(struct FsmInst *fi, int event, void *arg) 1657l2_st5_persistent_da(struct FsmInst *fi, int event, void *arg)
1652{ 1658{
1653 struct layer2 *l2 = fi->userdata; 1659 struct layer2 *l2 = fi->userdata;
1654 struct sk_buff *skb = arg; 1660 struct sk_buff *skb = arg;
@@ -1665,7 +1671,7 @@ l2_st5_persistant_da(struct FsmInst *fi, int event, void *arg)
1665} 1671}
1666 1672
1667static void 1673static void
1668l2_st6_persistant_da(struct FsmInst *fi, int event, void *arg) 1674l2_st6_persistent_da(struct FsmInst *fi, int event, void *arg)
1669{ 1675{
1670 struct layer2 *l2 = fi->userdata; 1676 struct layer2 *l2 = fi->userdata;
1671 struct sk_buff *skb = arg; 1677 struct sk_buff *skb = arg;
@@ -1679,7 +1685,7 @@ l2_st6_persistant_da(struct FsmInst *fi, int event, void *arg)
1679} 1685}
1680 1686
1681static void 1687static void
1682l2_persistant_da(struct FsmInst *fi, int event, void *arg) 1688l2_persistent_da(struct FsmInst *fi, int event, void *arg)
1683{ 1689{
1684 struct layer2 *l2 = fi->userdata; 1690 struct layer2 *l2 = fi->userdata;
1685 struct sk_buff *skb = arg; 1691 struct sk_buff *skb = arg;
@@ -1823,14 +1829,14 @@ static struct FsmNode L2FnList[] =
1823 {ST_L2_6, EV_L2_FRAME_ERROR, l2_frame_error}, 1829 {ST_L2_6, EV_L2_FRAME_ERROR, l2_frame_error},
1824 {ST_L2_7, EV_L2_FRAME_ERROR, l2_frame_error_reest}, 1830 {ST_L2_7, EV_L2_FRAME_ERROR, l2_frame_error_reest},
1825 {ST_L2_8, EV_L2_FRAME_ERROR, l2_frame_error_reest}, 1831 {ST_L2_8, EV_L2_FRAME_ERROR, l2_frame_error_reest},
1826 {ST_L2_1, EV_L1_DEACTIVATE, l2_st14_persistant_da}, 1832 {ST_L2_1, EV_L1_DEACTIVATE, l2_st14_persistent_da},
1827 {ST_L2_2, EV_L1_DEACTIVATE, l2_st24_tei_remove}, 1833 {ST_L2_2, EV_L1_DEACTIVATE, l2_st24_tei_remove},
1828 {ST_L2_3, EV_L1_DEACTIVATE, l2_st3_tei_remove}, 1834 {ST_L2_3, EV_L1_DEACTIVATE, l2_st3_tei_remove},
1829 {ST_L2_4, EV_L1_DEACTIVATE, l2_st14_persistant_da}, 1835 {ST_L2_4, EV_L1_DEACTIVATE, l2_st14_persistent_da},
1830 {ST_L2_5, EV_L1_DEACTIVATE, l2_st5_persistant_da}, 1836 {ST_L2_5, EV_L1_DEACTIVATE, l2_st5_persistent_da},
1831 {ST_L2_6, EV_L1_DEACTIVATE, l2_st6_persistant_da}, 1837 {ST_L2_6, EV_L1_DEACTIVATE, l2_st6_persistent_da},
1832 {ST_L2_7, EV_L1_DEACTIVATE, l2_persistant_da}, 1838 {ST_L2_7, EV_L1_DEACTIVATE, l2_persistent_da},
1833 {ST_L2_8, EV_L1_DEACTIVATE, l2_persistant_da}, 1839 {ST_L2_8, EV_L1_DEACTIVATE, l2_persistent_da},
1834}; 1840};
1835 1841
1836static int 1842static int
@@ -1858,7 +1864,7 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb)
1858 psapi >>= 2; 1864 psapi >>= 2;
1859 ptei >>= 1; 1865 ptei >>= 1;
1860 if (psapi != l2->sapi) { 1866 if (psapi != l2->sapi) {
1861 /* not our bussiness */ 1867 /* not our business */
1862 if (*debug & DEBUG_L2) 1868 if (*debug & DEBUG_L2)
1863 printk(KERN_DEBUG "%s: sapi %d/%d mismatch\n", 1869 printk(KERN_DEBUG "%s: sapi %d/%d mismatch\n",
1864 __func__, psapi, l2->sapi); 1870 __func__, psapi, l2->sapi);
@@ -1866,7 +1872,7 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb)
1866 return 0; 1872 return 0;
1867 } 1873 }
1868 if ((ptei != l2->tei) && (ptei != GROUP_TEI)) { 1874 if ((ptei != l2->tei) && (ptei != GROUP_TEI)) {
1869 /* not our bussiness */ 1875 /* not our business */
1870 if (*debug & DEBUG_L2) 1876 if (*debug & DEBUG_L2)
1871 printk(KERN_DEBUG "%s: tei %d/%d mismatch\n", 1877 printk(KERN_DEBUG "%s: tei %d/%d mismatch\n",
1872 __func__, ptei, l2->tei); 1878 __func__, ptei, l2->tei);
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
index 3232206406b1..8e325227b4c0 100644
--- a/drivers/isdn/mISDN/socket.c
+++ b/drivers/isdn/mISDN/socket.c
@@ -392,6 +392,7 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
392 if (dev) { 392 if (dev) {
393 struct mISDN_devinfo di; 393 struct mISDN_devinfo di;
394 394
395 memset(&di, 0, sizeof(di));
395 di.id = dev->id; 396 di.id = dev->id;
396 di.Dprotocols = dev->Dprotocols; 397 di.Dprotocols = dev->Dprotocols;
397 di.Bprotocols = dev->Bprotocols | get_all_Bprotocols(); 398 di.Bprotocols = dev->Bprotocols | get_all_Bprotocols();
@@ -456,6 +457,9 @@ static int data_sock_getsockopt(struct socket *sock, int level, int optname,
456 if (get_user(len, optlen)) 457 if (get_user(len, optlen))
457 return -EFAULT; 458 return -EFAULT;
458 459
460 if (len != sizeof(char))
461 return -EINVAL;
462
459 switch (optname) { 463 switch (optname) {
460 case MISDN_TIME_STAMP: 464 case MISDN_TIME_STAMP:
461 if (_pms(sk)->cmask & MISDN_TIME_STAMP) 465 if (_pms(sk)->cmask & MISDN_TIME_STAMP)
@@ -672,6 +676,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
672 if (dev) { 676 if (dev) {
673 struct mISDN_devinfo di; 677 struct mISDN_devinfo di;
674 678
679 memset(&di, 0, sizeof(di));
675 di.id = dev->id; 680 di.id = dev->id;
676 di.Dprotocols = dev->Dprotocols; 681 di.Dprotocols = dev->Dprotocols;
677 di.Bprotocols = dev->Bprotocols | get_all_Bprotocols(); 682 di.Bprotocols = dev->Bprotocols | get_all_Bprotocols();
diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c
index b159bd59e64e..a5b632e67552 100644
--- a/drivers/isdn/mISDN/stack.c
+++ b/drivers/isdn/mISDN/stack.c
@@ -18,7 +18,6 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/mISDNif.h> 19#include <linux/mISDNif.h>
20#include <linux/kthread.h> 20#include <linux/kthread.h>
21#include <linux/smp_lock.h>
22#include "core.h" 21#include "core.h"
23 22
24static u_int *debug; 23static u_int *debug;
@@ -205,13 +204,7 @@ mISDNStackd(void *data)
205 struct mISDNstack *st = data; 204 struct mISDNstack *st = data;
206 int err = 0; 205 int err = 0;
207 206
208#ifdef CONFIG_SMP
209 lock_kernel();
210#endif
211 sigfillset(&current->blocked); 207 sigfillset(&current->blocked);
212#ifdef CONFIG_SMP
213 unlock_kernel();
214#endif
215 if (*debug & DEBUG_MSG_THREAD) 208 if (*debug & DEBUG_MSG_THREAD)
216 printk(KERN_DEBUG "mISDNStackd %s started\n", 209 printk(KERN_DEBUG "mISDNStackd %s started\n",
217 dev_name(&st->dev->dev)); 210 dev_name(&st->dev->dev));
diff --git a/drivers/isdn/mISDN/tei.c b/drivers/isdn/mISDN/tei.c
index 1b85d9d27496..687c9b6264ab 100644
--- a/drivers/isdn/mISDN/tei.c
+++ b/drivers/isdn/mISDN/tei.c
@@ -79,14 +79,19 @@ static void
79da_debug(struct FsmInst *fi, char *fmt, ...) 79da_debug(struct FsmInst *fi, char *fmt, ...)
80{ 80{
81 struct manager *mgr = fi->userdata; 81 struct manager *mgr = fi->userdata;
82 struct va_format vaf;
82 va_list va; 83 va_list va;
83 84
84 if (!(*debug & DEBUG_L2_TEIFSM)) 85 if (!(*debug & DEBUG_L2_TEIFSM))
85 return; 86 return;
87
86 va_start(va, fmt); 88 va_start(va, fmt);
87 printk(KERN_DEBUG "mgr(%d): ", mgr->ch.st->dev->id); 89
88 vprintk(fmt, va); 90 vaf.fmt = fmt;
89 printk("\n"); 91 vaf.va = &va;
92
93 printk(KERN_DEBUG "mgr(%d): %pV\n", mgr->ch.st->dev->id, &vaf);
94
90 va_end(va); 95 va_end(va);
91} 96}
92 97
@@ -223,14 +228,20 @@ static void
223tei_debug(struct FsmInst *fi, char *fmt, ...) 228tei_debug(struct FsmInst *fi, char *fmt, ...)
224{ 229{
225 struct teimgr *tm = fi->userdata; 230 struct teimgr *tm = fi->userdata;
231 struct va_format vaf;
226 va_list va; 232 va_list va;
227 233
228 if (!(*debug & DEBUG_L2_TEIFSM)) 234 if (!(*debug & DEBUG_L2_TEIFSM))
229 return; 235 return;
236
230 va_start(va, fmt); 237 va_start(va, fmt);
231 printk(KERN_DEBUG "sapi(%d) tei(%d): ", tm->l2->sapi, tm->l2->tei); 238
232 vprintk(fmt, va); 239 vaf.fmt = fmt;
233 printk("\n"); 240 vaf.va = &va;
241
242 printk(KERN_DEBUG "sapi(%d) tei(%d): %pV\n",
243 tm->l2->sapi, tm->l2->tei, &vaf);
244
234 va_end(va); 245 va_end(va);
235} 246}
236 247
diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c
index de43c8c70ad0..859c81e9483b 100644
--- a/drivers/isdn/mISDN/timerdev.c
+++ b/drivers/isdn/mISDN/timerdev.c
@@ -267,6 +267,7 @@ static const struct file_operations mISDN_fops = {
267 .unlocked_ioctl = mISDN_ioctl, 267 .unlocked_ioctl = mISDN_ioctl,
268 .open = mISDN_open, 268 .open = mISDN_open,
269 .release = mISDN_close, 269 .release = mISDN_close,
270 .llseek = no_llseek,
270}; 271};
271 272
272static struct miscdevice mISDNtimer = { 273static struct miscdevice mISDNtimer = {
diff --git a/drivers/isdn/pcbit/edss1.c b/drivers/isdn/pcbit/edss1.c
index d5920ae22d73..80c9c16fd5ef 100644
--- a/drivers/isdn/pcbit/edss1.c
+++ b/drivers/isdn/pcbit/edss1.c
@@ -33,7 +33,7 @@
33#include "callbacks.h" 33#include "callbacks.h"
34 34
35 35
36char * isdn_state_table[] = { 36const char * const isdn_state_table[] = {
37 "Closed", 37 "Closed",
38 "Call initiated", 38 "Call initiated",
39 "Overlap sending", 39 "Overlap sending",
diff --git a/drivers/isdn/pcbit/edss1.h b/drivers/isdn/pcbit/edss1.h
index 0b64f97015d8..39f8346e28c5 100644
--- a/drivers/isdn/pcbit/edss1.h
+++ b/drivers/isdn/pcbit/edss1.h
@@ -90,7 +90,7 @@ struct fsm_timer_entry {
90 unsigned long timeout; /* in seconds */ 90 unsigned long timeout; /* in seconds */
91}; 91};
92 92
93extern char * isdn_state_table[]; 93extern const char * const isdn_state_table[];
94 94
95void pcbit_fsm_event(struct pcbit_dev *, struct pcbit_chan *, 95void pcbit_fsm_event(struct pcbit_dev *, struct pcbit_chan *,
96 unsigned short event, struct callb_data *); 96 unsigned short event, struct callb_data *);