diff options
Diffstat (limited to 'drivers/isdn')
31 files changed, 763 insertions, 804 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 0cabe31f26df..f80a7c48a35f 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/signal.h> | 20 | #include <linux/signal.h> |
21 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/smp_lock.h> | ||
24 | #include <linux/timer.h> | 23 | #include <linux/timer.h> |
25 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
26 | #include <linux/tty.h> | 25 | #include <linux/tty.h> |
@@ -50,6 +49,7 @@ MODULE_LICENSE("GPL"); | |||
50 | 49 | ||
51 | /* -------- driver information -------------------------------------- */ | 50 | /* -------- driver information -------------------------------------- */ |
52 | 51 | ||
52 | static DEFINE_MUTEX(capi_mutex); | ||
53 | static struct class *capi_class; | 53 | static struct class *capi_class; |
54 | static int capi_major = 68; /* allocated */ | 54 | static int capi_major = 68; /* allocated */ |
55 | 55 | ||
@@ -691,7 +691,7 @@ unlock_out: | |||
691 | static ssize_t | 691 | static ssize_t |
692 | capi_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 692 | capi_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
693 | { | 693 | { |
694 | struct capidev *cdev = (struct capidev *)file->private_data; | 694 | struct capidev *cdev = file->private_data; |
695 | struct sk_buff *skb; | 695 | struct sk_buff *skb; |
696 | size_t copied; | 696 | size_t copied; |
697 | int err; | 697 | int err; |
@@ -726,7 +726,7 @@ capi_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
726 | static ssize_t | 726 | static ssize_t |
727 | capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 727 | capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) |
728 | { | 728 | { |
729 | struct capidev *cdev = (struct capidev *)file->private_data; | 729 | struct capidev *cdev = file->private_data; |
730 | struct sk_buff *skb; | 730 | struct sk_buff *skb; |
731 | u16 mlen; | 731 | u16 mlen; |
732 | 732 | ||
@@ -773,7 +773,7 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos | |||
773 | static unsigned int | 773 | static unsigned int |
774 | capi_poll(struct file *file, poll_table * wait) | 774 | capi_poll(struct file *file, poll_table * wait) |
775 | { | 775 | { |
776 | struct capidev *cdev = (struct capidev *)file->private_data; | 776 | struct capidev *cdev = file->private_data; |
777 | unsigned int mask = 0; | 777 | unsigned int mask = 0; |
778 | 778 | ||
779 | if (!cdev->ap.applid) | 779 | if (!cdev->ap.applid) |
@@ -985,9 +985,9 @@ capi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
985 | { | 985 | { |
986 | int ret; | 986 | int ret; |
987 | 987 | ||
988 | lock_kernel(); | 988 | mutex_lock(&capi_mutex); |
989 | ret = capi_ioctl(file, cmd, arg); | 989 | ret = capi_ioctl(file, cmd, arg); |
990 | unlock_kernel(); | 990 | mutex_unlock(&capi_mutex); |
991 | 991 | ||
992 | return ret; | 992 | return ret; |
993 | } | 993 | } |
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c index bf55ed5f38e3..2978bdaa6b88 100644 --- a/drivers/isdn/capi/capidrv.c +++ b/drivers/isdn/capi/capidrv.c | |||
@@ -1450,12 +1450,9 @@ static void handle_dtrace_data(capidrv_contr *card, | |||
1450 | } | 1450 | } |
1451 | 1451 | ||
1452 | for (p = data, end = data+len; p < end; p++) { | 1452 | for (p = data, end = data+len; p < end; p++) { |
1453 | u8 w; | ||
1454 | PUTBYTE_TO_STATUS(card, ' '); | 1453 | PUTBYTE_TO_STATUS(card, ' '); |
1455 | w = (*p >> 4) & 0xf; | 1454 | PUTBYTE_TO_STATUS(card, hex_asc_hi(*p)); |
1456 | PUTBYTE_TO_STATUS(card, (w < 10) ? '0'+w : 'A'-10+w); | 1455 | PUTBYTE_TO_STATUS(card, hex_asc_lo(*p)); |
1457 | w = *p & 0xf; | ||
1458 | PUTBYTE_TO_STATUS(card, (w < 10) ? '0'+w : 'A'-10+w); | ||
1459 | } | 1456 | } |
1460 | PUTBYTE_TO_STATUS(card, '\n'); | 1457 | PUTBYTE_TO_STATUS(card, '\n'); |
1461 | 1458 | ||
diff --git a/drivers/isdn/divert/divert_procfs.c b/drivers/isdn/divert/divert_procfs.c index c53e2417e7d4..33ec9e467772 100644 --- a/drivers/isdn/divert/divert_procfs.c +++ b/drivers/isdn/divert/divert_procfs.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/isdnif.h> | 21 | #include <linux/isdnif.h> |
22 | #include <net/net_namespace.h> | 22 | #include <net/net_namespace.h> |
23 | #include <linux/smp_lock.h> | 23 | #include <linux/mutex.h> |
24 | #include "isdn_divert.h" | 24 | #include "isdn_divert.h" |
25 | 25 | ||
26 | 26 | ||
@@ -28,6 +28,7 @@ | |||
28 | /* Variables for interface queue */ | 28 | /* Variables for interface queue */ |
29 | /*********************************/ | 29 | /*********************************/ |
30 | ulong if_used = 0; /* number of interface users */ | 30 | ulong if_used = 0; /* number of interface users */ |
31 | static DEFINE_MUTEX(isdn_divert_mutex); | ||
31 | static struct divert_info *divert_info_head = NULL; /* head of queue */ | 32 | static struct divert_info *divert_info_head = NULL; /* head of queue */ |
32 | static struct divert_info *divert_info_tail = NULL; /* pointer to last entry */ | 33 | static struct divert_info *divert_info_tail = NULL; /* pointer to last entry */ |
33 | static DEFINE_SPINLOCK(divert_info_lock);/* lock for queue */ | 34 | static DEFINE_SPINLOCK(divert_info_lock);/* lock for queue */ |
@@ -261,9 +262,9 @@ static long isdn_divert_ioctl(struct file *file, uint cmd, ulong arg) | |||
261 | { | 262 | { |
262 | long ret; | 263 | long ret; |
263 | 264 | ||
264 | lock_kernel(); | 265 | mutex_lock(&isdn_divert_mutex); |
265 | ret = isdn_divert_ioctl_unlocked(file, cmd, arg); | 266 | ret = isdn_divert_ioctl_unlocked(file, cmd, arg); |
266 | unlock_kernel(); | 267 | mutex_unlock(&isdn_divert_mutex); |
267 | 268 | ||
268 | return ret; | 269 | return ret; |
269 | } | 270 | } |
diff --git a/drivers/isdn/gigaset/Kconfig b/drivers/isdn/gigaset/Kconfig index dcefedc7044a..b18a92c32184 100644 --- a/drivers/isdn/gigaset/Kconfig +++ b/drivers/isdn/gigaset/Kconfig | |||
@@ -17,8 +17,7 @@ menuconfig ISDN_DRV_GIGASET | |||
17 | if ISDN_DRV_GIGASET | 17 | if ISDN_DRV_GIGASET |
18 | 18 | ||
19 | config GIGASET_CAPI | 19 | config GIGASET_CAPI |
20 | bool "Gigaset CAPI support (EXPERIMENTAL)" | 20 | bool "Gigaset CAPI support" |
21 | depends on EXPERIMENTAL | ||
22 | depends on ISDN_CAPI='y'||(ISDN_CAPI='m'&&ISDN_DRV_GIGASET='m') | 21 | depends on ISDN_CAPI='y'||(ISDN_CAPI='m'&&ISDN_DRV_GIGASET='m') |
23 | default ISDN_I4L='n' | 22 | default ISDN_I4L='n' |
24 | help | 23 | help |
@@ -27,6 +26,7 @@ config GIGASET_CAPI | |||
27 | subsystem you'll have to enable the capidrv glue driver. | 26 | subsystem you'll have to enable the capidrv glue driver. |
28 | (select ISDN_CAPI_CAPIDRV.) | 27 | (select ISDN_CAPI_CAPIDRV.) |
29 | Say N to build the old native ISDN4Linux variant. | 28 | Say N to build the old native ISDN4Linux variant. |
29 | If unsure, say Y. | ||
30 | 30 | ||
31 | config GIGASET_I4L | 31 | config GIGASET_I4L |
32 | bool | 32 | bool |
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c index c5016bd2d94f..c3b1dc3a13a0 100644 --- a/drivers/isdn/gigaset/asyncdata.c +++ b/drivers/isdn/gigaset/asyncdata.c | |||
@@ -126,26 +126,6 @@ static unsigned lock_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
126 | return numbytes; | 126 | return numbytes; |
127 | } | 127 | } |
128 | 128 | ||
129 | /* set up next receive skb for data mode | ||
130 | */ | ||
131 | static void new_rcv_skb(struct bc_state *bcs) | ||
132 | { | ||
133 | struct cardstate *cs = bcs->cs; | ||
134 | unsigned short hw_hdr_len = cs->hw_hdr_len; | ||
135 | |||
136 | if (bcs->ignore) { | ||
137 | bcs->skb = NULL; | ||
138 | return; | ||
139 | } | ||
140 | |||
141 | bcs->skb = dev_alloc_skb(SBUFSIZE + hw_hdr_len); | ||
142 | if (bcs->skb == NULL) { | ||
143 | dev_warn(cs->dev, "could not allocate new skb\n"); | ||
144 | return; | ||
145 | } | ||
146 | skb_reserve(bcs->skb, hw_hdr_len); | ||
147 | } | ||
148 | |||
149 | /* process a block of received bytes in HDLC data mode | 129 | /* process a block of received bytes in HDLC data mode |
150 | * (mstate != MS_LOCKED && !(inputstate & INS_command) && proto2 == L2_HDLC) | 130 | * (mstate != MS_LOCKED && !(inputstate & INS_command) && proto2 == L2_HDLC) |
151 | * Collect HDLC frames, undoing byte stuffing and watching for DLE escapes. | 131 | * Collect HDLC frames, undoing byte stuffing and watching for DLE escapes. |
@@ -159,8 +139,8 @@ static unsigned hdlc_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
159 | struct cardstate *cs = inbuf->cs; | 139 | struct cardstate *cs = inbuf->cs; |
160 | struct bc_state *bcs = cs->bcs; | 140 | struct bc_state *bcs = cs->bcs; |
161 | int inputstate = bcs->inputstate; | 141 | int inputstate = bcs->inputstate; |
162 | __u16 fcs = bcs->fcs; | 142 | __u16 fcs = bcs->rx_fcs; |
163 | struct sk_buff *skb = bcs->skb; | 143 | struct sk_buff *skb = bcs->rx_skb; |
164 | unsigned char *src = inbuf->data + inbuf->head; | 144 | unsigned char *src = inbuf->data + inbuf->head; |
165 | unsigned procbytes = 0; | 145 | unsigned procbytes = 0; |
166 | unsigned char c; | 146 | unsigned char c; |
@@ -245,8 +225,7 @@ byte_stuff: | |||
245 | 225 | ||
246 | /* prepare reception of next frame */ | 226 | /* prepare reception of next frame */ |
247 | inputstate &= ~INS_have_data; | 227 | inputstate &= ~INS_have_data; |
248 | new_rcv_skb(bcs); | 228 | skb = gigaset_new_rx_skb(bcs); |
249 | skb = bcs->skb; | ||
250 | } else { | 229 | } else { |
251 | /* empty frame (7E 7E) */ | 230 | /* empty frame (7E 7E) */ |
252 | #ifdef CONFIG_GIGASET_DEBUG | 231 | #ifdef CONFIG_GIGASET_DEBUG |
@@ -255,8 +234,7 @@ byte_stuff: | |||
255 | if (!skb) { | 234 | if (!skb) { |
256 | /* skipped (?) */ | 235 | /* skipped (?) */ |
257 | gigaset_isdn_rcv_err(bcs); | 236 | gigaset_isdn_rcv_err(bcs); |
258 | new_rcv_skb(bcs); | 237 | skb = gigaset_new_rx_skb(bcs); |
259 | skb = bcs->skb; | ||
260 | } | 238 | } |
261 | } | 239 | } |
262 | 240 | ||
@@ -279,11 +257,11 @@ byte_stuff: | |||
279 | #endif | 257 | #endif |
280 | inputstate |= INS_have_data; | 258 | inputstate |= INS_have_data; |
281 | if (skb) { | 259 | if (skb) { |
282 | if (skb->len == SBUFSIZE) { | 260 | if (skb->len >= bcs->rx_bufsize) { |
283 | dev_warn(cs->dev, "received packet too long\n"); | 261 | dev_warn(cs->dev, "received packet too long\n"); |
284 | dev_kfree_skb_any(skb); | 262 | dev_kfree_skb_any(skb); |
285 | /* skip remainder of packet */ | 263 | /* skip remainder of packet */ |
286 | bcs->skb = skb = NULL; | 264 | bcs->rx_skb = skb = NULL; |
287 | } else { | 265 | } else { |
288 | *__skb_put(skb, 1) = c; | 266 | *__skb_put(skb, 1) = c; |
289 | fcs = crc_ccitt_byte(fcs, c); | 267 | fcs = crc_ccitt_byte(fcs, c); |
@@ -292,7 +270,7 @@ byte_stuff: | |||
292 | } | 270 | } |
293 | 271 | ||
294 | bcs->inputstate = inputstate; | 272 | bcs->inputstate = inputstate; |
295 | bcs->fcs = fcs; | 273 | bcs->rx_fcs = fcs; |
296 | return procbytes; | 274 | return procbytes; |
297 | } | 275 | } |
298 | 276 | ||
@@ -308,18 +286,18 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
308 | struct cardstate *cs = inbuf->cs; | 286 | struct cardstate *cs = inbuf->cs; |
309 | struct bc_state *bcs = cs->bcs; | 287 | struct bc_state *bcs = cs->bcs; |
310 | int inputstate = bcs->inputstate; | 288 | int inputstate = bcs->inputstate; |
311 | struct sk_buff *skb = bcs->skb; | 289 | struct sk_buff *skb = bcs->rx_skb; |
312 | unsigned char *src = inbuf->data + inbuf->head; | 290 | unsigned char *src = inbuf->data + inbuf->head; |
313 | unsigned procbytes = 0; | 291 | unsigned procbytes = 0; |
314 | unsigned char c; | 292 | unsigned char c; |
315 | 293 | ||
316 | if (!skb) { | 294 | if (!skb) { |
317 | /* skip this block */ | 295 | /* skip this block */ |
318 | new_rcv_skb(bcs); | 296 | gigaset_new_rx_skb(bcs); |
319 | return numbytes; | 297 | return numbytes; |
320 | } | 298 | } |
321 | 299 | ||
322 | while (procbytes < numbytes && skb->len < SBUFSIZE) { | 300 | while (procbytes < numbytes && skb->len < bcs->rx_bufsize) { |
323 | c = *src++; | 301 | c = *src++; |
324 | procbytes++; | 302 | procbytes++; |
325 | 303 | ||
@@ -343,7 +321,7 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
343 | if (inputstate & INS_have_data) { | 321 | if (inputstate & INS_have_data) { |
344 | gigaset_skb_rcvd(bcs, skb); | 322 | gigaset_skb_rcvd(bcs, skb); |
345 | inputstate &= ~INS_have_data; | 323 | inputstate &= ~INS_have_data; |
346 | new_rcv_skb(bcs); | 324 | gigaset_new_rx_skb(bcs); |
347 | } | 325 | } |
348 | 326 | ||
349 | bcs->inputstate = inputstate; | 327 | bcs->inputstate = inputstate; |
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 47a5ffec55a3..0ded3640b926 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -1188,24 +1188,6 @@ static void write_iso_tasklet(unsigned long data) | |||
1188 | break; | 1188 | break; |
1189 | } | 1189 | } |
1190 | } | 1190 | } |
1191 | #ifdef CONFIG_GIGASET_DEBUG | ||
1192 | /* check assumption on remaining frames */ | ||
1193 | for (; i < BAS_NUMFRAMES; i++) { | ||
1194 | ifd = &urb->iso_frame_desc[i]; | ||
1195 | if (ifd->status != -EINPROGRESS | ||
1196 | || ifd->actual_length != 0) { | ||
1197 | dev_warn(cs->dev, | ||
1198 | "isochronous write: frame %d: %s, " | ||
1199 | "%d of %d bytes sent\n", | ||
1200 | i, get_usb_statmsg(ifd->status), | ||
1201 | ifd->actual_length, ifd->length); | ||
1202 | offset = (ifd->offset + | ||
1203 | ifd->actual_length) | ||
1204 | % BAS_OUTBUFSIZE; | ||
1205 | break; | ||
1206 | } | ||
1207 | } | ||
1208 | #endif | ||
1209 | break; | 1191 | break; |
1210 | case -EPIPE: /* stall - probably underrun */ | 1192 | case -EPIPE: /* stall - probably underrun */ |
1211 | dev_err(cs->dev, "isochronous write stalled\n"); | 1193 | dev_err(cs->dev, "isochronous write stalled\n"); |
@@ -1913,65 +1895,41 @@ static int start_cbsend(struct cardstate *cs) | |||
1913 | * USB transmission is started if necessary. | 1895 | * USB transmission is started if necessary. |
1914 | * parameters: | 1896 | * parameters: |
1915 | * cs controller state structure | 1897 | * cs controller state structure |
1916 | * buf command string to send | 1898 | * cb command buffer structure |
1917 | * len number of bytes to send (max. IF_WRITEBUF) | ||
1918 | * wake_tasklet tasklet to run when transmission is completed | ||
1919 | * (NULL if none) | ||
1920 | * return value: | 1899 | * return value: |
1921 | * number of bytes queued on success | 1900 | * number of bytes queued on success |
1922 | * error code < 0 on error | 1901 | * error code < 0 on error |
1923 | */ | 1902 | */ |
1924 | static int gigaset_write_cmd(struct cardstate *cs, | 1903 | static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb) |
1925 | const unsigned char *buf, int len, | ||
1926 | struct tasklet_struct *wake_tasklet) | ||
1927 | { | 1904 | { |
1928 | struct cmdbuf_t *cb; | ||
1929 | unsigned long flags; | 1905 | unsigned long flags; |
1930 | int rc; | 1906 | int rc; |
1931 | 1907 | ||
1932 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? | 1908 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? |
1933 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, | 1909 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, |
1934 | "CMD Transmit", len, buf); | 1910 | "CMD Transmit", cb->len, cb->buf); |
1935 | |||
1936 | if (len <= 0) { | ||
1937 | /* nothing to do */ | ||
1938 | rc = 0; | ||
1939 | goto notqueued; | ||
1940 | } | ||
1941 | 1911 | ||
1942 | /* translate "+++" escape sequence sent as a single separate command | 1912 | /* translate "+++" escape sequence sent as a single separate command |
1943 | * into "close AT channel" command for error recovery | 1913 | * into "close AT channel" command for error recovery |
1944 | * The next command will reopen the AT channel automatically. | 1914 | * The next command will reopen the AT channel automatically. |
1945 | */ | 1915 | */ |
1946 | if (len == 3 && !memcmp(buf, "+++", 3)) { | 1916 | if (cb->len == 3 && !memcmp(cb->buf, "+++", 3)) { |
1917 | kfree(cb); | ||
1947 | rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT); | 1918 | rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT); |
1948 | goto notqueued; | 1919 | if (cb->wake_tasklet) |
1920 | tasklet_schedule(cb->wake_tasklet); | ||
1921 | return rc < 0 ? rc : cb->len; | ||
1949 | } | 1922 | } |
1950 | 1923 | ||
1951 | if (len > IF_WRITEBUF) | ||
1952 | len = IF_WRITEBUF; | ||
1953 | cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC); | ||
1954 | if (!cb) { | ||
1955 | dev_err(cs->dev, "%s: out of memory\n", __func__); | ||
1956 | rc = -ENOMEM; | ||
1957 | goto notqueued; | ||
1958 | } | ||
1959 | |||
1960 | memcpy(cb->buf, buf, len); | ||
1961 | cb->len = len; | ||
1962 | cb->offset = 0; | ||
1963 | cb->next = NULL; | ||
1964 | cb->wake_tasklet = wake_tasklet; | ||
1965 | |||
1966 | spin_lock_irqsave(&cs->cmdlock, flags); | 1924 | spin_lock_irqsave(&cs->cmdlock, flags); |
1967 | cb->prev = cs->lastcmdbuf; | 1925 | cb->prev = cs->lastcmdbuf; |
1968 | if (cs->lastcmdbuf) | 1926 | if (cs->lastcmdbuf) |
1969 | cs->lastcmdbuf->next = cb; | 1927 | cs->lastcmdbuf->next = cb; |
1970 | else { | 1928 | else { |
1971 | cs->cmdbuf = cb; | 1929 | cs->cmdbuf = cb; |
1972 | cs->curlen = len; | 1930 | cs->curlen = cb->len; |
1973 | } | 1931 | } |
1974 | cs->cmdbytes += len; | 1932 | cs->cmdbytes += cb->len; |
1975 | cs->lastcmdbuf = cb; | 1933 | cs->lastcmdbuf = cb; |
1976 | spin_unlock_irqrestore(&cs->cmdlock, flags); | 1934 | spin_unlock_irqrestore(&cs->cmdlock, flags); |
1977 | 1935 | ||
@@ -1988,12 +1946,7 @@ static int gigaset_write_cmd(struct cardstate *cs, | |||
1988 | } | 1946 | } |
1989 | rc = start_cbsend(cs); | 1947 | rc = start_cbsend(cs); |
1990 | spin_unlock_irqrestore(&cs->lock, flags); | 1948 | spin_unlock_irqrestore(&cs->lock, flags); |
1991 | return rc < 0 ? rc : len; | 1949 | return rc < 0 ? rc : cb->len; |
1992 | |||
1993 | notqueued: /* request handled without queuing */ | ||
1994 | if (wake_tasklet) | ||
1995 | tasklet_schedule(wake_tasklet); | ||
1996 | return rc; | ||
1997 | } | 1950 | } |
1998 | 1951 | ||
1999 | /* gigaset_write_room | 1952 | /* gigaset_write_room |
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c index 8f78f15c8ef7..e5ea344a551a 100644 --- a/drivers/isdn/gigaset/capi.c +++ b/drivers/isdn/gigaset/capi.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #define CAPI_FACILITY_LI 0x0005 | 45 | #define CAPI_FACILITY_LI 0x0005 |
46 | 46 | ||
47 | #define CAPI_SUPPSVC_GETSUPPORTED 0x0000 | 47 | #define CAPI_SUPPSVC_GETSUPPORTED 0x0000 |
48 | #define CAPI_SUPPSVC_LISTEN 0x0001 | ||
48 | 49 | ||
49 | /* missing from capiutil.h */ | 50 | /* missing from capiutil.h */ |
50 | #define CAPIMSG_PLCI_PART(m) CAPIMSG_U8(m, 9) | 51 | #define CAPIMSG_PLCI_PART(m) CAPIMSG_U8(m, 9) |
@@ -70,7 +71,7 @@ | |||
70 | #define MAX_NUMBER_DIGITS 20 | 71 | #define MAX_NUMBER_DIGITS 20 |
71 | #define MAX_FMT_IE_LEN 20 | 72 | #define MAX_FMT_IE_LEN 20 |
72 | 73 | ||
73 | /* values for gigaset_capi_appl.connected */ | 74 | /* values for bcs->apconnstate */ |
74 | #define APCONN_NONE 0 /* inactive/listening */ | 75 | #define APCONN_NONE 0 /* inactive/listening */ |
75 | #define APCONN_SETUP 1 /* connecting */ | 76 | #define APCONN_SETUP 1 /* connecting */ |
76 | #define APCONN_ACTIVE 2 /* B channel up */ | 77 | #define APCONN_ACTIVE 2 /* B channel up */ |
@@ -80,10 +81,10 @@ struct gigaset_capi_appl { | |||
80 | struct list_head ctrlist; | 81 | struct list_head ctrlist; |
81 | struct gigaset_capi_appl *bcnext; | 82 | struct gigaset_capi_appl *bcnext; |
82 | u16 id; | 83 | u16 id; |
84 | struct capi_register_params rp; | ||
83 | u16 nextMessageNumber; | 85 | u16 nextMessageNumber; |
84 | u32 listenInfoMask; | 86 | u32 listenInfoMask; |
85 | u32 listenCIPmask; | 87 | u32 listenCIPmask; |
86 | int connected; | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | /* CAPI specific controller data structure */ | 90 | /* CAPI specific controller data structure */ |
@@ -270,9 +271,13 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag, | |||
270 | kfree(dbgline); | 271 | kfree(dbgline); |
271 | if (CAPIMSG_COMMAND(data) == CAPI_DATA_B3 && | 272 | if (CAPIMSG_COMMAND(data) == CAPI_DATA_B3 && |
272 | (CAPIMSG_SUBCOMMAND(data) == CAPI_REQ || | 273 | (CAPIMSG_SUBCOMMAND(data) == CAPI_REQ || |
273 | CAPIMSG_SUBCOMMAND(data) == CAPI_IND) && | 274 | CAPIMSG_SUBCOMMAND(data) == CAPI_IND)) { |
274 | CAPIMSG_DATALEN(data) > 0) { | ||
275 | l = CAPIMSG_DATALEN(data); | 275 | l = CAPIMSG_DATALEN(data); |
276 | gig_dbg(level, " DataLength=%d", l); | ||
277 | if (l <= 0 || !(gigaset_debuglevel & DEBUG_LLDATA)) | ||
278 | return; | ||
279 | if (l > 64) | ||
280 | l = 64; /* arbitrary limit */ | ||
276 | dbgline = kmalloc(3*l, GFP_ATOMIC); | 281 | dbgline = kmalloc(3*l, GFP_ATOMIC); |
277 | if (!dbgline) | 282 | if (!dbgline) |
278 | return; | 283 | return; |
@@ -319,6 +324,39 @@ static const char *format_ie(const char *ie) | |||
319 | return result; | 324 | return result; |
320 | } | 325 | } |
321 | 326 | ||
327 | /* | ||
328 | * emit DATA_B3_CONF message | ||
329 | */ | ||
330 | static void send_data_b3_conf(struct cardstate *cs, struct capi_ctr *ctr, | ||
331 | u16 appl, u16 msgid, int channel, | ||
332 | u16 handle, u16 info) | ||
333 | { | ||
334 | struct sk_buff *cskb; | ||
335 | u8 *msg; | ||
336 | |||
337 | cskb = alloc_skb(CAPI_DATA_B3_CONF_LEN, GFP_ATOMIC); | ||
338 | if (!cskb) { | ||
339 | dev_err(cs->dev, "%s: out of memory\n", __func__); | ||
340 | return; | ||
341 | } | ||
342 | /* frequent message, avoid _cmsg overhead */ | ||
343 | msg = __skb_put(cskb, CAPI_DATA_B3_CONF_LEN); | ||
344 | CAPIMSG_SETLEN(msg, CAPI_DATA_B3_CONF_LEN); | ||
345 | CAPIMSG_SETAPPID(msg, appl); | ||
346 | CAPIMSG_SETCOMMAND(msg, CAPI_DATA_B3); | ||
347 | CAPIMSG_SETSUBCOMMAND(msg, CAPI_CONF); | ||
348 | CAPIMSG_SETMSGID(msg, msgid); | ||
349 | CAPIMSG_SETCONTROLLER(msg, ctr->cnr); | ||
350 | CAPIMSG_SETPLCI_PART(msg, channel); | ||
351 | CAPIMSG_SETNCCI_PART(msg, 1); | ||
352 | CAPIMSG_SETHANDLE_CONF(msg, handle); | ||
353 | CAPIMSG_SETINFO_CONF(msg, info); | ||
354 | |||
355 | /* emit message */ | ||
356 | dump_rawmsg(DEBUG_MCMD, __func__, msg); | ||
357 | capi_ctr_handle_message(ctr, appl, cskb); | ||
358 | } | ||
359 | |||
322 | 360 | ||
323 | /* | 361 | /* |
324 | * driver interface functions | 362 | * driver interface functions |
@@ -339,51 +377,33 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *dskb) | |||
339 | struct gigaset_capi_ctr *iif = cs->iif; | 377 | struct gigaset_capi_ctr *iif = cs->iif; |
340 | struct gigaset_capi_appl *ap = bcs->ap; | 378 | struct gigaset_capi_appl *ap = bcs->ap; |
341 | unsigned char *req = skb_mac_header(dskb); | 379 | unsigned char *req = skb_mac_header(dskb); |
342 | struct sk_buff *cskb; | ||
343 | u16 flags; | 380 | u16 flags; |
344 | 381 | ||
345 | /* update statistics */ | 382 | /* update statistics */ |
346 | ++bcs->trans_up; | 383 | ++bcs->trans_up; |
347 | 384 | ||
348 | if (!ap) { | 385 | if (!ap) { |
349 | dev_err(cs->dev, "%s: no application\n", __func__); | 386 | gig_dbg(DEBUG_MCMD, "%s: application gone", __func__); |
350 | return; | 387 | return; |
351 | } | 388 | } |
352 | 389 | ||
353 | /* don't send further B3 messages if disconnected */ | 390 | /* don't send further B3 messages if disconnected */ |
354 | if (ap->connected < APCONN_ACTIVE) { | 391 | if (bcs->apconnstate < APCONN_ACTIVE) { |
355 | gig_dbg(DEBUG_LLDATA, "disconnected, discarding ack"); | 392 | gig_dbg(DEBUG_MCMD, "%s: disconnected", __func__); |
356 | return; | 393 | return; |
357 | } | 394 | } |
358 | 395 | ||
359 | /* ToDo: honor unset "delivery confirmation" bit */ | 396 | /* |
397 | * send DATA_B3_CONF if "delivery confirmation" bit was set in request; | ||
398 | * otherwise it has already been sent by do_data_b3_req() | ||
399 | */ | ||
360 | flags = CAPIMSG_FLAGS(req); | 400 | flags = CAPIMSG_FLAGS(req); |
361 | 401 | if (flags & CAPI_FLAGS_DELIVERY_CONFIRMATION) | |
362 | /* build DATA_B3_CONF message */ | 402 | send_data_b3_conf(cs, &iif->ctr, ap->id, CAPIMSG_MSGID(req), |
363 | cskb = alloc_skb(CAPI_DATA_B3_CONF_LEN, GFP_ATOMIC); | 403 | bcs->channel + 1, CAPIMSG_HANDLE_REQ(req), |
364 | if (!cskb) { | 404 | (flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION) ? |
365 | dev_err(cs->dev, "%s: out of memory\n", __func__); | 405 | CapiFlagsNotSupportedByProtocol : |
366 | return; | 406 | CAPI_NOERROR); |
367 | } | ||
368 | /* frequent message, avoid _cmsg overhead */ | ||
369 | CAPIMSG_SETLEN(cskb->data, CAPI_DATA_B3_CONF_LEN); | ||
370 | CAPIMSG_SETAPPID(cskb->data, ap->id); | ||
371 | CAPIMSG_SETCOMMAND(cskb->data, CAPI_DATA_B3); | ||
372 | CAPIMSG_SETSUBCOMMAND(cskb->data, CAPI_CONF); | ||
373 | CAPIMSG_SETMSGID(cskb->data, CAPIMSG_MSGID(req)); | ||
374 | CAPIMSG_SETCONTROLLER(cskb->data, iif->ctr.cnr); | ||
375 | CAPIMSG_SETPLCI_PART(cskb->data, bcs->channel + 1); | ||
376 | CAPIMSG_SETNCCI_PART(cskb->data, 1); | ||
377 | CAPIMSG_SETHANDLE_CONF(cskb->data, CAPIMSG_HANDLE_REQ(req)); | ||
378 | if (flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION) | ||
379 | CAPIMSG_SETINFO_CONF(cskb->data, | ||
380 | CapiFlagsNotSupportedByProtocol); | ||
381 | else | ||
382 | CAPIMSG_SETINFO_CONF(cskb->data, CAPI_NOERROR); | ||
383 | |||
384 | /* emit message */ | ||
385 | dump_rawmsg(DEBUG_LLDATA, "DATA_B3_CONF", cskb->data); | ||
386 | capi_ctr_handle_message(&iif->ctr, ap->id, cskb); | ||
387 | } | 407 | } |
388 | EXPORT_SYMBOL_GPL(gigaset_skb_sent); | 408 | EXPORT_SYMBOL_GPL(gigaset_skb_sent); |
389 | 409 | ||
@@ -407,13 +427,14 @@ void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb) | |||
407 | bcs->trans_down++; | 427 | bcs->trans_down++; |
408 | 428 | ||
409 | if (!ap) { | 429 | if (!ap) { |
410 | dev_err(cs->dev, "%s: no application\n", __func__); | 430 | gig_dbg(DEBUG_MCMD, "%s: application gone", __func__); |
431 | dev_kfree_skb_any(skb); | ||
411 | return; | 432 | return; |
412 | } | 433 | } |
413 | 434 | ||
414 | /* don't send further B3 messages if disconnected */ | 435 | /* don't send further B3 messages if disconnected */ |
415 | if (ap->connected < APCONN_ACTIVE) { | 436 | if (bcs->apconnstate < APCONN_ACTIVE) { |
416 | gig_dbg(DEBUG_LLDATA, "disconnected, discarding data"); | 437 | gig_dbg(DEBUG_MCMD, "%s: disconnected", __func__); |
417 | dev_kfree_skb_any(skb); | 438 | dev_kfree_skb_any(skb); |
418 | return; | 439 | return; |
419 | } | 440 | } |
@@ -439,7 +460,7 @@ void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb) | |||
439 | /* Data64 parameter not present */ | 460 | /* Data64 parameter not present */ |
440 | 461 | ||
441 | /* emit message */ | 462 | /* emit message */ |
442 | dump_rawmsg(DEBUG_LLDATA, "DATA_B3_IND", skb->data); | 463 | dump_rawmsg(DEBUG_MCMD, __func__, skb->data); |
443 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); | 464 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); |
444 | } | 465 | } |
445 | EXPORT_SYMBOL_GPL(gigaset_skb_rcvd); | 466 | EXPORT_SYMBOL_GPL(gigaset_skb_rcvd); |
@@ -484,6 +505,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
484 | u32 actCIPmask; | 505 | u32 actCIPmask; |
485 | struct sk_buff *skb; | 506 | struct sk_buff *skb; |
486 | unsigned int msgsize; | 507 | unsigned int msgsize; |
508 | unsigned long flags; | ||
487 | int i; | 509 | int i; |
488 | 510 | ||
489 | /* | 511 | /* |
@@ -608,7 +630,14 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
608 | format_ie(iif->hcmsg.CalledPartyNumber)); | 630 | format_ie(iif->hcmsg.CalledPartyNumber)); |
609 | 631 | ||
610 | /* scan application list for matching listeners */ | 632 | /* scan application list for matching listeners */ |
611 | bcs->ap = NULL; | 633 | spin_lock_irqsave(&bcs->aplock, flags); |
634 | if (bcs->ap != NULL || bcs->apconnstate != APCONN_NONE) { | ||
635 | dev_warn(cs->dev, "%s: channel not properly cleared (%p/%d)\n", | ||
636 | __func__, bcs->ap, bcs->apconnstate); | ||
637 | bcs->ap = NULL; | ||
638 | bcs->apconnstate = APCONN_NONE; | ||
639 | } | ||
640 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
612 | actCIPmask = 1 | (1 << iif->hcmsg.CIPValue); | 641 | actCIPmask = 1 | (1 << iif->hcmsg.CIPValue); |
613 | list_for_each_entry(ap, &iif->appls, ctrlist) | 642 | list_for_each_entry(ap, &iif->appls, ctrlist) |
614 | if (actCIPmask & ap->listenCIPmask) { | 643 | if (actCIPmask & ap->listenCIPmask) { |
@@ -626,10 +655,12 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
626 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); | 655 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); |
627 | 656 | ||
628 | /* add to listeners on this B channel, update state */ | 657 | /* add to listeners on this B channel, update state */ |
658 | spin_lock_irqsave(&bcs->aplock, flags); | ||
629 | ap->bcnext = bcs->ap; | 659 | ap->bcnext = bcs->ap; |
630 | bcs->ap = ap; | 660 | bcs->ap = ap; |
631 | bcs->chstate |= CHS_NOTIFY_LL; | 661 | bcs->chstate |= CHS_NOTIFY_LL; |
632 | ap->connected = APCONN_SETUP; | 662 | bcs->apconnstate = APCONN_SETUP; |
663 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
633 | 664 | ||
634 | /* emit message */ | 665 | /* emit message */ |
635 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); | 666 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); |
@@ -654,7 +685,7 @@ static void send_disconnect_ind(struct bc_state *bcs, | |||
654 | struct gigaset_capi_ctr *iif = cs->iif; | 685 | struct gigaset_capi_ctr *iif = cs->iif; |
655 | struct sk_buff *skb; | 686 | struct sk_buff *skb; |
656 | 687 | ||
657 | if (ap->connected == APCONN_NONE) | 688 | if (bcs->apconnstate == APCONN_NONE) |
658 | return; | 689 | return; |
659 | 690 | ||
660 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT, CAPI_IND, | 691 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT, CAPI_IND, |
@@ -668,7 +699,6 @@ static void send_disconnect_ind(struct bc_state *bcs, | |||
668 | } | 699 | } |
669 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, CAPI_DISCONNECT_IND_LEN)); | 700 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, CAPI_DISCONNECT_IND_LEN)); |
670 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); | 701 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); |
671 | ap->connected = APCONN_NONE; | ||
672 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); | 702 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); |
673 | } | 703 | } |
674 | 704 | ||
@@ -685,9 +715,9 @@ static void send_disconnect_b3_ind(struct bc_state *bcs, | |||
685 | struct sk_buff *skb; | 715 | struct sk_buff *skb; |
686 | 716 | ||
687 | /* nothing to do if no logical connection active */ | 717 | /* nothing to do if no logical connection active */ |
688 | if (ap->connected < APCONN_ACTIVE) | 718 | if (bcs->apconnstate < APCONN_ACTIVE) |
689 | return; | 719 | return; |
690 | ap->connected = APCONN_SETUP; | 720 | bcs->apconnstate = APCONN_SETUP; |
691 | 721 | ||
692 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT_B3, CAPI_IND, | 722 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT_B3, CAPI_IND, |
693 | ap->nextMessageNumber++, | 723 | ap->nextMessageNumber++, |
@@ -714,14 +744,25 @@ void gigaset_isdn_connD(struct bc_state *bcs) | |||
714 | { | 744 | { |
715 | struct cardstate *cs = bcs->cs; | 745 | struct cardstate *cs = bcs->cs; |
716 | struct gigaset_capi_ctr *iif = cs->iif; | 746 | struct gigaset_capi_ctr *iif = cs->iif; |
717 | struct gigaset_capi_appl *ap = bcs->ap; | 747 | struct gigaset_capi_appl *ap; |
718 | struct sk_buff *skb; | 748 | struct sk_buff *skb; |
719 | unsigned int msgsize; | 749 | unsigned int msgsize; |
750 | unsigned long flags; | ||
720 | 751 | ||
752 | spin_lock_irqsave(&bcs->aplock, flags); | ||
753 | ap = bcs->ap; | ||
721 | if (!ap) { | 754 | if (!ap) { |
722 | dev_err(cs->dev, "%s: no application\n", __func__); | 755 | spin_unlock_irqrestore(&bcs->aplock, flags); |
756 | gig_dbg(DEBUG_CMD, "%s: application gone", __func__); | ||
723 | return; | 757 | return; |
724 | } | 758 | } |
759 | if (bcs->apconnstate == APCONN_NONE) { | ||
760 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
761 | dev_warn(cs->dev, "%s: application %u not connected\n", | ||
762 | __func__, ap->id); | ||
763 | return; | ||
764 | } | ||
765 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
725 | while (ap->bcnext) { | 766 | while (ap->bcnext) { |
726 | /* this should never happen */ | 767 | /* this should never happen */ |
727 | dev_warn(cs->dev, "%s: dropping extra application %u\n", | 768 | dev_warn(cs->dev, "%s: dropping extra application %u\n", |
@@ -730,11 +771,6 @@ void gigaset_isdn_connD(struct bc_state *bcs) | |||
730 | CapiCallGivenToOtherApplication); | 771 | CapiCallGivenToOtherApplication); |
731 | ap->bcnext = ap->bcnext->bcnext; | 772 | ap->bcnext = ap->bcnext->bcnext; |
732 | } | 773 | } |
733 | if (ap->connected == APCONN_NONE) { | ||
734 | dev_warn(cs->dev, "%s: application %u not connected\n", | ||
735 | __func__, ap->id); | ||
736 | return; | ||
737 | } | ||
738 | 774 | ||
739 | /* prepare CONNECT_ACTIVE_IND message | 775 | /* prepare CONNECT_ACTIVE_IND message |
740 | * Note: LLC not supported by device | 776 | * Note: LLC not supported by device |
@@ -772,17 +808,24 @@ void gigaset_isdn_connD(struct bc_state *bcs) | |||
772 | void gigaset_isdn_hupD(struct bc_state *bcs) | 808 | void gigaset_isdn_hupD(struct bc_state *bcs) |
773 | { | 809 | { |
774 | struct gigaset_capi_appl *ap; | 810 | struct gigaset_capi_appl *ap; |
811 | unsigned long flags; | ||
775 | 812 | ||
776 | /* | 813 | /* |
777 | * ToDo: pass on reason code reported by device | 814 | * ToDo: pass on reason code reported by device |
778 | * (requires ev-layer state machine extension to collect | 815 | * (requires ev-layer state machine extension to collect |
779 | * ZCAU device reply) | 816 | * ZCAU device reply) |
780 | */ | 817 | */ |
781 | for (ap = bcs->ap; ap != NULL; ap = ap->bcnext) { | 818 | spin_lock_irqsave(&bcs->aplock, flags); |
819 | while (bcs->ap != NULL) { | ||
820 | ap = bcs->ap; | ||
821 | bcs->ap = ap->bcnext; | ||
822 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
782 | send_disconnect_b3_ind(bcs, ap); | 823 | send_disconnect_b3_ind(bcs, ap); |
783 | send_disconnect_ind(bcs, ap, 0); | 824 | send_disconnect_ind(bcs, ap, 0); |
825 | spin_lock_irqsave(&bcs->aplock, flags); | ||
784 | } | 826 | } |
785 | bcs->ap = NULL; | 827 | bcs->apconnstate = APCONN_NONE; |
828 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
786 | } | 829 | } |
787 | 830 | ||
788 | /** | 831 | /** |
@@ -796,24 +839,21 @@ void gigaset_isdn_connB(struct bc_state *bcs) | |||
796 | { | 839 | { |
797 | struct cardstate *cs = bcs->cs; | 840 | struct cardstate *cs = bcs->cs; |
798 | struct gigaset_capi_ctr *iif = cs->iif; | 841 | struct gigaset_capi_ctr *iif = cs->iif; |
799 | struct gigaset_capi_appl *ap = bcs->ap; | 842 | struct gigaset_capi_appl *ap; |
800 | struct sk_buff *skb; | 843 | struct sk_buff *skb; |
844 | unsigned long flags; | ||
801 | unsigned int msgsize; | 845 | unsigned int msgsize; |
802 | u8 command; | 846 | u8 command; |
803 | 847 | ||
848 | spin_lock_irqsave(&bcs->aplock, flags); | ||
849 | ap = bcs->ap; | ||
804 | if (!ap) { | 850 | if (!ap) { |
805 | dev_err(cs->dev, "%s: no application\n", __func__); | 851 | spin_unlock_irqrestore(&bcs->aplock, flags); |
852 | gig_dbg(DEBUG_CMD, "%s: application gone", __func__); | ||
806 | return; | 853 | return; |
807 | } | 854 | } |
808 | while (ap->bcnext) { | 855 | if (!bcs->apconnstate) { |
809 | /* this should never happen */ | 856 | spin_unlock_irqrestore(&bcs->aplock, flags); |
810 | dev_warn(cs->dev, "%s: dropping extra application %u\n", | ||
811 | __func__, ap->bcnext->id); | ||
812 | send_disconnect_ind(bcs, ap->bcnext, | ||
813 | CapiCallGivenToOtherApplication); | ||
814 | ap->bcnext = ap->bcnext->bcnext; | ||
815 | } | ||
816 | if (!ap->connected) { | ||
817 | dev_warn(cs->dev, "%s: application %u not connected\n", | 857 | dev_warn(cs->dev, "%s: application %u not connected\n", |
818 | __func__, ap->id); | 858 | __func__, ap->id); |
819 | return; | 859 | return; |
@@ -825,13 +865,26 @@ void gigaset_isdn_connB(struct bc_state *bcs) | |||
825 | * CONNECT_B3_ACTIVE_IND in reply to CONNECT_B3_RESP | 865 | * CONNECT_B3_ACTIVE_IND in reply to CONNECT_B3_RESP |
826 | * Parameters in both cases always: NCCI = 1, NCPI empty | 866 | * Parameters in both cases always: NCCI = 1, NCPI empty |
827 | */ | 867 | */ |
828 | if (ap->connected >= APCONN_ACTIVE) { | 868 | if (bcs->apconnstate >= APCONN_ACTIVE) { |
829 | command = CAPI_CONNECT_B3_ACTIVE; | 869 | command = CAPI_CONNECT_B3_ACTIVE; |
830 | msgsize = CAPI_CONNECT_B3_ACTIVE_IND_BASELEN; | 870 | msgsize = CAPI_CONNECT_B3_ACTIVE_IND_BASELEN; |
831 | } else { | 871 | } else { |
832 | command = CAPI_CONNECT_B3; | 872 | command = CAPI_CONNECT_B3; |
833 | msgsize = CAPI_CONNECT_B3_IND_BASELEN; | 873 | msgsize = CAPI_CONNECT_B3_IND_BASELEN; |
834 | } | 874 | } |
875 | bcs->apconnstate = APCONN_ACTIVE; | ||
876 | |||
877 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
878 | |||
879 | while (ap->bcnext) { | ||
880 | /* this should never happen */ | ||
881 | dev_warn(cs->dev, "%s: dropping extra application %u\n", | ||
882 | __func__, ap->bcnext->id); | ||
883 | send_disconnect_ind(bcs, ap->bcnext, | ||
884 | CapiCallGivenToOtherApplication); | ||
885 | ap->bcnext = ap->bcnext->bcnext; | ||
886 | } | ||
887 | |||
835 | capi_cmsg_header(&iif->hcmsg, ap->id, command, CAPI_IND, | 888 | capi_cmsg_header(&iif->hcmsg, ap->id, command, CAPI_IND, |
836 | ap->nextMessageNumber++, | 889 | ap->nextMessageNumber++, |
837 | iif->ctr.cnr | ((bcs->channel + 1) << 8) | (1 << 16)); | 890 | iif->ctr.cnr | ((bcs->channel + 1) << 8) | (1 << 16)); |
@@ -842,7 +895,6 @@ void gigaset_isdn_connB(struct bc_state *bcs) | |||
842 | } | 895 | } |
843 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, msgsize)); | 896 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, msgsize)); |
844 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); | 897 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); |
845 | ap->connected = APCONN_ACTIVE; | ||
846 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); | 898 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); |
847 | } | 899 | } |
848 | 900 | ||
@@ -855,13 +907,12 @@ void gigaset_isdn_connB(struct bc_state *bcs) | |||
855 | */ | 907 | */ |
856 | void gigaset_isdn_hupB(struct bc_state *bcs) | 908 | void gigaset_isdn_hupB(struct bc_state *bcs) |
857 | { | 909 | { |
858 | struct cardstate *cs = bcs->cs; | ||
859 | struct gigaset_capi_appl *ap = bcs->ap; | 910 | struct gigaset_capi_appl *ap = bcs->ap; |
860 | 911 | ||
861 | /* ToDo: assure order of DISCONNECT_B3_IND and DISCONNECT_IND ? */ | 912 | /* ToDo: assure order of DISCONNECT_B3_IND and DISCONNECT_IND ? */ |
862 | 913 | ||
863 | if (!ap) { | 914 | if (!ap) { |
864 | dev_err(cs->dev, "%s: no application\n", __func__); | 915 | gig_dbg(DEBUG_CMD, "%s: application gone", __func__); |
865 | return; | 916 | return; |
866 | } | 917 | } |
867 | 918 | ||
@@ -932,6 +983,9 @@ static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl, | |||
932 | struct cardstate *cs = ctr->driverdata; | 983 | struct cardstate *cs = ctr->driverdata; |
933 | struct gigaset_capi_appl *ap; | 984 | struct gigaset_capi_appl *ap; |
934 | 985 | ||
986 | gig_dbg(DEBUG_CMD, "%s [%u] l3cnt=%u blkcnt=%u blklen=%u", | ||
987 | __func__, appl, rp->level3cnt, rp->datablkcnt, rp->datablklen); | ||
988 | |||
935 | list_for_each_entry(ap, &iif->appls, ctrlist) | 989 | list_for_each_entry(ap, &iif->appls, ctrlist) |
936 | if (ap->id == appl) { | 990 | if (ap->id == appl) { |
937 | dev_notice(cs->dev, | 991 | dev_notice(cs->dev, |
@@ -945,8 +999,64 @@ static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl, | |||
945 | return; | 999 | return; |
946 | } | 1000 | } |
947 | ap->id = appl; | 1001 | ap->id = appl; |
1002 | ap->rp = *rp; | ||
948 | 1003 | ||
949 | list_add(&ap->ctrlist, &iif->appls); | 1004 | list_add(&ap->ctrlist, &iif->appls); |
1005 | dev_info(cs->dev, "application %u registered\n", ap->id); | ||
1006 | } | ||
1007 | |||
1008 | /* | ||
1009 | * remove CAPI application from channel | ||
1010 | * helper function to keep indentation levels down and stay in 80 columns | ||
1011 | */ | ||
1012 | |||
1013 | static inline void remove_appl_from_channel(struct bc_state *bcs, | ||
1014 | struct gigaset_capi_appl *ap) | ||
1015 | { | ||
1016 | struct cardstate *cs = bcs->cs; | ||
1017 | struct gigaset_capi_appl *bcap; | ||
1018 | unsigned long flags; | ||
1019 | int prevconnstate; | ||
1020 | |||
1021 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1022 | bcap = bcs->ap; | ||
1023 | if (bcap == NULL) { | ||
1024 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1025 | return; | ||
1026 | } | ||
1027 | |||
1028 | /* check first application on channel */ | ||
1029 | if (bcap == ap) { | ||
1030 | bcs->ap = ap->bcnext; | ||
1031 | if (bcs->ap != NULL) { | ||
1032 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1033 | return; | ||
1034 | } | ||
1035 | |||
1036 | /* none left, clear channel state */ | ||
1037 | prevconnstate = bcs->apconnstate; | ||
1038 | bcs->apconnstate = APCONN_NONE; | ||
1039 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1040 | |||
1041 | if (prevconnstate == APCONN_ACTIVE) { | ||
1042 | dev_notice(cs->dev, "%s: hanging up channel %u\n", | ||
1043 | __func__, bcs->channel); | ||
1044 | gigaset_add_event(cs, &bcs->at_state, | ||
1045 | EV_HUP, NULL, 0, NULL); | ||
1046 | gigaset_schedule_event(cs); | ||
1047 | } | ||
1048 | return; | ||
1049 | } | ||
1050 | |||
1051 | /* check remaining list */ | ||
1052 | do { | ||
1053 | if (bcap->bcnext == ap) { | ||
1054 | bcap->bcnext = bcap->bcnext->bcnext; | ||
1055 | return; | ||
1056 | } | ||
1057 | bcap = bcap->bcnext; | ||
1058 | } while (bcap != NULL); | ||
1059 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
950 | } | 1060 | } |
951 | 1061 | ||
952 | /* | 1062 | /* |
@@ -958,19 +1068,21 @@ static void gigaset_release_appl(struct capi_ctr *ctr, u16 appl) | |||
958 | = container_of(ctr, struct gigaset_capi_ctr, ctr); | 1068 | = container_of(ctr, struct gigaset_capi_ctr, ctr); |
959 | struct cardstate *cs = iif->ctr.driverdata; | 1069 | struct cardstate *cs = iif->ctr.driverdata; |
960 | struct gigaset_capi_appl *ap, *tmp; | 1070 | struct gigaset_capi_appl *ap, *tmp; |
1071 | unsigned ch; | ||
1072 | |||
1073 | gig_dbg(DEBUG_CMD, "%s [%u]", __func__, appl); | ||
961 | 1074 | ||
962 | list_for_each_entry_safe(ap, tmp, &iif->appls, ctrlist) | 1075 | list_for_each_entry_safe(ap, tmp, &iif->appls, ctrlist) |
963 | if (ap->id == appl) { | 1076 | if (ap->id == appl) { |
964 | if (ap->connected != APCONN_NONE) { | 1077 | /* remove from any channels */ |
965 | dev_err(cs->dev, | 1078 | for (ch = 0; ch < cs->channels; ch++) |
966 | "%s: application %u still connected\n", | 1079 | remove_appl_from_channel(&cs->bcs[ch], ap); |
967 | __func__, ap->id); | 1080 | |
968 | /* ToDo: clear active connection */ | 1081 | /* remove from registration list */ |
969 | } | ||
970 | list_del(&ap->ctrlist); | 1082 | list_del(&ap->ctrlist); |
971 | kfree(ap); | 1083 | kfree(ap); |
1084 | dev_info(cs->dev, "application %u released\n", appl); | ||
972 | } | 1085 | } |
973 | |||
974 | } | 1086 | } |
975 | 1087 | ||
976 | /* | 1088 | /* |
@@ -1040,7 +1152,7 @@ static void do_facility_req(struct gigaset_capi_ctr *iif, | |||
1040 | case CAPI_FACILITY_SUPPSVC: | 1152 | case CAPI_FACILITY_SUPPSVC: |
1041 | /* decode Function parameter */ | 1153 | /* decode Function parameter */ |
1042 | pparam = cmsg->FacilityRequestParameter; | 1154 | pparam = cmsg->FacilityRequestParameter; |
1043 | if (pparam == NULL || *pparam < 2) { | 1155 | if (pparam == NULL || pparam[0] < 2) { |
1044 | dev_notice(cs->dev, "%s: %s missing\n", "FACILITY_REQ", | 1156 | dev_notice(cs->dev, "%s: %s missing\n", "FACILITY_REQ", |
1045 | "Facility Request Parameter"); | 1157 | "Facility Request Parameter"); |
1046 | send_conf(iif, ap, skb, CapiIllMessageParmCoding); | 1158 | send_conf(iif, ap, skb, CapiIllMessageParmCoding); |
@@ -1057,8 +1169,32 @@ static void do_facility_req(struct gigaset_capi_ctr *iif, | |||
1057 | /* Supported Services: none */ | 1169 | /* Supported Services: none */ |
1058 | capimsg_setu32(confparam, 6, 0); | 1170 | capimsg_setu32(confparam, 6, 0); |
1059 | break; | 1171 | break; |
1172 | case CAPI_SUPPSVC_LISTEN: | ||
1173 | if (pparam[0] < 7 || pparam[3] < 4) { | ||
1174 | dev_notice(cs->dev, "%s: %s missing\n", | ||
1175 | "FACILITY_REQ", "Notification Mask"); | ||
1176 | send_conf(iif, ap, skb, | ||
1177 | CapiIllMessageParmCoding); | ||
1178 | return; | ||
1179 | } | ||
1180 | if (CAPIMSG_U32(pparam, 4) != 0) { | ||
1181 | dev_notice(cs->dev, | ||
1182 | "%s: unsupported supplementary service notification mask 0x%x\n", | ||
1183 | "FACILITY_REQ", CAPIMSG_U32(pparam, 4)); | ||
1184 | info = CapiFacilitySpecificFunctionNotSupported; | ||
1185 | confparam[3] = 2; /* length */ | ||
1186 | capimsg_setu16(confparam, 4, | ||
1187 | CapiSupplementaryServiceNotSupported); | ||
1188 | } | ||
1189 | info = CapiSuccess; | ||
1190 | confparam[3] = 2; /* length */ | ||
1191 | capimsg_setu16(confparam, 4, CapiSuccess); | ||
1192 | break; | ||
1060 | /* ToDo: add supported services */ | 1193 | /* ToDo: add supported services */ |
1061 | default: | 1194 | default: |
1195 | dev_notice(cs->dev, | ||
1196 | "%s: unsupported supplementary service function 0x%04x\n", | ||
1197 | "FACILITY_REQ", function); | ||
1062 | info = CapiFacilitySpecificFunctionNotSupported; | 1198 | info = CapiFacilitySpecificFunctionNotSupported; |
1063 | /* Supplementary Service specific parameter */ | 1199 | /* Supplementary Service specific parameter */ |
1064 | confparam[3] = 2; /* length */ | 1200 | confparam[3] = 2; /* length */ |
@@ -1149,7 +1285,8 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1149 | char **commands; | 1285 | char **commands; |
1150 | char *s; | 1286 | char *s; |
1151 | u8 *pp; | 1287 | u8 *pp; |
1152 | int i, l; | 1288 | unsigned long flags; |
1289 | int i, l, lbc, lhlc; | ||
1153 | u16 info; | 1290 | u16 info; |
1154 | 1291 | ||
1155 | /* decode message */ | 1292 | /* decode message */ |
@@ -1164,8 +1301,18 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1164 | send_conf(iif, ap, skb, CapiNoPlciAvailable); | 1301 | send_conf(iif, ap, skb, CapiNoPlciAvailable); |
1165 | return; | 1302 | return; |
1166 | } | 1303 | } |
1304 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1305 | if (bcs->ap != NULL || bcs->apconnstate != APCONN_NONE) | ||
1306 | dev_warn(cs->dev, "%s: channel not properly cleared (%p/%d)\n", | ||
1307 | __func__, bcs->ap, bcs->apconnstate); | ||
1167 | ap->bcnext = NULL; | 1308 | ap->bcnext = NULL; |
1168 | bcs->ap = ap; | 1309 | bcs->ap = ap; |
1310 | bcs->apconnstate = APCONN_SETUP; | ||
1311 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1312 | |||
1313 | bcs->rx_bufsize = ap->rp.datablklen; | ||
1314 | dev_kfree_skb(bcs->rx_skb); | ||
1315 | gigaset_new_rx_skb(bcs); | ||
1169 | cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; | 1316 | cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; |
1170 | 1317 | ||
1171 | /* build command table */ | 1318 | /* build command table */ |
@@ -1273,42 +1420,59 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1273 | goto error; | 1420 | goto error; |
1274 | } | 1421 | } |
1275 | 1422 | ||
1276 | /* check/encode parameter: BC */ | 1423 | /* |
1277 | if (cmsg->BC && cmsg->BC[0]) { | 1424 | * check/encode parameters: BC & HLC |
1278 | /* explicit BC overrides CIP */ | 1425 | * must be encoded together as device doesn't accept HLC separately |
1279 | l = 2*cmsg->BC[0] + 7; | 1426 | * explicit parameters override values derived from CIP |
1427 | */ | ||
1428 | |||
1429 | /* determine lengths */ | ||
1430 | if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */ | ||
1431 | lbc = 2*cmsg->BC[0]; | ||
1432 | else if (cip2bchlc[cmsg->CIPValue].bc) /* BC derived from CIP */ | ||
1433 | lbc = strlen(cip2bchlc[cmsg->CIPValue].bc); | ||
1434 | else /* no BC */ | ||
1435 | lbc = 0; | ||
1436 | if (cmsg->HLC && cmsg->HLC[0]) /* HLC specified explicitly */ | ||
1437 | lhlc = 2*cmsg->HLC[0]; | ||
1438 | else if (cip2bchlc[cmsg->CIPValue].hlc) /* HLC derived from CIP */ | ||
1439 | lhlc = strlen(cip2bchlc[cmsg->CIPValue].hlc); | ||
1440 | else /* no HLC */ | ||
1441 | lhlc = 0; | ||
1442 | |||
1443 | if (lbc) { | ||
1444 | /* have BC: allocate and assemble command string */ | ||
1445 | l = lbc + 7; /* "^SBC=" + value + "\r" + null byte */ | ||
1446 | if (lhlc) | ||
1447 | l += lhlc + 7; /* ";^SHLC=" + value */ | ||
1280 | commands[AT_BC] = kmalloc(l, GFP_KERNEL); | 1448 | commands[AT_BC] = kmalloc(l, GFP_KERNEL); |
1281 | if (!commands[AT_BC]) | 1449 | if (!commands[AT_BC]) |
1282 | goto oom; | 1450 | goto oom; |
1283 | strcpy(commands[AT_BC], "^SBC="); | 1451 | strcpy(commands[AT_BC], "^SBC="); |
1284 | decode_ie(cmsg->BC, commands[AT_BC]+5); | 1452 | if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */ |
1453 | decode_ie(cmsg->BC, commands[AT_BC] + 5); | ||
1454 | else /* BC derived from CIP */ | ||
1455 | strcpy(commands[AT_BC] + 5, | ||
1456 | cip2bchlc[cmsg->CIPValue].bc); | ||
1457 | if (lhlc) { | ||
1458 | strcpy(commands[AT_BC] + lbc + 5, ";^SHLC="); | ||
1459 | if (cmsg->HLC && cmsg->HLC[0]) | ||
1460 | /* HLC specified explicitly */ | ||
1461 | decode_ie(cmsg->HLC, | ||
1462 | commands[AT_BC] + lbc + 12); | ||
1463 | else /* HLC derived from CIP */ | ||
1464 | strcpy(commands[AT_BC] + lbc + 12, | ||
1465 | cip2bchlc[cmsg->CIPValue].hlc); | ||
1466 | } | ||
1285 | strcpy(commands[AT_BC] + l - 2, "\r"); | 1467 | strcpy(commands[AT_BC] + l - 2, "\r"); |
1286 | } else if (cip2bchlc[cmsg->CIPValue].bc) { | 1468 | } else { |
1287 | l = strlen(cip2bchlc[cmsg->CIPValue].bc) + 7; | 1469 | /* no BC */ |
1288 | commands[AT_BC] = kmalloc(l, GFP_KERNEL); | 1470 | if (lhlc) { |
1289 | if (!commands[AT_BC]) | 1471 | dev_notice(cs->dev, "%s: cannot set HLC without BC\n", |
1290 | goto oom; | 1472 | "CONNECT_REQ"); |
1291 | snprintf(commands[AT_BC], l, "^SBC=%s\r", | 1473 | info = CapiIllMessageParmCoding; /* ? */ |
1292 | cip2bchlc[cmsg->CIPValue].bc); | 1474 | goto error; |
1293 | } | 1475 | } |
1294 | |||
1295 | /* check/encode parameter: HLC */ | ||
1296 | if (cmsg->HLC && cmsg->HLC[0]) { | ||
1297 | /* explicit HLC overrides CIP */ | ||
1298 | l = 2*cmsg->HLC[0] + 7; | ||
1299 | commands[AT_HLC] = kmalloc(l, GFP_KERNEL); | ||
1300 | if (!commands[AT_HLC]) | ||
1301 | goto oom; | ||
1302 | strcpy(commands[AT_HLC], "^SHLC="); | ||
1303 | decode_ie(cmsg->HLC, commands[AT_HLC]+5); | ||
1304 | strcpy(commands[AT_HLC] + l - 2, "\r"); | ||
1305 | } else if (cip2bchlc[cmsg->CIPValue].hlc) { | ||
1306 | l = strlen(cip2bchlc[cmsg->CIPValue].hlc) + 7; | ||
1307 | commands[AT_HLC] = kmalloc(l, GFP_KERNEL); | ||
1308 | if (!commands[AT_HLC]) | ||
1309 | goto oom; | ||
1310 | snprintf(commands[AT_HLC], l, "^SHLC=%s\r", | ||
1311 | cip2bchlc[cmsg->CIPValue].hlc); | ||
1312 | } | 1476 | } |
1313 | 1477 | ||
1314 | /* check/encode parameter: B Protocol */ | 1478 | /* check/encode parameter: B Protocol */ |
@@ -1322,13 +1486,13 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1322 | bcs->proto2 = L2_HDLC; | 1486 | bcs->proto2 = L2_HDLC; |
1323 | break; | 1487 | break; |
1324 | case 1: | 1488 | case 1: |
1325 | bcs->proto2 = L2_BITSYNC; | 1489 | bcs->proto2 = L2_VOICE; |
1326 | break; | 1490 | break; |
1327 | default: | 1491 | default: |
1328 | dev_warn(cs->dev, | 1492 | dev_warn(cs->dev, |
1329 | "B1 Protocol %u unsupported, using Transparent\n", | 1493 | "B1 Protocol %u unsupported, using Transparent\n", |
1330 | cmsg->B1protocol); | 1494 | cmsg->B1protocol); |
1331 | bcs->proto2 = L2_BITSYNC; | 1495 | bcs->proto2 = L2_VOICE; |
1332 | } | 1496 | } |
1333 | if (cmsg->B2protocol != 1) | 1497 | if (cmsg->B2protocol != 1) |
1334 | dev_warn(cs->dev, | 1498 | dev_warn(cs->dev, |
@@ -1382,7 +1546,6 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1382 | goto error; | 1546 | goto error; |
1383 | } | 1547 | } |
1384 | gigaset_schedule_event(cs); | 1548 | gigaset_schedule_event(cs); |
1385 | ap->connected = APCONN_SETUP; | ||
1386 | send_conf(iif, ap, skb, CapiSuccess); | 1549 | send_conf(iif, ap, skb, CapiSuccess); |
1387 | return; | 1550 | return; |
1388 | 1551 | ||
@@ -1410,6 +1573,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1410 | _cmsg *cmsg = &iif->acmsg; | 1573 | _cmsg *cmsg = &iif->acmsg; |
1411 | struct bc_state *bcs; | 1574 | struct bc_state *bcs; |
1412 | struct gigaset_capi_appl *oap; | 1575 | struct gigaset_capi_appl *oap; |
1576 | unsigned long flags; | ||
1413 | int channel; | 1577 | int channel; |
1414 | 1578 | ||
1415 | /* decode message */ | 1579 | /* decode message */ |
@@ -1429,12 +1593,24 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1429 | switch (cmsg->Reject) { | 1593 | switch (cmsg->Reject) { |
1430 | case 0: /* Accept */ | 1594 | case 0: /* Accept */ |
1431 | /* drop all competing applications, keep only this one */ | 1595 | /* drop all competing applications, keep only this one */ |
1432 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) | 1596 | spin_lock_irqsave(&bcs->aplock, flags); |
1433 | if (oap != ap) | 1597 | while (bcs->ap != NULL) { |
1598 | oap = bcs->ap; | ||
1599 | bcs->ap = oap->bcnext; | ||
1600 | if (oap != ap) { | ||
1601 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1434 | send_disconnect_ind(bcs, oap, | 1602 | send_disconnect_ind(bcs, oap, |
1435 | CapiCallGivenToOtherApplication); | 1603 | CapiCallGivenToOtherApplication); |
1604 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1605 | } | ||
1606 | } | ||
1436 | ap->bcnext = NULL; | 1607 | ap->bcnext = NULL; |
1437 | bcs->ap = ap; | 1608 | bcs->ap = ap; |
1609 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1610 | |||
1611 | bcs->rx_bufsize = ap->rp.datablklen; | ||
1612 | dev_kfree_skb(bcs->rx_skb); | ||
1613 | gigaset_new_rx_skb(bcs); | ||
1438 | bcs->chstate |= CHS_NOTIFY_LL; | 1614 | bcs->chstate |= CHS_NOTIFY_LL; |
1439 | 1615 | ||
1440 | /* check/encode B channel protocol */ | 1616 | /* check/encode B channel protocol */ |
@@ -1448,13 +1624,13 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1448 | bcs->proto2 = L2_HDLC; | 1624 | bcs->proto2 = L2_HDLC; |
1449 | break; | 1625 | break; |
1450 | case 1: | 1626 | case 1: |
1451 | bcs->proto2 = L2_BITSYNC; | 1627 | bcs->proto2 = L2_VOICE; |
1452 | break; | 1628 | break; |
1453 | default: | 1629 | default: |
1454 | dev_warn(cs->dev, | 1630 | dev_warn(cs->dev, |
1455 | "B1 Protocol %u unsupported, using Transparent\n", | 1631 | "B1 Protocol %u unsupported, using Transparent\n", |
1456 | cmsg->B1protocol); | 1632 | cmsg->B1protocol); |
1457 | bcs->proto2 = L2_BITSYNC; | 1633 | bcs->proto2 = L2_VOICE; |
1458 | } | 1634 | } |
1459 | if (cmsg->B2protocol != 1) | 1635 | if (cmsg->B2protocol != 1) |
1460 | dev_warn(cs->dev, | 1636 | dev_warn(cs->dev, |
@@ -1502,31 +1678,45 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1502 | send_disconnect_ind(bcs, ap, 0); | 1678 | send_disconnect_ind(bcs, ap, 0); |
1503 | 1679 | ||
1504 | /* remove it from the list of listening apps */ | 1680 | /* remove it from the list of listening apps */ |
1681 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1505 | if (bcs->ap == ap) { | 1682 | if (bcs->ap == ap) { |
1506 | bcs->ap = ap->bcnext; | 1683 | bcs->ap = ap->bcnext; |
1507 | if (bcs->ap == NULL) | 1684 | if (bcs->ap == NULL) { |
1508 | /* last one: stop ev-layer hupD notifications */ | 1685 | /* last one: stop ev-layer hupD notifications */ |
1686 | bcs->apconnstate = APCONN_NONE; | ||
1509 | bcs->chstate &= ~CHS_NOTIFY_LL; | 1687 | bcs->chstate &= ~CHS_NOTIFY_LL; |
1688 | } | ||
1689 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1510 | return; | 1690 | return; |
1511 | } | 1691 | } |
1512 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) { | 1692 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) { |
1513 | if (oap->bcnext == ap) { | 1693 | if (oap->bcnext == ap) { |
1514 | oap->bcnext = oap->bcnext->bcnext; | 1694 | oap->bcnext = oap->bcnext->bcnext; |
1695 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1515 | return; | 1696 | return; |
1516 | } | 1697 | } |
1517 | } | 1698 | } |
1699 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1518 | dev_err(cs->dev, "%s: application %u not found\n", | 1700 | dev_err(cs->dev, "%s: application %u not found\n", |
1519 | __func__, ap->id); | 1701 | __func__, ap->id); |
1520 | return; | 1702 | return; |
1521 | 1703 | ||
1522 | default: /* Reject */ | 1704 | default: /* Reject */ |
1523 | /* drop all competing applications, keep only this one */ | 1705 | /* drop all competing applications, keep only this one */ |
1524 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) | 1706 | spin_lock_irqsave(&bcs->aplock, flags); |
1525 | if (oap != ap) | 1707 | while (bcs->ap != NULL) { |
1708 | oap = bcs->ap; | ||
1709 | bcs->ap = oap->bcnext; | ||
1710 | if (oap != ap) { | ||
1711 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1526 | send_disconnect_ind(bcs, oap, | 1712 | send_disconnect_ind(bcs, oap, |
1527 | CapiCallGivenToOtherApplication); | 1713 | CapiCallGivenToOtherApplication); |
1714 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1715 | } | ||
1716 | } | ||
1528 | ap->bcnext = NULL; | 1717 | ap->bcnext = NULL; |
1529 | bcs->ap = ap; | 1718 | bcs->ap = ap; |
1719 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1530 | 1720 | ||
1531 | /* reject call - will trigger DISCONNECT_IND for this app */ | 1721 | /* reject call - will trigger DISCONNECT_IND for this app */ |
1532 | dev_info(cs->dev, "%s: Reject=%x\n", | 1722 | dev_info(cs->dev, "%s: Reject=%x\n", |
@@ -1549,6 +1739,7 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif, | |||
1549 | { | 1739 | { |
1550 | struct cardstate *cs = iif->ctr.driverdata; | 1740 | struct cardstate *cs = iif->ctr.driverdata; |
1551 | _cmsg *cmsg = &iif->acmsg; | 1741 | _cmsg *cmsg = &iif->acmsg; |
1742 | struct bc_state *bcs; | ||
1552 | int channel; | 1743 | int channel; |
1553 | 1744 | ||
1554 | /* decode message */ | 1745 | /* decode message */ |
@@ -1563,9 +1754,10 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif, | |||
1563 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1754 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
1564 | return; | 1755 | return; |
1565 | } | 1756 | } |
1757 | bcs = &cs->bcs[channel-1]; | ||
1566 | 1758 | ||
1567 | /* mark logical connection active */ | 1759 | /* mark logical connection active */ |
1568 | ap->connected = APCONN_ACTIVE; | 1760 | bcs->apconnstate = APCONN_ACTIVE; |
1569 | 1761 | ||
1570 | /* build NCCI: always 1 (one B3 connection only) */ | 1762 | /* build NCCI: always 1 (one B3 connection only) */ |
1571 | cmsg->adr.adrNCCI |= 1 << 16; | 1763 | cmsg->adr.adrNCCI |= 1 << 16; |
@@ -1611,7 +1803,7 @@ static void do_connect_b3_resp(struct gigaset_capi_ctr *iif, | |||
1611 | 1803 | ||
1612 | if (cmsg->Reject) { | 1804 | if (cmsg->Reject) { |
1613 | /* Reject: clear B3 connect received flag */ | 1805 | /* Reject: clear B3 connect received flag */ |
1614 | ap->connected = APCONN_SETUP; | 1806 | bcs->apconnstate = APCONN_SETUP; |
1615 | 1807 | ||
1616 | /* trigger hangup, causing eventual DISCONNECT_IND */ | 1808 | /* trigger hangup, causing eventual DISCONNECT_IND */ |
1617 | if (!gigaset_add_event(cs, &bcs->at_state, | 1809 | if (!gigaset_add_event(cs, &bcs->at_state, |
@@ -1683,11 +1875,11 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif, | |||
1683 | } | 1875 | } |
1684 | 1876 | ||
1685 | /* skip if DISCONNECT_IND already sent */ | 1877 | /* skip if DISCONNECT_IND already sent */ |
1686 | if (!ap->connected) | 1878 | if (!bcs->apconnstate) |
1687 | return; | 1879 | return; |
1688 | 1880 | ||
1689 | /* check for active logical connection */ | 1881 | /* check for active logical connection */ |
1690 | if (ap->connected >= APCONN_ACTIVE) { | 1882 | if (bcs->apconnstate >= APCONN_ACTIVE) { |
1691 | /* | 1883 | /* |
1692 | * emit DISCONNECT_B3_IND with cause 0x3301 | 1884 | * emit DISCONNECT_B3_IND with cause 0x3301 |
1693 | * use separate cmsg structure, as the content of iif->acmsg | 1885 | * use separate cmsg structure, as the content of iif->acmsg |
@@ -1736,6 +1928,7 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif, | |||
1736 | { | 1928 | { |
1737 | struct cardstate *cs = iif->ctr.driverdata; | 1929 | struct cardstate *cs = iif->ctr.driverdata; |
1738 | _cmsg *cmsg = &iif->acmsg; | 1930 | _cmsg *cmsg = &iif->acmsg; |
1931 | struct bc_state *bcs; | ||
1739 | int channel; | 1932 | int channel; |
1740 | 1933 | ||
1741 | /* decode message */ | 1934 | /* decode message */ |
@@ -1751,17 +1944,17 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif, | |||
1751 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1944 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
1752 | return; | 1945 | return; |
1753 | } | 1946 | } |
1947 | bcs = &cs->bcs[channel-1]; | ||
1754 | 1948 | ||
1755 | /* reject if logical connection not active */ | 1949 | /* reject if logical connection not active */ |
1756 | if (ap->connected < APCONN_ACTIVE) { | 1950 | if (bcs->apconnstate < APCONN_ACTIVE) { |
1757 | send_conf(iif, ap, skb, | 1951 | send_conf(iif, ap, skb, |
1758 | CapiMessageNotSupportedInCurrentState); | 1952 | CapiMessageNotSupportedInCurrentState); |
1759 | return; | 1953 | return; |
1760 | } | 1954 | } |
1761 | 1955 | ||
1762 | /* trigger hangup, causing eventual DISCONNECT_B3_IND */ | 1956 | /* trigger hangup, causing eventual DISCONNECT_B3_IND */ |
1763 | if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state, | 1957 | if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) { |
1764 | EV_HUP, NULL, 0, NULL)) { | ||
1765 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); | 1958 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); |
1766 | return; | 1959 | return; |
1767 | } | 1960 | } |
@@ -1782,18 +1975,17 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1782 | struct sk_buff *skb) | 1975 | struct sk_buff *skb) |
1783 | { | 1976 | { |
1784 | struct cardstate *cs = iif->ctr.driverdata; | 1977 | struct cardstate *cs = iif->ctr.driverdata; |
1978 | struct bc_state *bcs; | ||
1785 | int channel = CAPIMSG_PLCI_PART(skb->data); | 1979 | int channel = CAPIMSG_PLCI_PART(skb->data); |
1786 | u16 ncci = CAPIMSG_NCCI_PART(skb->data); | 1980 | u16 ncci = CAPIMSG_NCCI_PART(skb->data); |
1787 | u16 msglen = CAPIMSG_LEN(skb->data); | 1981 | u16 msglen = CAPIMSG_LEN(skb->data); |
1788 | u16 datalen = CAPIMSG_DATALEN(skb->data); | 1982 | u16 datalen = CAPIMSG_DATALEN(skb->data); |
1789 | u16 flags = CAPIMSG_FLAGS(skb->data); | 1983 | u16 flags = CAPIMSG_FLAGS(skb->data); |
1984 | u16 msgid = CAPIMSG_MSGID(skb->data); | ||
1985 | u16 handle = CAPIMSG_HANDLE_REQ(skb->data); | ||
1790 | 1986 | ||
1791 | /* frequent message, avoid _cmsg overhead */ | 1987 | /* frequent message, avoid _cmsg overhead */ |
1792 | dump_rawmsg(DEBUG_LLDATA, "DATA_B3_REQ", skb->data); | 1988 | dump_rawmsg(DEBUG_MCMD, __func__, skb->data); |
1793 | |||
1794 | gig_dbg(DEBUG_LLDATA, | ||
1795 | "Receiving data from LL (ch: %d, flg: %x, sz: %d|%d)", | ||
1796 | channel, flags, msglen, datalen); | ||
1797 | 1989 | ||
1798 | /* check parameters */ | 1990 | /* check parameters */ |
1799 | if (channel == 0 || channel > cs->channels || ncci != 1) { | 1991 | if (channel == 0 || channel > cs->channels || ncci != 1) { |
@@ -1802,6 +1994,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1802 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1994 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
1803 | return; | 1995 | return; |
1804 | } | 1996 | } |
1997 | bcs = &cs->bcs[channel-1]; | ||
1805 | if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64) | 1998 | if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64) |
1806 | dev_notice(cs->dev, "%s: unexpected length %d\n", | 1999 | dev_notice(cs->dev, "%s: unexpected length %d\n", |
1807 | "DATA_B3_REQ", msglen); | 2000 | "DATA_B3_REQ", msglen); |
@@ -1821,7 +2014,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1821 | } | 2014 | } |
1822 | 2015 | ||
1823 | /* reject if logical connection not active */ | 2016 | /* reject if logical connection not active */ |
1824 | if (ap->connected < APCONN_ACTIVE) { | 2017 | if (bcs->apconnstate < APCONN_ACTIVE) { |
1825 | send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState); | 2018 | send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState); |
1826 | return; | 2019 | return; |
1827 | } | 2020 | } |
@@ -1832,17 +2025,19 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1832 | skb_pull(skb, msglen); | 2025 | skb_pull(skb, msglen); |
1833 | 2026 | ||
1834 | /* pass to device-specific module */ | 2027 | /* pass to device-specific module */ |
1835 | if (cs->ops->send_skb(&cs->bcs[channel-1], skb) < 0) { | 2028 | if (cs->ops->send_skb(bcs, skb) < 0) { |
1836 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); | 2029 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); |
1837 | return; | 2030 | return; |
1838 | } | 2031 | } |
1839 | 2032 | ||
1840 | /* DATA_B3_CONF reply will be sent by gigaset_skb_sent() */ | ||
1841 | |||
1842 | /* | 2033 | /* |
1843 | * ToDo: honor unset "delivery confirmation" bit | 2034 | * DATA_B3_CONF will be sent by gigaset_skb_sent() only if "delivery |
1844 | * (send DATA_B3_CONF immediately?) | 2035 | * confirmation" bit is set; otherwise we have to send it now |
1845 | */ | 2036 | */ |
2037 | if (!(flags & CAPI_FLAGS_DELIVERY_CONFIRMATION)) | ||
2038 | send_data_b3_conf(cs, &iif->ctr, ap->id, msgid, channel, handle, | ||
2039 | flags ? CapiFlagsNotSupportedByProtocol | ||
2040 | : CAPI_NOERROR); | ||
1846 | } | 2041 | } |
1847 | 2042 | ||
1848 | /* | 2043 | /* |
@@ -1899,7 +2094,7 @@ static void do_data_b3_resp(struct gigaset_capi_ctr *iif, | |||
1899 | struct gigaset_capi_appl *ap, | 2094 | struct gigaset_capi_appl *ap, |
1900 | struct sk_buff *skb) | 2095 | struct sk_buff *skb) |
1901 | { | 2096 | { |
1902 | dump_rawmsg(DEBUG_LLDATA, __func__, skb->data); | 2097 | dump_rawmsg(DEBUG_MCMD, __func__, skb->data); |
1903 | dev_kfree_skb_any(skb); | 2098 | dev_kfree_skb_any(skb); |
1904 | } | 2099 | } |
1905 | 2100 | ||
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index f6f45f221920..3ca561eccd9f 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
@@ -399,8 +399,8 @@ static void gigaset_freebcs(struct bc_state *bcs) | |||
399 | gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel); | 399 | gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel); |
400 | clear_at_state(&bcs->at_state); | 400 | clear_at_state(&bcs->at_state); |
401 | gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel); | 401 | gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel); |
402 | dev_kfree_skb(bcs->skb); | 402 | dev_kfree_skb(bcs->rx_skb); |
403 | bcs->skb = NULL; | 403 | bcs->rx_skb = NULL; |
404 | 404 | ||
405 | for (i = 0; i < AT_NUM; ++i) { | 405 | for (i = 0; i < AT_NUM; ++i) { |
406 | kfree(bcs->commands[i]); | 406 | kfree(bcs->commands[i]); |
@@ -634,19 +634,10 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs, | |||
634 | bcs->emptycount = 0; | 634 | bcs->emptycount = 0; |
635 | #endif | 635 | #endif |
636 | 636 | ||
637 | gig_dbg(DEBUG_INIT, "allocating bcs[%d]->skb", channel); | 637 | bcs->rx_bufsize = 0; |
638 | bcs->fcs = PPP_INITFCS; | 638 | bcs->rx_skb = NULL; |
639 | bcs->rx_fcs = PPP_INITFCS; | ||
639 | bcs->inputstate = 0; | 640 | bcs->inputstate = 0; |
640 | if (cs->ignoreframes) { | ||
641 | bcs->skb = NULL; | ||
642 | } else { | ||
643 | bcs->skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | ||
644 | if (bcs->skb != NULL) | ||
645 | skb_reserve(bcs->skb, cs->hw_hdr_len); | ||
646 | else | ||
647 | pr_err("out of memory\n"); | ||
648 | } | ||
649 | |||
650 | bcs->channel = channel; | 641 | bcs->channel = channel; |
651 | bcs->cs = cs; | 642 | bcs->cs = cs; |
652 | 643 | ||
@@ -658,16 +649,15 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs, | |||
658 | for (i = 0; i < AT_NUM; ++i) | 649 | for (i = 0; i < AT_NUM; ++i) |
659 | bcs->commands[i] = NULL; | 650 | bcs->commands[i] = NULL; |
660 | 651 | ||
652 | spin_lock_init(&bcs->aplock); | ||
653 | bcs->ap = NULL; | ||
654 | bcs->apconnstate = 0; | ||
655 | |||
661 | gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel); | 656 | gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel); |
662 | if (cs->ops->initbcshw(bcs)) | 657 | if (cs->ops->initbcshw(bcs)) |
663 | return bcs; | 658 | return bcs; |
664 | 659 | ||
665 | gig_dbg(DEBUG_INIT, " failed"); | 660 | gig_dbg(DEBUG_INIT, " failed"); |
666 | |||
667 | gig_dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel); | ||
668 | dev_kfree_skb(bcs->skb); | ||
669 | bcs->skb = NULL; | ||
670 | |||
671 | return NULL; | 661 | return NULL; |
672 | } | 662 | } |
673 | 663 | ||
@@ -801,8 +791,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
801 | spin_unlock_irqrestore(&cs->lock, flags); | 791 | spin_unlock_irqrestore(&cs->lock, flags); |
802 | setup_timer(&cs->timer, timer_tick, (unsigned long) cs); | 792 | setup_timer(&cs->timer, timer_tick, (unsigned long) cs); |
803 | cs->timer.expires = jiffies + msecs_to_jiffies(GIG_TICK); | 793 | cs->timer.expires = jiffies + msecs_to_jiffies(GIG_TICK); |
804 | /* FIXME: can jiffies increase too much until the timer is added? | ||
805 | * Same problem(?) with mod_timer() in timer_tick(). */ | ||
806 | add_timer(&cs->timer); | 794 | add_timer(&cs->timer); |
807 | 795 | ||
808 | gig_dbg(DEBUG_INIT, "cs initialized"); | 796 | gig_dbg(DEBUG_INIT, "cs initialized"); |
@@ -839,14 +827,12 @@ void gigaset_bcs_reinit(struct bc_state *bcs) | |||
839 | bcs->emptycount = 0; | 827 | bcs->emptycount = 0; |
840 | #endif | 828 | #endif |
841 | 829 | ||
842 | bcs->fcs = PPP_INITFCS; | 830 | bcs->rx_fcs = PPP_INITFCS; |
843 | bcs->chstate = 0; | 831 | bcs->chstate = 0; |
844 | 832 | ||
845 | bcs->ignore = cs->ignoreframes; | 833 | bcs->ignore = cs->ignoreframes; |
846 | if (bcs->ignore) { | 834 | dev_kfree_skb(bcs->rx_skb); |
847 | dev_kfree_skb(bcs->skb); | 835 | bcs->rx_skb = NULL; |
848 | bcs->skb = NULL; | ||
849 | } | ||
850 | 836 | ||
851 | cs->ops->reinitbcshw(bcs); | 837 | cs->ops->reinitbcshw(bcs); |
852 | } | 838 | } |
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index 206c380c5235..a14187605f5e 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c | |||
@@ -35,53 +35,40 @@ | |||
35 | #define RT_RING 2 | 35 | #define RT_RING 2 |
36 | #define RT_NUMBER 3 | 36 | #define RT_NUMBER 3 |
37 | #define RT_STRING 4 | 37 | #define RT_STRING 4 |
38 | #define RT_HEX 5 | ||
39 | #define RT_ZCAU 6 | 38 | #define RT_ZCAU 6 |
40 | 39 | ||
41 | /* Possible ASCII responses */ | 40 | /* Possible ASCII responses */ |
42 | #define RSP_OK 0 | 41 | #define RSP_OK 0 |
43 | #define RSP_BUSY 1 | 42 | #define RSP_ERROR 1 |
44 | #define RSP_CONNECT 2 | ||
45 | #define RSP_ZGCI 3 | 43 | #define RSP_ZGCI 3 |
46 | #define RSP_RING 4 | 44 | #define RSP_RING 4 |
47 | #define RSP_ZAOC 5 | 45 | #define RSP_ZVLS 5 |
48 | #define RSP_ZCSTR 6 | 46 | #define RSP_ZCAU 6 |
49 | #define RSP_ZCFGT 7 | 47 | |
50 | #define RSP_ZCFG 8 | 48 | /* responses with values to store in at_state */ |
51 | #define RSP_ZCCR 9 | 49 | /* - numeric */ |
52 | #define RSP_EMPTY 10 | ||
53 | #define RSP_ZLOG 11 | ||
54 | #define RSP_ZCAU 12 | ||
55 | #define RSP_ZMWI 13 | ||
56 | #define RSP_ZABINFO 14 | ||
57 | #define RSP_ZSMLSTCHG 15 | ||
58 | #define RSP_VAR 100 | 50 | #define RSP_VAR 100 |
59 | #define RSP_ZSAU (RSP_VAR + VAR_ZSAU) | 51 | #define RSP_ZSAU (RSP_VAR + VAR_ZSAU) |
60 | #define RSP_ZDLE (RSP_VAR + VAR_ZDLE) | 52 | #define RSP_ZDLE (RSP_VAR + VAR_ZDLE) |
61 | #define RSP_ZVLS (RSP_VAR + VAR_ZVLS) | ||
62 | #define RSP_ZCTP (RSP_VAR + VAR_ZCTP) | 53 | #define RSP_ZCTP (RSP_VAR + VAR_ZCTP) |
54 | /* - string */ | ||
63 | #define RSP_STR (RSP_VAR + VAR_NUM) | 55 | #define RSP_STR (RSP_VAR + VAR_NUM) |
64 | #define RSP_NMBR (RSP_STR + STR_NMBR) | 56 | #define RSP_NMBR (RSP_STR + STR_NMBR) |
65 | #define RSP_ZCPN (RSP_STR + STR_ZCPN) | 57 | #define RSP_ZCPN (RSP_STR + STR_ZCPN) |
66 | #define RSP_ZCON (RSP_STR + STR_ZCON) | 58 | #define RSP_ZCON (RSP_STR + STR_ZCON) |
67 | #define RSP_ZBC (RSP_STR + STR_ZBC) | 59 | #define RSP_ZBC (RSP_STR + STR_ZBC) |
68 | #define RSP_ZHLC (RSP_STR + STR_ZHLC) | 60 | #define RSP_ZHLC (RSP_STR + STR_ZHLC) |
69 | #define RSP_ERROR -1 /* ERROR */ | 61 | |
70 | #define RSP_WRONG_CID -2 /* unknown cid in cmd */ | 62 | #define RSP_WRONG_CID -2 /* unknown cid in cmd */ |
71 | #define RSP_UNKNOWN -4 /* unknown response */ | ||
72 | #define RSP_FAIL -5 /* internal error */ | ||
73 | #define RSP_INVAL -6 /* invalid response */ | 63 | #define RSP_INVAL -6 /* invalid response */ |
64 | #define RSP_NODEV -9 /* device not connected */ | ||
74 | 65 | ||
75 | #define RSP_NONE -19 | 66 | #define RSP_NONE -19 |
76 | #define RSP_STRING -20 | 67 | #define RSP_STRING -20 |
77 | #define RSP_NULL -21 | 68 | #define RSP_NULL -21 |
78 | #define RSP_RETRYFAIL -22 | ||
79 | #define RSP_RETRY -23 | ||
80 | #define RSP_SKIP -24 | ||
81 | #define RSP_INIT -27 | 69 | #define RSP_INIT -27 |
82 | #define RSP_ANY -26 | 70 | #define RSP_ANY -26 |
83 | #define RSP_LAST -28 | 71 | #define RSP_LAST -28 |
84 | #define RSP_NODEV -9 | ||
85 | 72 | ||
86 | /* actions for process_response */ | 73 | /* actions for process_response */ |
87 | #define ACT_NOTHING 0 | 74 | #define ACT_NOTHING 0 |
@@ -259,13 +246,6 @@ struct reply_t gigaset_tab_nocid[] = | |||
259 | 246 | ||
260 | /* misc. */ | 247 | /* misc. */ |
261 | {RSP_ERROR, -1, -1, -1, -1, -1, {ACT_ERROR} }, | 248 | {RSP_ERROR, -1, -1, -1, -1, -1, {ACT_ERROR} }, |
262 | {RSP_ZCFGT, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | ||
263 | {RSP_ZCFG, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | ||
264 | {RSP_ZLOG, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | ||
265 | {RSP_ZMWI, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | ||
266 | {RSP_ZABINFO, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | ||
267 | {RSP_ZSMLSTCHG, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | ||
268 | |||
269 | {RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} }, | 249 | {RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} }, |
270 | {RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | 250 | {RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} }, |
271 | {RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} }, | 251 | {RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} }, |
@@ -282,9 +262,7 @@ struct reply_t gigaset_tab_cid[] = | |||
282 | /* dial */ | 262 | /* dial */ |
283 | {EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} }, | 263 | {EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} }, |
284 | {RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} }, | 264 | {RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} }, |
285 | {RSP_OK, 601, 601, -1, 602, 5, {ACT_CMD+AT_HLC} }, | 265 | {RSP_OK, 601, 601, -1, 603, 5, {ACT_CMD+AT_PROTO} }, |
286 | {RSP_NULL, 602, 602, -1, 603, 5, {ACT_CMD+AT_PROTO} }, | ||
287 | {RSP_OK, 602, 602, -1, 603, 5, {ACT_CMD+AT_PROTO} }, | ||
288 | {RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} }, | 266 | {RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} }, |
289 | {RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} }, | 267 | {RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} }, |
290 | {RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, | 268 | {RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, |
@@ -363,10 +341,6 @@ struct reply_t gigaset_tab_cid[] = | |||
363 | 341 | ||
364 | /* misc. */ | 342 | /* misc. */ |
365 | {RSP_ZCON, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | 343 | {RSP_ZCON, -1, -1, -1, -1, -1, {ACT_DEBUG} }, |
366 | {RSP_ZCCR, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | ||
367 | {RSP_ZAOC, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | ||
368 | {RSP_ZCSTR, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | ||
369 | |||
370 | {RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} }, | 344 | {RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} }, |
371 | {RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} }, | 345 | {RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} }, |
372 | {RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} }, | 346 | {RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} }, |
@@ -389,20 +363,11 @@ static const struct resp_type_t { | |||
389 | {"ZVLS", RSP_ZVLS, RT_NUMBER}, | 363 | {"ZVLS", RSP_ZVLS, RT_NUMBER}, |
390 | {"ZCTP", RSP_ZCTP, RT_NUMBER}, | 364 | {"ZCTP", RSP_ZCTP, RT_NUMBER}, |
391 | {"ZDLE", RSP_ZDLE, RT_NUMBER}, | 365 | {"ZDLE", RSP_ZDLE, RT_NUMBER}, |
392 | {"ZCFGT", RSP_ZCFGT, RT_NUMBER}, | ||
393 | {"ZCCR", RSP_ZCCR, RT_NUMBER}, | ||
394 | {"ZMWI", RSP_ZMWI, RT_NUMBER}, | ||
395 | {"ZHLC", RSP_ZHLC, RT_STRING}, | 366 | {"ZHLC", RSP_ZHLC, RT_STRING}, |
396 | {"ZBC", RSP_ZBC, RT_STRING}, | 367 | {"ZBC", RSP_ZBC, RT_STRING}, |
397 | {"NMBR", RSP_NMBR, RT_STRING}, | 368 | {"NMBR", RSP_NMBR, RT_STRING}, |
398 | {"ZCPN", RSP_ZCPN, RT_STRING}, | 369 | {"ZCPN", RSP_ZCPN, RT_STRING}, |
399 | {"ZCON", RSP_ZCON, RT_STRING}, | 370 | {"ZCON", RSP_ZCON, RT_STRING}, |
400 | {"ZAOC", RSP_ZAOC, RT_STRING}, | ||
401 | {"ZCSTR", RSP_ZCSTR, RT_STRING}, | ||
402 | {"ZCFG", RSP_ZCFG, RT_HEX}, | ||
403 | {"ZLOG", RSP_ZLOG, RT_NOTHING}, | ||
404 | {"ZABINFO", RSP_ZABINFO, RT_NOTHING}, | ||
405 | {"ZSMLSTCHG", RSP_ZSMLSTCHG, RT_NOTHING}, | ||
406 | {NULL, 0, 0} | 371 | {NULL, 0, 0} |
407 | }; | 372 | }; |
408 | 373 | ||
@@ -420,64 +385,18 @@ static const struct zsau_resp_t { | |||
420 | {NULL, ZSAU_UNKNOWN} | 385 | {NULL, ZSAU_UNKNOWN} |
421 | }; | 386 | }; |
422 | 387 | ||
423 | /* | ||
424 | * Get integer from char-pointer | ||
425 | */ | ||
426 | static int isdn_getnum(char *p) | ||
427 | { | ||
428 | int v = -1; | ||
429 | |||
430 | gig_dbg(DEBUG_EVENT, "string: %s", p); | ||
431 | |||
432 | while (*p >= '0' && *p <= '9') | ||
433 | v = ((v < 0) ? 0 : (v * 10)) + (int) ((*p++) - '0'); | ||
434 | if (*p) | ||
435 | v = -1; /* invalid Character */ | ||
436 | return v; | ||
437 | } | ||
438 | |||
439 | /* | ||
440 | * Get integer from char-pointer | ||
441 | */ | ||
442 | static int isdn_gethex(char *p) | ||
443 | { | ||
444 | int v = 0; | ||
445 | int c; | ||
446 | |||
447 | gig_dbg(DEBUG_EVENT, "string: %s", p); | ||
448 | |||
449 | if (!*p) | ||
450 | return -1; | ||
451 | |||
452 | do { | ||
453 | if (v > (INT_MAX - 15) / 16) | ||
454 | return -1; | ||
455 | c = *p; | ||
456 | if (c >= '0' && c <= '9') | ||
457 | c -= '0'; | ||
458 | else if (c >= 'a' && c <= 'f') | ||
459 | c -= 'a' - 10; | ||
460 | else if (c >= 'A' && c <= 'F') | ||
461 | c -= 'A' - 10; | ||
462 | else | ||
463 | return -1; | ||
464 | v = v * 16 + c; | ||
465 | } while (*++p); | ||
466 | |||
467 | return v; | ||
468 | } | ||
469 | |||
470 | /* retrieve CID from parsed response | 388 | /* retrieve CID from parsed response |
471 | * returns 0 if no CID, -1 if invalid CID, or CID value 1..65535 | 389 | * returns 0 if no CID, -1 if invalid CID, or CID value 1..65535 |
472 | */ | 390 | */ |
473 | static int cid_of_response(char *s) | 391 | static int cid_of_response(char *s) |
474 | { | 392 | { |
475 | int cid; | 393 | unsigned long cid; |
394 | int rc; | ||
476 | 395 | ||
477 | if (s[-1] != ';') | 396 | if (s[-1] != ';') |
478 | return 0; /* no CID separator */ | 397 | return 0; /* no CID separator */ |
479 | cid = isdn_getnum(s); | 398 | rc = strict_strtoul(s, 10, &cid); |
480 | if (cid < 0) | 399 | if (rc) |
481 | return 0; /* CID not numeric */ | 400 | return 0; /* CID not numeric */ |
482 | if (cid < 1 || cid > 65535) | 401 | if (cid < 1 || cid > 65535) |
483 | return -1; /* CID out of range */ | 402 | return -1; /* CID out of range */ |
@@ -590,10 +509,10 @@ void gigaset_handle_modem_response(struct cardstate *cs) | |||
590 | break; | 509 | break; |
591 | 510 | ||
592 | if (!rt->response) { | 511 | if (!rt->response) { |
593 | event->type = RSP_UNKNOWN; | 512 | event->type = RSP_NONE; |
594 | dev_warn(cs->dev, | 513 | gig_dbg(DEBUG_EVENT, |
595 | "unknown modem response: %s\n", | 514 | "unknown modem response: '%s'\n", |
596 | argv[curarg]); | 515 | argv[curarg]); |
597 | break; | 516 | break; |
598 | } | 517 | } |
599 | 518 | ||
@@ -647,27 +566,27 @@ void gigaset_handle_modem_response(struct cardstate *cs) | |||
647 | case RT_ZCAU: | 566 | case RT_ZCAU: |
648 | event->parameter = -1; | 567 | event->parameter = -1; |
649 | if (curarg + 1 < params) { | 568 | if (curarg + 1 < params) { |
650 | i = isdn_gethex(argv[curarg]); | 569 | unsigned long type, value; |
651 | j = isdn_gethex(argv[curarg + 1]); | 570 | |
652 | if (i >= 0 && i < 256 && j >= 0 && j < 256) | 571 | i = strict_strtoul(argv[curarg++], 16, &type); |
653 | event->parameter = (unsigned) i << 8 | 572 | j = strict_strtoul(argv[curarg++], 16, &value); |
654 | | j; | 573 | |
655 | curarg += 2; | 574 | if (i == 0 && type < 256 && |
575 | j == 0 && value < 256) | ||
576 | event->parameter = (type << 8) | value; | ||
656 | } else | 577 | } else |
657 | curarg = params - 1; | 578 | curarg = params - 1; |
658 | break; | 579 | break; |
659 | case RT_NUMBER: | 580 | case RT_NUMBER: |
660 | case RT_HEX: | 581 | event->parameter = -1; |
661 | if (curarg < params) { | 582 | if (curarg < params) { |
662 | if (param_type == RT_HEX) | 583 | unsigned long res; |
663 | event->parameter = | 584 | int rc; |
664 | isdn_gethex(argv[curarg]); | 585 | |
665 | else | 586 | rc = strict_strtoul(argv[curarg++], 10, &res); |
666 | event->parameter = | 587 | if (rc == 0) |
667 | isdn_getnum(argv[curarg]); | 588 | event->parameter = res; |
668 | ++curarg; | 589 | } |
669 | } else | ||
670 | event->parameter = -1; | ||
671 | gig_dbg(DEBUG_EVENT, "parameter==%d", event->parameter); | 590 | gig_dbg(DEBUG_EVENT, "parameter==%d", event->parameter); |
672 | break; | 591 | break; |
673 | } | 592 | } |
@@ -799,48 +718,27 @@ static void schedule_init(struct cardstate *cs, int state) | |||
799 | static void send_command(struct cardstate *cs, const char *cmd, int cid, | 718 | static void send_command(struct cardstate *cs, const char *cmd, int cid, |
800 | int dle, gfp_t kmallocflags) | 719 | int dle, gfp_t kmallocflags) |
801 | { | 720 | { |
802 | size_t cmdlen, buflen; | 721 | struct cmdbuf_t *cb; |
803 | char *cmdpos, *cmdbuf, *cmdtail; | 722 | size_t buflen; |
804 | 723 | ||
805 | cmdlen = strlen(cmd); | 724 | buflen = strlen(cmd) + 12; /* DLE ( A T 1 2 3 4 5 <cmd> DLE ) \0 */ |
806 | buflen = 11 + cmdlen; | 725 | cb = kmalloc(sizeof(struct cmdbuf_t) + buflen, kmallocflags); |
807 | if (unlikely(buflen <= cmdlen)) { | 726 | if (!cb) { |
808 | dev_err(cs->dev, "integer overflow in buflen\n"); | 727 | dev_err(cs->dev, "%s: out of memory\n", __func__); |
809 | return; | 728 | return; |
810 | } | 729 | } |
811 | 730 | if (cid > 0 && cid <= 65535) | |
812 | cmdbuf = kmalloc(buflen, kmallocflags); | 731 | cb->len = snprintf(cb->buf, buflen, |
813 | if (unlikely(!cmdbuf)) { | 732 | dle ? "\020(AT%d%s\020)" : "AT%d%s", |
814 | dev_err(cs->dev, "out of memory\n"); | 733 | cid, cmd); |
815 | return; | 734 | else |
816 | } | 735 | cb->len = snprintf(cb->buf, buflen, |
817 | 736 | dle ? "\020(AT%s\020)" : "AT%s", | |
818 | cmdpos = cmdbuf + 9; | 737 | cmd); |
819 | cmdtail = cmdpos + cmdlen; | 738 | cb->offset = 0; |
820 | memcpy(cmdpos, cmd, cmdlen); | 739 | cb->next = NULL; |
821 | 740 | cb->wake_tasklet = NULL; | |
822 | if (cid > 0 && cid <= 65535) { | 741 | cs->ops->write_cmd(cs, cb); |
823 | do { | ||
824 | *--cmdpos = '0' + cid % 10; | ||
825 | cid /= 10; | ||
826 | ++cmdlen; | ||
827 | } while (cid); | ||
828 | } | ||
829 | |||
830 | cmdlen += 2; | ||
831 | *--cmdpos = 'T'; | ||
832 | *--cmdpos = 'A'; | ||
833 | |||
834 | if (dle) { | ||
835 | cmdlen += 4; | ||
836 | *--cmdpos = '('; | ||
837 | *--cmdpos = 0x10; | ||
838 | *cmdtail++ = 0x10; | ||
839 | *cmdtail++ = ')'; | ||
840 | } | ||
841 | |||
842 | cs->ops->write_cmd(cs, cmdpos, cmdlen, NULL); | ||
843 | kfree(cmdbuf); | ||
844 | } | 742 | } |
845 | 743 | ||
846 | static struct at_state_t *at_state_from_cid(struct cardstate *cs, int cid) | 744 | static struct at_state_t *at_state_from_cid(struct cardstate *cs, int cid) |
@@ -1242,8 +1140,22 @@ static void do_action(int action, struct cardstate *cs, | |||
1242 | break; | 1140 | break; |
1243 | case ACT_HUPMODEM: | 1141 | case ACT_HUPMODEM: |
1244 | /* send "+++" (hangup in unimodem mode) */ | 1142 | /* send "+++" (hangup in unimodem mode) */ |
1245 | if (cs->connected) | 1143 | if (cs->connected) { |
1246 | cs->ops->write_cmd(cs, "+++", 3, NULL); | 1144 | struct cmdbuf_t *cb; |
1145 | |||
1146 | cb = kmalloc(sizeof(struct cmdbuf_t) + 3, GFP_ATOMIC); | ||
1147 | if (!cb) { | ||
1148 | dev_err(cs->dev, "%s: out of memory\n", | ||
1149 | __func__); | ||
1150 | return; | ||
1151 | } | ||
1152 | memcpy(cb->buf, "+++", 3); | ||
1153 | cb->len = 3; | ||
1154 | cb->offset = 0; | ||
1155 | cb->next = NULL; | ||
1156 | cb->wake_tasklet = NULL; | ||
1157 | cs->ops->write_cmd(cs, cb); | ||
1158 | } | ||
1247 | break; | 1159 | break; |
1248 | case ACT_RING: | 1160 | case ACT_RING: |
1249 | /* get fresh AT state structure for new CID */ | 1161 | /* get fresh AT state structure for new CID */ |
@@ -1857,19 +1769,13 @@ static void process_command_flags(struct cardstate *cs) | |||
1857 | gig_dbg(DEBUG_EVENT, "Scheduling PC_CIDMODE"); | 1769 | gig_dbg(DEBUG_EVENT, "Scheduling PC_CIDMODE"); |
1858 | cs->commands_pending = 1; | 1770 | cs->commands_pending = 1; |
1859 | return; | 1771 | return; |
1860 | #ifdef GIG_MAYINITONDIAL | ||
1861 | case M_UNKNOWN: | 1772 | case M_UNKNOWN: |
1862 | schedule_init(cs, MS_INIT); | 1773 | schedule_init(cs, MS_INIT); |
1863 | return; | 1774 | return; |
1864 | #endif | ||
1865 | } | 1775 | } |
1866 | bcs->at_state.pending_commands &= ~PC_CID; | 1776 | bcs->at_state.pending_commands &= ~PC_CID; |
1867 | cs->curchannel = bcs->channel; | 1777 | cs->curchannel = bcs->channel; |
1868 | #ifdef GIG_RETRYCID | ||
1869 | cs->retry_count = 2; | 1778 | cs->retry_count = 2; |
1870 | #else | ||
1871 | cs->retry_count = 1; | ||
1872 | #endif | ||
1873 | schedule_sequence(cs, &cs->at_state, SEQ_CID); | 1779 | schedule_sequence(cs, &cs->at_state, SEQ_CID); |
1874 | return; | 1780 | return; |
1875 | } | 1781 | } |
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index 05947f9c1849..a69512fb1195 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h | |||
@@ -45,17 +45,6 @@ | |||
45 | #define MAX_EVENTS 64 /* size of event queue */ | 45 | #define MAX_EVENTS 64 /* size of event queue */ |
46 | 46 | ||
47 | #define RBUFSIZE 8192 | 47 | #define RBUFSIZE 8192 |
48 | #define SBUFSIZE 4096 /* sk_buff payload size */ | ||
49 | |||
50 | #define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */ | ||
51 | #define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */ | ||
52 | |||
53 | /* compile time options */ | ||
54 | #define GIG_MAJOR 0 | ||
55 | |||
56 | #define GIG_MAYINITONDIAL | ||
57 | #define GIG_RETRYCID | ||
58 | #define GIG_X75 | ||
59 | 48 | ||
60 | #define GIG_TICK 100 /* in milliseconds */ | 49 | #define GIG_TICK 100 /* in milliseconds */ |
61 | 50 | ||
@@ -190,17 +179,15 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, | |||
190 | #define AT_BC 3 | 179 | #define AT_BC 3 |
191 | #define AT_PROTO 4 | 180 | #define AT_PROTO 4 |
192 | #define AT_TYPE 5 | 181 | #define AT_TYPE 5 |
193 | #define AT_HLC 6 | 182 | #define AT_CLIP 6 |
194 | #define AT_CLIP 7 | ||
195 | /* total number */ | 183 | /* total number */ |
196 | #define AT_NUM 8 | 184 | #define AT_NUM 7 |
197 | 185 | ||
198 | /* variables in struct at_state_t */ | 186 | /* variables in struct at_state_t */ |
199 | #define VAR_ZSAU 0 | 187 | #define VAR_ZSAU 0 |
200 | #define VAR_ZDLE 1 | 188 | #define VAR_ZDLE 1 |
201 | #define VAR_ZVLS 2 | 189 | #define VAR_ZCTP 2 |
202 | #define VAR_ZCTP 3 | 190 | #define VAR_NUM 3 |
203 | #define VAR_NUM 4 | ||
204 | 191 | ||
205 | #define STR_NMBR 0 | 192 | #define STR_NMBR 0 |
206 | #define STR_ZCPN 1 | 193 | #define STR_ZCPN 1 |
@@ -380,8 +367,10 @@ struct bc_state { | |||
380 | 367 | ||
381 | struct at_state_t at_state; | 368 | struct at_state_t at_state; |
382 | 369 | ||
383 | __u16 fcs; | 370 | /* receive buffer */ |
384 | struct sk_buff *skb; | 371 | unsigned rx_bufsize; /* max size accepted by application */ |
372 | struct sk_buff *rx_skb; | ||
373 | __u16 rx_fcs; | ||
385 | int inputstate; /* see INS_XXXX */ | 374 | int inputstate; /* see INS_XXXX */ |
386 | 375 | ||
387 | int channel; | 376 | int channel; |
@@ -406,7 +395,9 @@ struct bc_state { | |||
406 | struct bas_bc_state *bas; /* usb hardware driver (base) */ | 395 | struct bas_bc_state *bas; /* usb hardware driver (base) */ |
407 | } hw; | 396 | } hw; |
408 | 397 | ||
409 | void *ap; /* LL application structure */ | 398 | void *ap; /* associated LL application */ |
399 | int apconnstate; /* LL application connection state */ | ||
400 | spinlock_t aplock; | ||
410 | }; | 401 | }; |
411 | 402 | ||
412 | struct cardstate { | 403 | struct cardstate { |
@@ -575,9 +566,7 @@ struct bas_bc_state { | |||
575 | struct gigaset_ops { | 566 | struct gigaset_ops { |
576 | /* Called from ev-layer.c/interface.c for sending AT commands to the | 567 | /* Called from ev-layer.c/interface.c for sending AT commands to the |
577 | device */ | 568 | device */ |
578 | int (*write_cmd)(struct cardstate *cs, | 569 | int (*write_cmd)(struct cardstate *cs, struct cmdbuf_t *cb); |
579 | const unsigned char *buf, int len, | ||
580 | struct tasklet_struct *wake_tasklet); | ||
581 | 570 | ||
582 | /* Called from interface.c for additional device control */ | 571 | /* Called from interface.c for additional device control */ |
583 | int (*write_room)(struct cardstate *cs); | 572 | int (*write_room)(struct cardstate *cs); |
@@ -801,8 +790,23 @@ static inline void gigaset_bchannel_up(struct bc_state *bcs) | |||
801 | gigaset_schedule_event(bcs->cs); | 790 | gigaset_schedule_event(bcs->cs); |
802 | } | 791 | } |
803 | 792 | ||
804 | /* handling routines for sk_buff */ | 793 | /* set up next receive skb for data mode */ |
805 | /* ============================= */ | 794 | static inline struct sk_buff *gigaset_new_rx_skb(struct bc_state *bcs) |
795 | { | ||
796 | struct cardstate *cs = bcs->cs; | ||
797 | unsigned short hw_hdr_len = cs->hw_hdr_len; | ||
798 | |||
799 | if (bcs->ignore) { | ||
800 | bcs->rx_skb = NULL; | ||
801 | } else { | ||
802 | bcs->rx_skb = dev_alloc_skb(bcs->rx_bufsize + hw_hdr_len); | ||
803 | if (bcs->rx_skb == NULL) | ||
804 | dev_warn(cs->dev, "could not allocate skb\n"); | ||
805 | else | ||
806 | skb_reserve(bcs->rx_skb, hw_hdr_len); | ||
807 | } | ||
808 | return bcs->rx_skb; | ||
809 | } | ||
806 | 810 | ||
807 | /* append received bytes to inbuf */ | 811 | /* append received bytes to inbuf */ |
808 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, | 812 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, |
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c index c22e5ace8276..34bca37d65b9 100644 --- a/drivers/isdn/gigaset/i4l.c +++ b/drivers/isdn/gigaset/i4l.c | |||
@@ -16,7 +16,10 @@ | |||
16 | #include "gigaset.h" | 16 | #include "gigaset.h" |
17 | #include <linux/isdnif.h> | 17 | #include <linux/isdnif.h> |
18 | 18 | ||
19 | #define SBUFSIZE 4096 /* sk_buff payload size */ | ||
20 | #define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */ | ||
19 | #define HW_HDR_LEN 2 /* Header size used to store ack info */ | 21 | #define HW_HDR_LEN 2 /* Header size used to store ack info */ |
22 | #define MAX_BUF_SIZE (SBUFSIZE - HW_HDR_LEN) /* max data packet from LL */ | ||
20 | 23 | ||
21 | /* == Handling of I4L IO =====================================================*/ | 24 | /* == Handling of I4L IO =====================================================*/ |
22 | 25 | ||
@@ -231,6 +234,15 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
231 | dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n"); | 234 | dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n"); |
232 | return -EBUSY; | 235 | return -EBUSY; |
233 | } | 236 | } |
237 | switch (bcs->proto2) { | ||
238 | case L2_HDLC: | ||
239 | bcs->rx_bufsize = SBUFSIZE; | ||
240 | break; | ||
241 | default: /* assume transparent */ | ||
242 | bcs->rx_bufsize = TRANSBUFSIZE; | ||
243 | } | ||
244 | dev_kfree_skb(bcs->rx_skb); | ||
245 | gigaset_new_rx_skb(bcs); | ||
234 | 246 | ||
235 | commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC); | 247 | commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC); |
236 | if (!commands) { | 248 | if (!commands) { |
@@ -314,6 +326,15 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
314 | return -EINVAL; | 326 | return -EINVAL; |
315 | } | 327 | } |
316 | bcs = cs->bcs + ch; | 328 | bcs = cs->bcs + ch; |
329 | switch (bcs->proto2) { | ||
330 | case L2_HDLC: | ||
331 | bcs->rx_bufsize = SBUFSIZE; | ||
332 | break; | ||
333 | default: /* assume transparent */ | ||
334 | bcs->rx_bufsize = TRANSBUFSIZE; | ||
335 | } | ||
336 | dev_kfree_skb(bcs->rx_skb); | ||
337 | gigaset_new_rx_skb(bcs); | ||
317 | if (!gigaset_add_event(cs, &bcs->at_state, | 338 | if (!gigaset_add_event(cs, &bcs->at_state, |
318 | EV_ACCEPT, NULL, 0, NULL)) | 339 | EV_ACCEPT, NULL, 0, NULL)) |
319 | return -ENOMEM; | 340 | return -ENOMEM; |
@@ -398,6 +419,8 @@ oom: | |||
398 | dev_err(bcs->cs->dev, "out of memory\n"); | 419 | dev_err(bcs->cs->dev, "out of memory\n"); |
399 | for (i = 0; i < AT_NUM; ++i) | 420 | for (i = 0; i < AT_NUM; ++i) |
400 | kfree(commands[i]); | 421 | kfree(commands[i]); |
422 | kfree(commands); | ||
423 | gigaset_free_channel(bcs); | ||
401 | return -ENOMEM; | 424 | return -ENOMEM; |
402 | } | 425 | } |
403 | 426 | ||
@@ -622,9 +645,7 @@ int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid) | |||
622 | iif->maxbufsize = MAX_BUF_SIZE; | 645 | iif->maxbufsize = MAX_BUF_SIZE; |
623 | iif->features = ISDN_FEATURE_L2_TRANS | | 646 | iif->features = ISDN_FEATURE_L2_TRANS | |
624 | ISDN_FEATURE_L2_HDLC | | 647 | ISDN_FEATURE_L2_HDLC | |
625 | #ifdef GIG_X75 | ||
626 | ISDN_FEATURE_L2_X75I | | 648 | ISDN_FEATURE_L2_X75I | |
627 | #endif | ||
628 | ISDN_FEATURE_L3_TRANS | | 649 | ISDN_FEATURE_L3_TRANS | |
629 | ISDN_FEATURE_P_EURO; | 650 | ISDN_FEATURE_P_EURO; |
630 | iif->hl_hdrlen = HW_HDR_LEN; /* Area for storing ack */ | 651 | iif->hl_hdrlen = HW_HDR_LEN; /* Area for storing ack */ |
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index c9f28dd40d5c..bb710d16a526 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c | |||
@@ -339,7 +339,8 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file, | |||
339 | static int if_write(struct tty_struct *tty, const unsigned char *buf, int count) | 339 | static int if_write(struct tty_struct *tty, const unsigned char *buf, int count) |
340 | { | 340 | { |
341 | struct cardstate *cs; | 341 | struct cardstate *cs; |
342 | int retval = -ENODEV; | 342 | struct cmdbuf_t *cb; |
343 | int retval; | ||
343 | 344 | ||
344 | cs = (struct cardstate *) tty->driver_data; | 345 | cs = (struct cardstate *) tty->driver_data; |
345 | if (!cs) { | 346 | if (!cs) { |
@@ -355,18 +356,39 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count) | |||
355 | if (!cs->connected) { | 356 | if (!cs->connected) { |
356 | gig_dbg(DEBUG_IF, "not connected"); | 357 | gig_dbg(DEBUG_IF, "not connected"); |
357 | retval = -ENODEV; | 358 | retval = -ENODEV; |
358 | } else if (!cs->open_count) | 359 | goto done; |
360 | } | ||
361 | if (!cs->open_count) { | ||
359 | dev_warn(cs->dev, "%s: device not opened\n", __func__); | 362 | dev_warn(cs->dev, "%s: device not opened\n", __func__); |
360 | else if (cs->mstate != MS_LOCKED) { | 363 | retval = -ENODEV; |
364 | goto done; | ||
365 | } | ||
366 | if (cs->mstate != MS_LOCKED) { | ||
361 | dev_warn(cs->dev, "can't write to unlocked device\n"); | 367 | dev_warn(cs->dev, "can't write to unlocked device\n"); |
362 | retval = -EBUSY; | 368 | retval = -EBUSY; |
363 | } else { | 369 | goto done; |
364 | retval = cs->ops->write_cmd(cs, buf, count, | 370 | } |
365 | &cs->if_wake_tasklet); | 371 | if (count <= 0) { |
372 | /* nothing to do */ | ||
373 | retval = 0; | ||
374 | goto done; | ||
366 | } | 375 | } |
367 | 376 | ||
368 | mutex_unlock(&cs->mutex); | 377 | cb = kmalloc(sizeof(struct cmdbuf_t) + count, GFP_KERNEL); |
378 | if (!cb) { | ||
379 | dev_err(cs->dev, "%s: out of memory\n", __func__); | ||
380 | retval = -ENOMEM; | ||
381 | goto done; | ||
382 | } | ||
369 | 383 | ||
384 | memcpy(cb->buf, buf, count); | ||
385 | cb->len = count; | ||
386 | cb->offset = 0; | ||
387 | cb->next = NULL; | ||
388 | cb->wake_tasklet = &cs->if_wake_tasklet; | ||
389 | retval = cs->ops->write_cmd(cs, cb); | ||
390 | done: | ||
391 | mutex_unlock(&cs->mutex); | ||
370 | return retval; | 392 | return retval; |
371 | } | 393 | } |
372 | 394 | ||
@@ -655,7 +677,6 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, | |||
655 | goto enomem; | 677 | goto enomem; |
656 | 678 | ||
657 | tty->magic = TTY_DRIVER_MAGIC, | 679 | tty->magic = TTY_DRIVER_MAGIC, |
658 | tty->major = GIG_MAJOR, | ||
659 | tty->type = TTY_DRIVER_TYPE_SERIAL, | 680 | tty->type = TTY_DRIVER_TYPE_SERIAL, |
660 | tty->subtype = SERIAL_TYPE_NORMAL, | 681 | tty->subtype = SERIAL_TYPE_NORMAL, |
661 | tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; | 682 | tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; |
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index 16fd3bd48883..2dfd346fc889 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
@@ -500,19 +500,18 @@ int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len) | |||
500 | */ | 500 | */ |
501 | static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) | 501 | static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) |
502 | { | 502 | { |
503 | bcs->fcs = crc_ccitt_byte(bcs->fcs, c); | 503 | bcs->rx_fcs = crc_ccitt_byte(bcs->rx_fcs, c); |
504 | if (unlikely(bcs->skb == NULL)) { | 504 | if (bcs->rx_skb == NULL) |
505 | /* skipping */ | 505 | /* skipping */ |
506 | return; | 506 | return; |
507 | } | 507 | if (bcs->rx_skb->len >= bcs->rx_bufsize) { |
508 | if (unlikely(bcs->skb->len == SBUFSIZE)) { | ||
509 | dev_warn(bcs->cs->dev, "received oversized packet discarded\n"); | 508 | dev_warn(bcs->cs->dev, "received oversized packet discarded\n"); |
510 | bcs->hw.bas->giants++; | 509 | bcs->hw.bas->giants++; |
511 | dev_kfree_skb_any(bcs->skb); | 510 | dev_kfree_skb_any(bcs->rx_skb); |
512 | bcs->skb = NULL; | 511 | bcs->rx_skb = NULL; |
513 | return; | 512 | return; |
514 | } | 513 | } |
515 | *__skb_put(bcs->skb, 1) = c; | 514 | *__skb_put(bcs->rx_skb, 1) = c; |
516 | } | 515 | } |
517 | 516 | ||
518 | /* hdlc_flush | 517 | /* hdlc_flush |
@@ -521,18 +520,13 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) | |||
521 | static inline void hdlc_flush(struct bc_state *bcs) | 520 | static inline void hdlc_flush(struct bc_state *bcs) |
522 | { | 521 | { |
523 | /* clear skb or allocate new if not skipping */ | 522 | /* clear skb or allocate new if not skipping */ |
524 | if (likely(bcs->skb != NULL)) | 523 | if (bcs->rx_skb != NULL) |
525 | skb_trim(bcs->skb, 0); | 524 | skb_trim(bcs->rx_skb, 0); |
526 | else if (!bcs->ignore) { | 525 | else |
527 | bcs->skb = dev_alloc_skb(SBUFSIZE + bcs->cs->hw_hdr_len); | 526 | gigaset_new_rx_skb(bcs); |
528 | if (bcs->skb) | ||
529 | skb_reserve(bcs->skb, bcs->cs->hw_hdr_len); | ||
530 | else | ||
531 | dev_err(bcs->cs->dev, "could not allocate skb\n"); | ||
532 | } | ||
533 | 527 | ||
534 | /* reset packet state */ | 528 | /* reset packet state */ |
535 | bcs->fcs = PPP_INITFCS; | 529 | bcs->rx_fcs = PPP_INITFCS; |
536 | } | 530 | } |
537 | 531 | ||
538 | /* hdlc_done | 532 | /* hdlc_done |
@@ -549,7 +543,7 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
549 | hdlc_flush(bcs); | 543 | hdlc_flush(bcs); |
550 | return; | 544 | return; |
551 | } | 545 | } |
552 | procskb = bcs->skb; | 546 | procskb = bcs->rx_skb; |
553 | if (procskb == NULL) { | 547 | if (procskb == NULL) { |
554 | /* previous error */ | 548 | /* previous error */ |
555 | gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__); | 549 | gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__); |
@@ -560,8 +554,8 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
560 | bcs->hw.bas->runts++; | 554 | bcs->hw.bas->runts++; |
561 | dev_kfree_skb_any(procskb); | 555 | dev_kfree_skb_any(procskb); |
562 | gigaset_isdn_rcv_err(bcs); | 556 | gigaset_isdn_rcv_err(bcs); |
563 | } else if (bcs->fcs != PPP_GOODFCS) { | 557 | } else if (bcs->rx_fcs != PPP_GOODFCS) { |
564 | dev_notice(cs->dev, "frame check error (0x%04x)\n", bcs->fcs); | 558 | dev_notice(cs->dev, "frame check error\n"); |
565 | bcs->hw.bas->fcserrs++; | 559 | bcs->hw.bas->fcserrs++; |
566 | dev_kfree_skb_any(procskb); | 560 | dev_kfree_skb_any(procskb); |
567 | gigaset_isdn_rcv_err(bcs); | 561 | gigaset_isdn_rcv_err(bcs); |
@@ -574,13 +568,8 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
574 | bcs->hw.bas->goodbytes += len; | 568 | bcs->hw.bas->goodbytes += len; |
575 | gigaset_skb_rcvd(bcs, procskb); | 569 | gigaset_skb_rcvd(bcs, procskb); |
576 | } | 570 | } |
577 | 571 | gigaset_new_rx_skb(bcs); | |
578 | bcs->skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | 572 | bcs->rx_fcs = PPP_INITFCS; |
579 | if (bcs->skb) | ||
580 | skb_reserve(bcs->skb, cs->hw_hdr_len); | ||
581 | else | ||
582 | dev_err(cs->dev, "could not allocate skb\n"); | ||
583 | bcs->fcs = PPP_INITFCS; | ||
584 | } | 573 | } |
585 | 574 | ||
586 | /* hdlc_frag | 575 | /* hdlc_frag |
@@ -597,8 +586,8 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits) | |||
597 | dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits); | 586 | dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits); |
598 | bcs->hw.bas->alignerrs++; | 587 | bcs->hw.bas->alignerrs++; |
599 | gigaset_isdn_rcv_err(bcs); | 588 | gigaset_isdn_rcv_err(bcs); |
600 | __skb_trim(bcs->skb, 0); | 589 | __skb_trim(bcs->rx_skb, 0); |
601 | bcs->fcs = PPP_INITFCS; | 590 | bcs->rx_fcs = PPP_INITFCS; |
602 | } | 591 | } |
603 | 592 | ||
604 | /* bit counts lookup table for HDLC bit unstuffing | 593 | /* bit counts lookup table for HDLC bit unstuffing |
@@ -847,7 +836,6 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
847 | static inline void trans_receive(unsigned char *src, unsigned count, | 836 | static inline void trans_receive(unsigned char *src, unsigned count, |
848 | struct bc_state *bcs) | 837 | struct bc_state *bcs) |
849 | { | 838 | { |
850 | struct cardstate *cs = bcs->cs; | ||
851 | struct sk_buff *skb; | 839 | struct sk_buff *skb; |
852 | int dobytes; | 840 | int dobytes; |
853 | unsigned char *dst; | 841 | unsigned char *dst; |
@@ -857,17 +845,11 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
857 | hdlc_flush(bcs); | 845 | hdlc_flush(bcs); |
858 | return; | 846 | return; |
859 | } | 847 | } |
860 | skb = bcs->skb; | 848 | skb = bcs->rx_skb; |
861 | if (unlikely(skb == NULL)) { | 849 | if (skb == NULL) |
862 | bcs->skb = skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | 850 | skb = gigaset_new_rx_skb(bcs); |
863 | if (!skb) { | ||
864 | dev_err(cs->dev, "could not allocate skb\n"); | ||
865 | return; | ||
866 | } | ||
867 | skb_reserve(skb, cs->hw_hdr_len); | ||
868 | } | ||
869 | bcs->hw.bas->goodbytes += skb->len; | 851 | bcs->hw.bas->goodbytes += skb->len; |
870 | dobytes = TRANSBUFSIZE - skb->len; | 852 | dobytes = bcs->rx_bufsize - skb->len; |
871 | while (count > 0) { | 853 | while (count > 0) { |
872 | dst = skb_put(skb, count < dobytes ? count : dobytes); | 854 | dst = skb_put(skb, count < dobytes ? count : dobytes); |
873 | while (count > 0 && dobytes > 0) { | 855 | while (count > 0 && dobytes > 0) { |
@@ -879,14 +861,10 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
879 | dump_bytes(DEBUG_STREAM_DUMP, | 861 | dump_bytes(DEBUG_STREAM_DUMP, |
880 | "rcv data", skb->data, skb->len); | 862 | "rcv data", skb->data, skb->len); |
881 | gigaset_skb_rcvd(bcs, skb); | 863 | gigaset_skb_rcvd(bcs, skb); |
882 | bcs->skb = skb = | 864 | skb = gigaset_new_rx_skb(bcs); |
883 | dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | 865 | if (skb == NULL) |
884 | if (!skb) { | ||
885 | dev_err(cs->dev, "could not allocate skb\n"); | ||
886 | return; | 866 | return; |
887 | } | 867 | dobytes = bcs->rx_bufsize; |
888 | skb_reserve(skb, cs->hw_hdr_len); | ||
889 | dobytes = TRANSBUFSIZE; | ||
890 | } | 868 | } |
891 | } | 869 | } |
892 | } | 870 | } |
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c index e96c0586886c..d151dcbf770d 100644 --- a/drivers/isdn/gigaset/ser-gigaset.c +++ b/drivers/isdn/gigaset/ser-gigaset.c | |||
@@ -241,30 +241,13 @@ static void flush_send_queue(struct cardstate *cs) | |||
241 | * return value: | 241 | * return value: |
242 | * number of bytes queued, or error code < 0 | 242 | * number of bytes queued, or error code < 0 |
243 | */ | 243 | */ |
244 | static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf, | 244 | static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb) |
245 | int len, struct tasklet_struct *wake_tasklet) | ||
246 | { | 245 | { |
247 | struct cmdbuf_t *cb; | ||
248 | unsigned long flags; | 246 | unsigned long flags; |
249 | 247 | ||
250 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? | 248 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? |
251 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, | 249 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, |
252 | "CMD Transmit", len, buf); | 250 | "CMD Transmit", cb->len, cb->buf); |
253 | |||
254 | if (len <= 0) | ||
255 | return 0; | ||
256 | |||
257 | cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC); | ||
258 | if (!cb) { | ||
259 | dev_err(cs->dev, "%s: out of memory!\n", __func__); | ||
260 | return -ENOMEM; | ||
261 | } | ||
262 | |||
263 | memcpy(cb->buf, buf, len); | ||
264 | cb->len = len; | ||
265 | cb->offset = 0; | ||
266 | cb->next = NULL; | ||
267 | cb->wake_tasklet = wake_tasklet; | ||
268 | 251 | ||
269 | spin_lock_irqsave(&cs->cmdlock, flags); | 252 | spin_lock_irqsave(&cs->cmdlock, flags); |
270 | cb->prev = cs->lastcmdbuf; | 253 | cb->prev = cs->lastcmdbuf; |
@@ -272,9 +255,9 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf, | |||
272 | cs->lastcmdbuf->next = cb; | 255 | cs->lastcmdbuf->next = cb; |
273 | else { | 256 | else { |
274 | cs->cmdbuf = cb; | 257 | cs->cmdbuf = cb; |
275 | cs->curlen = len; | 258 | cs->curlen = cb->len; |
276 | } | 259 | } |
277 | cs->cmdbytes += len; | 260 | cs->cmdbytes += cb->len; |
278 | cs->lastcmdbuf = cb; | 261 | cs->lastcmdbuf = cb; |
279 | spin_unlock_irqrestore(&cs->cmdlock, flags); | 262 | spin_unlock_irqrestore(&cs->cmdlock, flags); |
280 | 263 | ||
@@ -282,7 +265,7 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf, | |||
282 | if (cs->connected) | 265 | if (cs->connected) |
283 | tasklet_schedule(&cs->write_tasklet); | 266 | tasklet_schedule(&cs->write_tasklet); |
284 | spin_unlock_irqrestore(&cs->lock, flags); | 267 | spin_unlock_irqrestore(&cs->lock, flags); |
285 | return len; | 268 | return cb->len; |
286 | } | 269 | } |
287 | 270 | ||
288 | /* | 271 | /* |
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index 76dbb20f3065..4a66338f4e7d 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c | |||
@@ -39,7 +39,8 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode"); | |||
39 | #define GIGASET_MODULENAME "usb_gigaset" | 39 | #define GIGASET_MODULENAME "usb_gigaset" |
40 | #define GIGASET_DEVNAME "ttyGU" | 40 | #define GIGASET_DEVNAME "ttyGU" |
41 | 41 | ||
42 | #define IF_WRITEBUF 2000 /* arbitrary limit */ | 42 | /* length limit according to Siemens 3070usb-protokoll.doc ch. 2.1 */ |
43 | #define IF_WRITEBUF 264 | ||
43 | 44 | ||
44 | /* Values for the Gigaset M105 Data */ | 45 | /* Values for the Gigaset M105 Data */ |
45 | #define USB_M105_VENDOR_ID 0x0681 | 46 | #define USB_M105_VENDOR_ID 0x0681 |
@@ -493,29 +494,13 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb) | |||
493 | } | 494 | } |
494 | 495 | ||
495 | /* Send command to device. */ | 496 | /* Send command to device. */ |
496 | static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf, | 497 | static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb) |
497 | int len, struct tasklet_struct *wake_tasklet) | ||
498 | { | 498 | { |
499 | struct cmdbuf_t *cb; | ||
500 | unsigned long flags; | 499 | unsigned long flags; |
501 | 500 | ||
502 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? | 501 | gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? |
503 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, | 502 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, |
504 | "CMD Transmit", len, buf); | 503 | "CMD Transmit", cb->len, cb->buf); |
505 | |||
506 | if (len <= 0) | ||
507 | return 0; | ||
508 | cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC); | ||
509 | if (!cb) { | ||
510 | dev_err(cs->dev, "%s: out of memory\n", __func__); | ||
511 | return -ENOMEM; | ||
512 | } | ||
513 | |||
514 | memcpy(cb->buf, buf, len); | ||
515 | cb->len = len; | ||
516 | cb->offset = 0; | ||
517 | cb->next = NULL; | ||
518 | cb->wake_tasklet = wake_tasklet; | ||
519 | 504 | ||
520 | spin_lock_irqsave(&cs->cmdlock, flags); | 505 | spin_lock_irqsave(&cs->cmdlock, flags); |
521 | cb->prev = cs->lastcmdbuf; | 506 | cb->prev = cs->lastcmdbuf; |
@@ -523,9 +508,9 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf, | |||
523 | cs->lastcmdbuf->next = cb; | 508 | cs->lastcmdbuf->next = cb; |
524 | else { | 509 | else { |
525 | cs->cmdbuf = cb; | 510 | cs->cmdbuf = cb; |
526 | cs->curlen = len; | 511 | cs->curlen = cb->len; |
527 | } | 512 | } |
528 | cs->cmdbytes += len; | 513 | cs->cmdbytes += cb->len; |
529 | cs->lastcmdbuf = cb; | 514 | cs->lastcmdbuf = cb; |
530 | spin_unlock_irqrestore(&cs->cmdlock, flags); | 515 | spin_unlock_irqrestore(&cs->cmdlock, flags); |
531 | 516 | ||
@@ -533,7 +518,7 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf, | |||
533 | if (cs->connected) | 518 | if (cs->connected) |
534 | tasklet_schedule(&cs->write_tasklet); | 519 | tasklet_schedule(&cs->write_tasklet); |
535 | spin_unlock_irqrestore(&cs->lock, flags); | 520 | spin_unlock_irqrestore(&cs->lock, flags); |
536 | return len; | 521 | return cb->len; |
537 | } | 522 | } |
538 | 523 | ||
539 | static int gigaset_write_room(struct cardstate *cs) | 524 | static int gigaset_write_room(struct cardstate *cs) |
diff --git a/drivers/isdn/hardware/eicon/divamnt.c b/drivers/isdn/hardware/eicon/divamnt.c index 1e85f743214e..f1d464f1e107 100644 --- a/drivers/isdn/hardware/eicon/divamnt.c +++ b/drivers/isdn/hardware/eicon/divamnt.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/poll.h> | 16 | #include <linux/poll.h> |
17 | #include <linux/smp_lock.h> | 17 | #include <linux/mutex.h> |
18 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
19 | 19 | ||
20 | #include "platform.h" | 20 | #include "platform.h" |
@@ -22,6 +22,7 @@ | |||
22 | #include "divasync.h" | 22 | #include "divasync.h" |
23 | #include "debug_if.h" | 23 | #include "debug_if.h" |
24 | 24 | ||
25 | static DEFINE_MUTEX(maint_mutex); | ||
25 | static char *main_revision = "$Revision: 1.32.6.10 $"; | 26 | static char *main_revision = "$Revision: 1.32.6.10 $"; |
26 | 27 | ||
27 | static int major; | 28 | static int major; |
@@ -130,7 +131,7 @@ static int maint_open(struct inode *ino, struct file *filep) | |||
130 | { | 131 | { |
131 | int ret; | 132 | int ret; |
132 | 133 | ||
133 | lock_kernel(); | 134 | mutex_lock(&maint_mutex); |
134 | /* only one open is allowed, so we test | 135 | /* only one open is allowed, so we test |
135 | it atomically */ | 136 | it atomically */ |
136 | if (test_and_set_bit(0, &opened)) | 137 | if (test_and_set_bit(0, &opened)) |
@@ -139,7 +140,7 @@ static int maint_open(struct inode *ino, struct file *filep) | |||
139 | filep->private_data = NULL; | 140 | filep->private_data = NULL; |
140 | ret = nonseekable_open(ino, filep); | 141 | ret = nonseekable_open(ino, filep); |
141 | } | 142 | } |
142 | unlock_kernel(); | 143 | mutex_unlock(&maint_mutex); |
143 | return ret; | 144 | return ret; |
144 | } | 145 | } |
145 | 146 | ||
diff --git a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c index f577719ab3fa..42d3b8346034 100644 --- a/drivers/isdn/hardware/eicon/divasi.c +++ b/drivers/isdn/hardware/eicon/divasi.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_fs.h> |
19 | #include <linux/skbuff.h> | 19 | #include <linux/skbuff.h> |
20 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
21 | #include <linux/smp_lock.h> | ||
22 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
23 | 22 | ||
24 | #include "platform.h" | 23 | #include "platform.h" |
@@ -402,7 +401,6 @@ static unsigned int um_idi_poll(struct file *file, poll_table * wait) | |||
402 | 401 | ||
403 | static int um_idi_open(struct inode *inode, struct file *file) | 402 | static int um_idi_open(struct inode *inode, struct file *file) |
404 | { | 403 | { |
405 | cycle_kernel_lock(); | ||
406 | return (0); | 404 | return (0); |
407 | } | 405 | } |
408 | 406 | ||
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c index fbbcb27fb681..ed9c55506797 100644 --- a/drivers/isdn/hardware/eicon/divasmain.c +++ b/drivers/isdn/hardware/eicon/divasmain.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
22 | #include <linux/poll.h> | 22 | #include <linux/poll.h> |
23 | #include <linux/kmod.h> | 23 | #include <linux/kmod.h> |
24 | #include <linux/smp_lock.h> | ||
25 | 24 | ||
26 | #include "platform.h" | 25 | #include "platform.h" |
27 | #undef ID_MASK | 26 | #undef ID_MASK |
@@ -113,41 +112,40 @@ typedef struct _diva_os_thread_dpc { | |||
113 | This table should be sorted by PCI device ID | 112 | This table should be sorted by PCI device ID |
114 | */ | 113 | */ |
115 | static struct pci_device_id divas_pci_tbl[] = { | 114 | static struct pci_device_id divas_pci_tbl[] = { |
116 | /* Diva Server BRI-2M PCI 0xE010 */ | 115 | /* Diva Server BRI-2M PCI 0xE010 */ |
117 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRA, | 116 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRA), |
118 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_MAESTRA_PCI}, | 117 | CARDTYPE_MAESTRA_PCI }, |
119 | /* Diva Server 4BRI-8M PCI 0xE012 */ | 118 | /* Diva Server 4BRI-8M PCI 0xE012 */ |
120 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRAQ, | 119 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAQ), |
121 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_DIVASRV_Q_8M_PCI}, | 120 | CARDTYPE_DIVASRV_Q_8M_PCI }, |
122 | /* Diva Server 4BRI-8M 2.0 PCI 0xE013 */ | 121 | /* Diva Server 4BRI-8M 2.0 PCI 0xE013 */ |
123 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRAQ_U, | 122 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAQ_U), |
124 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_DIVASRV_Q_8M_V2_PCI}, | 123 | CARDTYPE_DIVASRV_Q_8M_V2_PCI }, |
125 | /* Diva Server PRI-30M PCI 0xE014 */ | 124 | /* Diva Server PRI-30M PCI 0xE014 */ |
126 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRAP, | 125 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAP), |
127 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_DIVASRV_P_30M_PCI}, | 126 | CARDTYPE_DIVASRV_P_30M_PCI }, |
128 | /* Diva Server PRI 2.0 adapter 0xE015 */ | 127 | /* Diva Server PRI 2.0 adapter 0xE015 */ |
129 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRAP_2, | 128 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAP_2), |
130 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_DIVASRV_P_30M_V2_PCI}, | 129 | CARDTYPE_DIVASRV_P_30M_V2_PCI }, |
131 | /* Diva Server Voice 4BRI-8M PCI 0xE016 */ | 130 | /* Diva Server Voice 4BRI-8M PCI 0xE016 */ |
132 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_4BRI_VOIP, | 131 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_4BRI_VOIP), |
133 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_DIVASRV_VOICE_Q_8M_PCI}, | 132 | CARDTYPE_DIVASRV_VOICE_Q_8M_PCI }, |
134 | /* Diva Server Voice 4BRI-8M 2.0 PCI 0xE017 */ | 133 | /* Diva Server Voice 4BRI-8M 2.0 PCI 0xE017 */ |
135 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_4BRI_2_VOIP, | 134 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_4BRI_2_VOIP), |
136 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_DIVASRV_VOICE_Q_8M_V2_PCI}, | 135 | CARDTYPE_DIVASRV_VOICE_Q_8M_V2_PCI }, |
137 | /* Diva Server BRI-2M 2.0 PCI 0xE018 */ | 136 | /* Diva Server BRI-2M 2.0 PCI 0xE018 */ |
138 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_BRI2M_2, | 137 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_BRI2M_2), |
139 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_DIVASRV_B_2M_V2_PCI}, | 138 | CARDTYPE_DIVASRV_B_2M_V2_PCI }, |
140 | /* Diva Server Voice PRI 2.0 PCI 0xE019 */ | 139 | /* Diva Server Voice PRI 2.0 PCI 0xE019 */ |
141 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRAP_2_VOIP, | 140 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAP_2_VOIP), |
142 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 141 | CARDTYPE_DIVASRV_VOICE_P_30M_V2_PCI }, |
143 | CARDTYPE_DIVASRV_VOICE_P_30M_V2_PCI}, | 142 | /* Diva Server 2FX 0xE01A */ |
144 | /* Diva Server 2FX 0xE01A */ | 143 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_2F), |
145 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_2F, | 144 | CARDTYPE_DIVASRV_B_2F_PCI }, |
146 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_DIVASRV_B_2F_PCI}, | 145 | /* Diva Server Voice BRI-2M 2.0 PCI 0xE01B */ |
147 | /* Diva Server Voice BRI-2M 2.0 PCI 0xE01B */ | 146 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_BRI2M_2_VOIP), |
148 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_BRI2M_2_VOIP, | 147 | CARDTYPE_DIVASRV_VOICE_B_2M_V2_PCI }, |
149 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_DIVASRV_VOICE_B_2M_V2_PCI}, | 148 | { 0, } /* 0 terminated list. */ |
150 | {0,} /* 0 terminated list. */ | ||
151 | }; | 149 | }; |
152 | MODULE_DEVICE_TABLE(pci, divas_pci_tbl); | 150 | MODULE_DEVICE_TABLE(pci, divas_pci_tbl); |
153 | 151 | ||
@@ -581,7 +579,6 @@ xdi_copy_from_user(void *os_handle, void *dst, const void __user *src, int lengt | |||
581 | */ | 579 | */ |
582 | static int divas_open(struct inode *inode, struct file *file) | 580 | static int divas_open(struct inode *inode, struct file *file) |
583 | { | 581 | { |
584 | cycle_kernel_lock(); | ||
585 | return (0); | 582 | return (0); |
586 | } | 583 | } |
587 | 584 | ||
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c index 095ed76ebe80..987fb1824f08 100644 --- a/drivers/isdn/hardware/mISDN/hfcmulti.c +++ b/drivers/isdn/hardware/mISDN/hfcmulti.c | |||
@@ -5354,12 +5354,9 @@ static struct pci_device_id hfmultipci_ids[] __devinitdata = { | |||
5354 | { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFCE1, PCI_VENDOR_ID_CCD, | 5354 | { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFCE1, PCI_VENDOR_ID_CCD, |
5355 | PCI_SUBDEVICE_ID_CCD_JHSE1, 0, 0, H(25)}, /* Junghanns E1 */ | 5355 | PCI_SUBDEVICE_ID_CCD_JHSE1, 0, 0, H(25)}, /* Junghanns E1 */ |
5356 | 5356 | ||
5357 | { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFC4S, PCI_ANY_ID, PCI_ANY_ID, | 5357 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_HFC4S), 0 }, |
5358 | 0, 0, 0}, | 5358 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_HFC8S), 0 }, |
5359 | { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFC8S, PCI_ANY_ID, PCI_ANY_ID, | 5359 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_HFCE1), 0 }, |
5360 | 0, 0, 0}, | ||
5361 | { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFCE1, PCI_ANY_ID, PCI_ANY_ID, | ||
5362 | 0, 0, 0}, | ||
5363 | {0, } | 5360 | {0, } |
5364 | }; | 5361 | }; |
5365 | #undef H | 5362 | #undef H |
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c index 5940a2c12074..10757abac0ba 100644 --- a/drivers/isdn/hardware/mISDN/hfcpci.c +++ b/drivers/isdn/hardware/mISDN/hfcpci.c | |||
@@ -2188,52 +2188,52 @@ static const struct _hfc_map hfc_map[] = | |||
2188 | 2188 | ||
2189 | static struct pci_device_id hfc_ids[] = | 2189 | static struct pci_device_id hfc_ids[] = |
2190 | { | 2190 | { |
2191 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_2BD0, | 2191 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_2BD0), |
2192 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[0]}, | 2192 | (unsigned long) &hfc_map[0] }, |
2193 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B000, | 2193 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B000), |
2194 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[1]}, | 2194 | (unsigned long) &hfc_map[1] }, |
2195 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B006, | 2195 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B006), |
2196 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[2]}, | 2196 | (unsigned long) &hfc_map[2] }, |
2197 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B007, | 2197 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B007), |
2198 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[3]}, | 2198 | (unsigned long) &hfc_map[3] }, |
2199 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B008, | 2199 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B008), |
2200 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[4]}, | 2200 | (unsigned long) &hfc_map[4] }, |
2201 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B009, | 2201 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B009), |
2202 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[5]}, | 2202 | (unsigned long) &hfc_map[5] }, |
2203 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00A, | 2203 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B00A), |
2204 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[6]}, | 2204 | (unsigned long) &hfc_map[6] }, |
2205 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00B, | 2205 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B00B), |
2206 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[7]}, | 2206 | (unsigned long) &hfc_map[7] }, |
2207 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00C, | 2207 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B00C), |
2208 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[8]}, | 2208 | (unsigned long) &hfc_map[8] }, |
2209 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B100, | 2209 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B100), |
2210 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[9]}, | 2210 | (unsigned long) &hfc_map[9] }, |
2211 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B700, | 2211 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B700), |
2212 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[10]}, | 2212 | (unsigned long) &hfc_map[10] }, |
2213 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B701, | 2213 | { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B701), |
2214 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[11]}, | 2214 | (unsigned long) &hfc_map[11] }, |
2215 | {PCI_VENDOR_ID_ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1, | 2215 | { PCI_VDEVICE(ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1), |
2216 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[12]}, | 2216 | (unsigned long) &hfc_map[12] }, |
2217 | {PCI_VENDOR_ID_ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675, | 2217 | { PCI_VDEVICE(ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675), |
2218 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[13]}, | 2218 | (unsigned long) &hfc_map[13] }, |
2219 | {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT, | 2219 | { PCI_VDEVICE(BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT), |
2220 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[14]}, | 2220 | (unsigned long) &hfc_map[14] }, |
2221 | {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A1T, | 2221 | { PCI_VDEVICE(BERKOM, PCI_DEVICE_ID_BERKOM_A1T), |
2222 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[15]}, | 2222 | (unsigned long) &hfc_map[15] }, |
2223 | {PCI_VENDOR_ID_ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575, | 2223 | { PCI_VDEVICE(ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575), |
2224 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[16]}, | 2224 | (unsigned long) &hfc_map[16] }, |
2225 | {PCI_VENDOR_ID_ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0, | 2225 | { PCI_VDEVICE(ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0), |
2226 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[17]}, | 2226 | (unsigned long) &hfc_map[17] }, |
2227 | {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E, | 2227 | { PCI_VDEVICE(DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E), |
2228 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[18]}, | 2228 | (unsigned long) &hfc_map[18] }, |
2229 | {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_E, | 2229 | { PCI_VDEVICE(DIGI, PCI_DEVICE_ID_DIGI_DF_M_E), |
2230 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[19]}, | 2230 | (unsigned long) &hfc_map[19] }, |
2231 | {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A, | 2231 | { PCI_VDEVICE(DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A), |
2232 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[20]}, | 2232 | (unsigned long) &hfc_map[20] }, |
2233 | {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_A, | 2233 | { PCI_VDEVICE(DIGI, PCI_DEVICE_ID_DIGI_DF_M_A), |
2234 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[21]}, | 2234 | (unsigned long) &hfc_map[21] }, |
2235 | {PCI_VENDOR_ID_SITECOM, PCI_DEVICE_ID_SITECOM_DC105V2, | 2235 | { PCI_VDEVICE(SITECOM, PCI_DEVICE_ID_SITECOM_DC105V2), |
2236 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &hfc_map[22]}, | 2236 | (unsigned long) &hfc_map[22] }, |
2237 | {}, | 2237 | {}, |
2238 | }; | 2238 | }; |
2239 | 2239 | ||
diff --git a/drivers/isdn/hardware/mISDN/mISDNinfineon.c b/drivers/isdn/hardware/mISDN/mISDNinfineon.c index f5b3d2b26a08..2a2181d58deb 100644 --- a/drivers/isdn/hardware/mISDN/mISDNinfineon.c +++ b/drivers/isdn/hardware/mISDN/mISDNinfineon.c | |||
@@ -125,36 +125,25 @@ struct inf_hw { | |||
125 | #define PCI_SUB_ID_SEDLBAUER 0x01 | 125 | #define PCI_SUB_ID_SEDLBAUER 0x01 |
126 | 126 | ||
127 | static struct pci_device_id infineon_ids[] __devinitdata = { | 127 | static struct pci_device_id infineon_ids[] __devinitdata = { |
128 | { PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20, | 128 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA20), INF_DIVA20 }, |
129 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_DIVA20}, | 129 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA20_U), INF_DIVA20U }, |
130 | { PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20_U, | 130 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA201), INF_DIVA201 }, |
131 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_DIVA20U}, | 131 | { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA202), INF_DIVA202 }, |
132 | { PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA201, | ||
133 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_DIVA201}, | ||
134 | { PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA202, | ||
135 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_DIVA202}, | ||
136 | { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, | 132 | { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, |
137 | PCI_SUBVENDOR_SEDLBAUER_PCI, PCI_SUB_ID_SEDLBAUER, 0, 0, | 133 | PCI_SUBVENDOR_SEDLBAUER_PCI, PCI_SUB_ID_SEDLBAUER, 0, 0, |
138 | INF_SPEEDWIN}, | 134 | INF_SPEEDWIN }, |
139 | { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, | 135 | { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, |
140 | PCI_SUBVENDOR_HST_SAPHIR3, PCI_SUB_ID_SEDLBAUER, 0, 0, INF_SAPHIR3}, | 136 | PCI_SUBVENDOR_HST_SAPHIR3, PCI_SUB_ID_SEDLBAUER, 0, 0, INF_SAPHIR3 }, |
141 | { PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_MICROLINK, | 137 | { PCI_VDEVICE(ELSA, PCI_DEVICE_ID_ELSA_MICROLINK), INF_QS1000 }, |
142 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_QS1000}, | 138 | { PCI_VDEVICE(ELSA, PCI_DEVICE_ID_ELSA_QS3000), INF_QS3000 }, |
143 | { PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_QS3000, | 139 | { PCI_VDEVICE(SATSAGEM, PCI_DEVICE_ID_SATSAGEM_NICCY), INF_NICCY }, |
144 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_QS3000}, | ||
145 | { PCI_VENDOR_ID_SATSAGEM, PCI_DEVICE_ID_SATSAGEM_NICCY, | ||
146 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_NICCY}, | ||
147 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | 140 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, |
148 | PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO, 0, 0, | 141 | PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO, 0, 0, |
149 | INF_SCT_1}, | 142 | INF_SCT_1 }, |
150 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R685, | 143 | { PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_R685), INF_GAZEL_R685 }, |
151 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_GAZEL_R685}, | 144 | { PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_R753), INF_GAZEL_R753 }, |
152 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R753, | 145 | { PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO), INF_GAZEL_R753 }, |
153 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_GAZEL_R753}, | 146 | { PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_OLITEC), INF_GAZEL_R753 }, |
154 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO, | ||
155 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_GAZEL_R753}, | ||
156 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_OLITEC, | ||
157 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INF_GAZEL_R753}, | ||
158 | { } | 147 | { } |
159 | }; | 148 | }; |
160 | MODULE_DEVICE_TABLE(pci, infineon_ids); | 149 | MODULE_DEVICE_TABLE(pci, infineon_ids); |
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c index 544cf4b1cce3..6f9afcd5ca4e 100644 --- a/drivers/isdn/hisax/config.c +++ b/drivers/isdn/hisax/config.c | |||
@@ -1909,68 +1909,68 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if) | |||
1909 | 1909 | ||
1910 | static struct pci_device_id hisax_pci_tbl[] __devinitdata = { | 1910 | static struct pci_device_id hisax_pci_tbl[] __devinitdata = { |
1911 | #ifdef CONFIG_HISAX_FRITZPCI | 1911 | #ifdef CONFIG_HISAX_FRITZPCI |
1912 | {PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, PCI_ANY_ID, PCI_ANY_ID}, | 1912 | {PCI_VDEVICE(AVM, PCI_DEVICE_ID_AVM_A1) }, |
1913 | #endif | 1913 | #endif |
1914 | #ifdef CONFIG_HISAX_DIEHLDIVA | 1914 | #ifdef CONFIG_HISAX_DIEHLDIVA |
1915 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20, PCI_ANY_ID, PCI_ANY_ID}, | 1915 | {PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA20) }, |
1916 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20_U, PCI_ANY_ID, PCI_ANY_ID}, | 1916 | {PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA20_U) }, |
1917 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA201, PCI_ANY_ID, PCI_ANY_ID}, | 1917 | {PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA201) }, |
1918 | //######################################################################################### | 1918 | /*##########################################################################*/ |
1919 | {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA202, PCI_ANY_ID, PCI_ANY_ID}, | 1919 | {PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA202) }, |
1920 | //######################################################################################### | 1920 | /*##########################################################################*/ |
1921 | #endif | 1921 | #endif |
1922 | #ifdef CONFIG_HISAX_ELSA | 1922 | #ifdef CONFIG_HISAX_ELSA |
1923 | {PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_MICROLINK, PCI_ANY_ID, PCI_ANY_ID}, | 1923 | {PCI_VDEVICE(ELSA, PCI_DEVICE_ID_ELSA_MICROLINK) }, |
1924 | {PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_QS3000, PCI_ANY_ID, PCI_ANY_ID}, | 1924 | {PCI_VDEVICE(ELSA, PCI_DEVICE_ID_ELSA_QS3000) }, |
1925 | #endif | 1925 | #endif |
1926 | #ifdef CONFIG_HISAX_GAZEL | 1926 | #ifdef CONFIG_HISAX_GAZEL |
1927 | {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R685, PCI_ANY_ID, PCI_ANY_ID}, | 1927 | {PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_R685) }, |
1928 | {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R753, PCI_ANY_ID, PCI_ANY_ID}, | 1928 | {PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_R753) }, |
1929 | {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO, PCI_ANY_ID, PCI_ANY_ID}, | 1929 | {PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO) }, |
1930 | {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_OLITEC, PCI_ANY_ID, PCI_ANY_ID}, | 1930 | {PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_OLITEC) }, |
1931 | #endif | 1931 | #endif |
1932 | #ifdef CONFIG_HISAX_SCT_QUADRO | 1932 | #ifdef CONFIG_HISAX_SCT_QUADRO |
1933 | {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, PCI_ANY_ID, PCI_ANY_ID}, | 1933 | {PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_9050) }, |
1934 | #endif | 1934 | #endif |
1935 | #ifdef CONFIG_HISAX_NICCY | 1935 | #ifdef CONFIG_HISAX_NICCY |
1936 | {PCI_VENDOR_ID_SATSAGEM, PCI_DEVICE_ID_SATSAGEM_NICCY, PCI_ANY_ID,PCI_ANY_ID}, | 1936 | {PCI_VDEVICE(SATSAGEM, PCI_DEVICE_ID_SATSAGEM_NICCY) }, |
1937 | #endif | 1937 | #endif |
1938 | #ifdef CONFIG_HISAX_SEDLBAUER | 1938 | #ifdef CONFIG_HISAX_SEDLBAUER |
1939 | {PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, PCI_ANY_ID,PCI_ANY_ID}, | 1939 | {PCI_VDEVICE(TIGERJET, PCI_DEVICE_ID_TIGERJET_100) }, |
1940 | #endif | 1940 | #endif |
1941 | #if defined(CONFIG_HISAX_NETJET) || defined(CONFIG_HISAX_NETJET_U) | 1941 | #if defined(CONFIG_HISAX_NETJET) || defined(CONFIG_HISAX_NETJET_U) |
1942 | {PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300, PCI_ANY_ID,PCI_ANY_ID}, | 1942 | {PCI_VDEVICE(TIGERJET, PCI_DEVICE_ID_TIGERJET_300) }, |
1943 | #endif | 1943 | #endif |
1944 | #if defined(CONFIG_HISAX_TELESPCI) || defined(CONFIG_HISAX_SCT_QUADRO) | 1944 | #if defined(CONFIG_HISAX_TELESPCI) || defined(CONFIG_HISAX_SCT_QUADRO) |
1945 | {PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, PCI_ANY_ID,PCI_ANY_ID}, | 1945 | {PCI_VDEVICE(ZORAN, PCI_DEVICE_ID_ZORAN_36120) }, |
1946 | #endif | 1946 | #endif |
1947 | #ifdef CONFIG_HISAX_W6692 | 1947 | #ifdef CONFIG_HISAX_W6692 |
1948 | {PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH, PCI_ANY_ID,PCI_ANY_ID}, | 1948 | {PCI_VDEVICE(DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH) }, |
1949 | {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, PCI_ANY_ID,PCI_ANY_ID}, | 1949 | {PCI_VDEVICE(WINBOND2, PCI_DEVICE_ID_WINBOND2_6692) }, |
1950 | #endif | 1950 | #endif |
1951 | #ifdef CONFIG_HISAX_HFC_PCI | 1951 | #ifdef CONFIG_HISAX_HFC_PCI |
1952 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_2BD0, PCI_ANY_ID, PCI_ANY_ID}, | 1952 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_2BD0) }, |
1953 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B000, PCI_ANY_ID, PCI_ANY_ID}, | 1953 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B000) }, |
1954 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B006, PCI_ANY_ID, PCI_ANY_ID}, | 1954 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B006) }, |
1955 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B007, PCI_ANY_ID, PCI_ANY_ID}, | 1955 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B007) }, |
1956 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B008, PCI_ANY_ID, PCI_ANY_ID}, | 1956 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B008) }, |
1957 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B009, PCI_ANY_ID, PCI_ANY_ID}, | 1957 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B009) }, |
1958 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00A, PCI_ANY_ID, PCI_ANY_ID}, | 1958 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B00A) }, |
1959 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00B, PCI_ANY_ID, PCI_ANY_ID}, | 1959 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B00B) }, |
1960 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00C, PCI_ANY_ID, PCI_ANY_ID}, | 1960 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B00C) }, |
1961 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B100, PCI_ANY_ID, PCI_ANY_ID}, | 1961 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B100) }, |
1962 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B700, PCI_ANY_ID, PCI_ANY_ID}, | 1962 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B700) }, |
1963 | {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B701, PCI_ANY_ID, PCI_ANY_ID}, | 1963 | {PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_B701) }, |
1964 | {PCI_VENDOR_ID_ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1, PCI_ANY_ID, PCI_ANY_ID}, | 1964 | {PCI_VDEVICE(ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1) }, |
1965 | {PCI_VENDOR_ID_ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675, PCI_ANY_ID, PCI_ANY_ID}, | 1965 | {PCI_VDEVICE(ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675) }, |
1966 | {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT, PCI_ANY_ID, PCI_ANY_ID}, | 1966 | {PCI_VDEVICE(BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT) }, |
1967 | {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A1T, PCI_ANY_ID, PCI_ANY_ID}, | 1967 | {PCI_VDEVICE(BERKOM, PCI_DEVICE_ID_BERKOM_A1T) }, |
1968 | {PCI_VENDOR_ID_ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575, PCI_ANY_ID, PCI_ANY_ID}, | 1968 | {PCI_VDEVICE(ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575) }, |
1969 | {PCI_VENDOR_ID_ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0, PCI_ANY_ID, PCI_ANY_ID}, | 1969 | {PCI_VDEVICE(ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0) }, |
1970 | {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E, PCI_ANY_ID, PCI_ANY_ID}, | 1970 | {PCI_VDEVICE(DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E) }, |
1971 | {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_E, PCI_ANY_ID, PCI_ANY_ID}, | 1971 | {PCI_VDEVICE(DIGI, PCI_DEVICE_ID_DIGI_DF_M_E) }, |
1972 | {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A, PCI_ANY_ID, PCI_ANY_ID}, | 1972 | {PCI_VDEVICE(DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A) }, |
1973 | {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_A, PCI_ANY_ID, PCI_ANY_ID}, | 1973 | {PCI_VDEVICE(DIGI, PCI_DEVICE_ID_DIGI_DF_M_A) }, |
1974 | #endif | 1974 | #endif |
1975 | { } /* Terminating entry */ | 1975 | { } /* Terminating entry */ |
1976 | }; | 1976 | }; |
diff --git a/drivers/isdn/hisax/q931.c b/drivers/isdn/hisax/q931.c index 8b853d58e820..c0771f98fa11 100644 --- a/drivers/isdn/hisax/q931.c +++ b/drivers/isdn/hisax/q931.c | |||
@@ -1152,20 +1152,11 @@ QuickHex(char *txt, u_char * p, int cnt) | |||
1152 | { | 1152 | { |
1153 | register int i; | 1153 | register int i; |
1154 | register char *t = txt; | 1154 | register char *t = txt; |
1155 | register u_char w; | ||
1156 | 1155 | ||
1157 | for (i = 0; i < cnt; i++) { | 1156 | for (i = 0; i < cnt; i++) { |
1158 | *t++ = ' '; | 1157 | *t++ = ' '; |
1159 | w = (p[i] >> 4) & 0x0f; | 1158 | *t++ = hex_asc_hi(p[i]); |
1160 | if (w < 10) | 1159 | *t++ = hex_asc_lo(p[i]); |
1161 | *t++ = '0' + w; | ||
1162 | else | ||
1163 | *t++ = 'A' - 10 + w; | ||
1164 | w = p[i] & 0x0f; | ||
1165 | if (w < 10) | ||
1166 | *t++ = '0' + w; | ||
1167 | else | ||
1168 | *t++ = 'A' - 10 + w; | ||
1169 | } | 1160 | } |
1170 | *t++ = 0; | 1161 | *t++ = 0; |
1171 | return (t - txt); | 1162 | return (t - txt); |
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index 72eb92647c1b..feec8d89d719 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c | |||
@@ -187,12 +187,13 @@ void | |||
187 | hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) | 187 | hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) |
188 | { | 188 | { |
189 | struct net_local *lp = card->netif; | 189 | struct net_local *lp = card->netif; |
190 | struct net_device *dev = lp->dev; | 190 | struct net_device *dev; |
191 | struct sk_buff *skb; | 191 | struct sk_buff *skb; |
192 | 192 | ||
193 | if (!lp) | 193 | if (!lp) |
194 | return; /* non existing device */ | 194 | return; /* non existing device */ |
195 | 195 | ||
196 | dev = lp->dev; | ||
196 | dev->stats.rx_bytes += len; | 197 | dev->stats.rx_bytes += len; |
197 | 198 | ||
198 | skb = dev_alloc_skb(len); | 199 | skb = dev_alloc_skb(len); |
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 80966462d6dc..96b3e39c3356 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c | |||
@@ -17,11 +17,12 @@ | |||
17 | #include <linux/proc_fs.h> | 17 | #include <linux/proc_fs.h> |
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/smp_lock.h> | 20 | #include <linux/mutex.h> |
21 | #include <net/net_namespace.h> | 21 | #include <net/net_namespace.h> |
22 | 22 | ||
23 | #include "hysdn_defs.h" | 23 | #include "hysdn_defs.h" |
24 | 24 | ||
25 | static DEFINE_MUTEX(hysdn_conf_mutex); | ||
25 | static char *hysdn_procconf_revision = "$Revision: 1.8.6.4 $"; | 26 | static char *hysdn_procconf_revision = "$Revision: 1.8.6.4 $"; |
26 | 27 | ||
27 | #define INFO_OUT_LEN 80 /* length of info line including lf */ | 28 | #define INFO_OUT_LEN 80 /* length of info line including lf */ |
@@ -234,7 +235,7 @@ hysdn_conf_open(struct inode *ino, struct file *filep) | |||
234 | char *cp, *tmp; | 235 | char *cp, *tmp; |
235 | 236 | ||
236 | /* now search the addressed card */ | 237 | /* now search the addressed card */ |
237 | lock_kernel(); | 238 | mutex_lock(&hysdn_conf_mutex); |
238 | card = card_root; | 239 | card = card_root; |
239 | while (card) { | 240 | while (card) { |
240 | pd = card->procconf; | 241 | pd = card->procconf; |
@@ -243,7 +244,7 @@ hysdn_conf_open(struct inode *ino, struct file *filep) | |||
243 | card = card->next; /* search next entry */ | 244 | card = card->next; /* search next entry */ |
244 | } | 245 | } |
245 | if (!card) { | 246 | if (!card) { |
246 | unlock_kernel(); | 247 | mutex_unlock(&hysdn_conf_mutex); |
247 | return (-ENODEV); /* device is unknown/invalid */ | 248 | return (-ENODEV); /* device is unknown/invalid */ |
248 | } | 249 | } |
249 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) | 250 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) |
@@ -255,7 +256,7 @@ hysdn_conf_open(struct inode *ino, struct file *filep) | |||
255 | /* write only access -> write boot file or conf line */ | 256 | /* write only access -> write boot file or conf line */ |
256 | 257 | ||
257 | if (!(cnf = kmalloc(sizeof(struct conf_writedata), GFP_KERNEL))) { | 258 | if (!(cnf = kmalloc(sizeof(struct conf_writedata), GFP_KERNEL))) { |
258 | unlock_kernel(); | 259 | mutex_unlock(&hysdn_conf_mutex); |
259 | return (-EFAULT); | 260 | return (-EFAULT); |
260 | } | 261 | } |
261 | cnf->card = card; | 262 | cnf->card = card; |
@@ -267,7 +268,7 @@ hysdn_conf_open(struct inode *ino, struct file *filep) | |||
267 | /* read access -> output card info data */ | 268 | /* read access -> output card info data */ |
268 | 269 | ||
269 | if (!(tmp = kmalloc(INFO_OUT_LEN * 2 + 2, GFP_KERNEL))) { | 270 | if (!(tmp = kmalloc(INFO_OUT_LEN * 2 + 2, GFP_KERNEL))) { |
270 | unlock_kernel(); | 271 | mutex_unlock(&hysdn_conf_mutex); |
271 | return (-EFAULT); /* out of memory */ | 272 | return (-EFAULT); /* out of memory */ |
272 | } | 273 | } |
273 | filep->private_data = tmp; /* start of string */ | 274 | filep->private_data = tmp; /* start of string */ |
@@ -301,10 +302,10 @@ hysdn_conf_open(struct inode *ino, struct file *filep) | |||
301 | *cp++ = '\n'; | 302 | *cp++ = '\n'; |
302 | *cp = 0; /* end of string */ | 303 | *cp = 0; /* end of string */ |
303 | } else { /* simultaneous read/write access forbidden ! */ | 304 | } else { /* simultaneous read/write access forbidden ! */ |
304 | unlock_kernel(); | 305 | mutex_unlock(&hysdn_conf_mutex); |
305 | return (-EPERM); /* no permission this time */ | 306 | return (-EPERM); /* no permission this time */ |
306 | } | 307 | } |
307 | unlock_kernel(); | 308 | mutex_unlock(&hysdn_conf_mutex); |
308 | return nonseekable_open(ino, filep); | 309 | return nonseekable_open(ino, filep); |
309 | } /* hysdn_conf_open */ | 310 | } /* hysdn_conf_open */ |
310 | 311 | ||
@@ -319,7 +320,7 @@ hysdn_conf_close(struct inode *ino, struct file *filep) | |||
319 | int retval = 0; | 320 | int retval = 0; |
320 | struct proc_dir_entry *pd; | 321 | struct proc_dir_entry *pd; |
321 | 322 | ||
322 | lock_kernel(); | 323 | mutex_lock(&hysdn_conf_mutex); |
323 | /* search the addressed card */ | 324 | /* search the addressed card */ |
324 | card = card_root; | 325 | card = card_root; |
325 | while (card) { | 326 | while (card) { |
@@ -329,7 +330,7 @@ hysdn_conf_close(struct inode *ino, struct file *filep) | |||
329 | card = card->next; /* search next entry */ | 330 | card = card->next; /* search next entry */ |
330 | } | 331 | } |
331 | if (!card) { | 332 | if (!card) { |
332 | unlock_kernel(); | 333 | mutex_unlock(&hysdn_conf_mutex); |
333 | return (-ENODEV); /* device is unknown/invalid */ | 334 | return (-ENODEV); /* device is unknown/invalid */ |
334 | } | 335 | } |
335 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) | 336 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) |
@@ -352,7 +353,7 @@ hysdn_conf_close(struct inode *ino, struct file *filep) | |||
352 | 353 | ||
353 | kfree(filep->private_data); /* release memory */ | 354 | kfree(filep->private_data); /* release memory */ |
354 | } | 355 | } |
355 | unlock_kernel(); | 356 | mutex_unlock(&hysdn_conf_mutex); |
356 | return (retval); | 357 | return (retval); |
357 | } /* hysdn_conf_close */ | 358 | } /* hysdn_conf_close */ |
358 | 359 | ||
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index e83f6fda32fe..2ee93d04b2dd 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c | |||
@@ -15,13 +15,15 @@ | |||
15 | #include <linux/proc_fs.h> | 15 | #include <linux/proc_fs.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/smp_lock.h> | 18 | #include <linux/mutex.h> |
19 | #include <linux/kernel.h> | ||
19 | 20 | ||
20 | #include "hysdn_defs.h" | 21 | #include "hysdn_defs.h" |
21 | 22 | ||
22 | /* the proc subdir for the interface is defined in the procconf module */ | 23 | /* the proc subdir for the interface is defined in the procconf module */ |
23 | extern struct proc_dir_entry *hysdn_proc_entry; | 24 | extern struct proc_dir_entry *hysdn_proc_entry; |
24 | 25 | ||
26 | static DEFINE_MUTEX(hysdn_log_mutex); | ||
25 | static void put_log_buffer(hysdn_card * card, char *cp); | 27 | static void put_log_buffer(hysdn_card * card, char *cp); |
26 | 28 | ||
27 | /*************************************************/ | 29 | /*************************************************/ |
@@ -154,10 +156,9 @@ static ssize_t | |||
154 | hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) | 156 | hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) |
155 | { | 157 | { |
156 | unsigned long u = 0; | 158 | unsigned long u = 0; |
157 | int found = 0; | 159 | int rc; |
158 | unsigned char *cp, valbuf[128]; | 160 | unsigned char valbuf[128]; |
159 | long base = 10; | 161 | hysdn_card *card = file->private_data; |
160 | hysdn_card *card = (hysdn_card *) file->private_data; | ||
161 | 162 | ||
162 | if (count > (sizeof(valbuf) - 1)) | 163 | if (count > (sizeof(valbuf) - 1)) |
163 | count = sizeof(valbuf) - 1; /* limit length */ | 164 | count = sizeof(valbuf) - 1; /* limit length */ |
@@ -165,32 +166,10 @@ hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t | |||
165 | return (-EFAULT); /* copy failed */ | 166 | return (-EFAULT); /* copy failed */ |
166 | 167 | ||
167 | valbuf[count] = 0; /* terminating 0 */ | 168 | valbuf[count] = 0; /* terminating 0 */ |
168 | cp = valbuf; | ||
169 | if ((count > 2) && (valbuf[0] == '0') && (valbuf[1] == 'x')) { | ||
170 | cp += 2; /* pointer after hex modifier */ | ||
171 | base = 16; | ||
172 | } | ||
173 | /* scan the input for debug flags */ | ||
174 | while (*cp) { | ||
175 | if ((*cp >= '0') && (*cp <= '9')) { | ||
176 | found = 1; | ||
177 | u *= base; /* adjust to next digit */ | ||
178 | u += *cp++ - '0'; | ||
179 | continue; | ||
180 | } | ||
181 | if (base != 16) | ||
182 | break; /* end of number */ | ||
183 | |||
184 | if ((*cp >= 'a') && (*cp <= 'f')) { | ||
185 | found = 1; | ||
186 | u *= base; /* adjust to next digit */ | ||
187 | u += *cp++ - 'a' + 10; | ||
188 | continue; | ||
189 | } | ||
190 | break; /* terminated */ | ||
191 | } | ||
192 | 169 | ||
193 | if (found) { | 170 | rc = strict_strtoul(valbuf, 0, &u); |
171 | |||
172 | if (rc == 0) { | ||
194 | card->debug_flags = u; /* remember debug flags */ | 173 | card->debug_flags = u; /* remember debug flags */ |
195 | hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags); | 174 | hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags); |
196 | } | 175 | } |
@@ -251,7 +230,7 @@ hysdn_log_open(struct inode *ino, struct file *filep) | |||
251 | struct procdata *pd = NULL; | 230 | struct procdata *pd = NULL; |
252 | unsigned long flags; | 231 | unsigned long flags; |
253 | 232 | ||
254 | lock_kernel(); | 233 | mutex_lock(&hysdn_log_mutex); |
255 | card = card_root; | 234 | card = card_root; |
256 | while (card) { | 235 | while (card) { |
257 | pd = card->proclog; | 236 | pd = card->proclog; |
@@ -260,7 +239,7 @@ hysdn_log_open(struct inode *ino, struct file *filep) | |||
260 | card = card->next; /* search next entry */ | 239 | card = card->next; /* search next entry */ |
261 | } | 240 | } |
262 | if (!card) { | 241 | if (!card) { |
263 | unlock_kernel(); | 242 | mutex_unlock(&hysdn_log_mutex); |
264 | return (-ENODEV); /* device is unknown/invalid */ | 243 | return (-ENODEV); /* device is unknown/invalid */ |
265 | } | 244 | } |
266 | filep->private_data = card; /* remember our own card */ | 245 | filep->private_data = card; /* remember our own card */ |
@@ -278,10 +257,10 @@ hysdn_log_open(struct inode *ino, struct file *filep) | |||
278 | filep->private_data = &pd->log_head; | 257 | filep->private_data = &pd->log_head; |
279 | spin_unlock_irqrestore(&card->hysdn_lock, flags); | 258 | spin_unlock_irqrestore(&card->hysdn_lock, flags); |
280 | } else { /* simultaneous read/write access forbidden ! */ | 259 | } else { /* simultaneous read/write access forbidden ! */ |
281 | unlock_kernel(); | 260 | mutex_unlock(&hysdn_log_mutex); |
282 | return (-EPERM); /* no permission this time */ | 261 | return (-EPERM); /* no permission this time */ |
283 | } | 262 | } |
284 | unlock_kernel(); | 263 | mutex_unlock(&hysdn_log_mutex); |
285 | return nonseekable_open(ino, filep); | 264 | return nonseekable_open(ino, filep); |
286 | } /* hysdn_log_open */ | 265 | } /* hysdn_log_open */ |
287 | 266 | ||
@@ -300,7 +279,7 @@ hysdn_log_close(struct inode *ino, struct file *filep) | |||
300 | hysdn_card *card; | 279 | hysdn_card *card; |
301 | int retval = 0; | 280 | int retval = 0; |
302 | 281 | ||
303 | lock_kernel(); | 282 | mutex_lock(&hysdn_log_mutex); |
304 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { | 283 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { |
305 | /* write only access -> write debug level written */ | 284 | /* write only access -> write debug level written */ |
306 | retval = 0; /* success */ | 285 | retval = 0; /* success */ |
@@ -339,7 +318,7 @@ hysdn_log_close(struct inode *ino, struct file *filep) | |||
339 | kfree(inf); | 318 | kfree(inf); |
340 | } | 319 | } |
341 | } /* read access */ | 320 | } /* read access */ |
342 | unlock_kernel(); | 321 | mutex_unlock(&hysdn_log_mutex); |
343 | 322 | ||
344 | return (retval); | 323 | return (retval); |
345 | } /* hysdn_log_close */ | 324 | } /* hysdn_log_close */ |
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index a44cdb492ea9..15632bd2f643 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
19 | #include <linux/isdn.h> | 19 | #include <linux/isdn.h> |
20 | #include <linux/smp_lock.h> | 20 | #include <linux/mutex.h> |
21 | #include "isdn_common.h" | 21 | #include "isdn_common.h" |
22 | #include "isdn_tty.h" | 22 | #include "isdn_tty.h" |
23 | #include "isdn_net.h" | 23 | #include "isdn_net.h" |
@@ -42,6 +42,7 @@ MODULE_LICENSE("GPL"); | |||
42 | 42 | ||
43 | isdn_dev *dev; | 43 | isdn_dev *dev; |
44 | 44 | ||
45 | static DEFINE_MUTEX(isdn_mutex); | ||
45 | static char *isdn_revision = "$Revision: 1.1.2.3 $"; | 46 | static char *isdn_revision = "$Revision: 1.1.2.3 $"; |
46 | 47 | ||
47 | extern char *isdn_net_revision; | 48 | extern char *isdn_net_revision; |
@@ -1070,7 +1071,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off) | |||
1070 | int retval; | 1071 | int retval; |
1071 | char *p; | 1072 | char *p; |
1072 | 1073 | ||
1073 | lock_kernel(); | 1074 | mutex_lock(&isdn_mutex); |
1074 | if (minor == ISDN_MINOR_STATUS) { | 1075 | if (minor == ISDN_MINOR_STATUS) { |
1075 | if (!file->private_data) { | 1076 | if (!file->private_data) { |
1076 | if (file->f_flags & O_NONBLOCK) { | 1077 | if (file->f_flags & O_NONBLOCK) { |
@@ -1163,7 +1164,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off) | |||
1163 | #endif | 1164 | #endif |
1164 | retval = -ENODEV; | 1165 | retval = -ENODEV; |
1165 | out: | 1166 | out: |
1166 | unlock_kernel(); | 1167 | mutex_unlock(&isdn_mutex); |
1167 | return retval; | 1168 | return retval; |
1168 | } | 1169 | } |
1169 | 1170 | ||
@@ -1180,7 +1181,7 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off | |||
1180 | if (!dev->drivers) | 1181 | if (!dev->drivers) |
1181 | return -ENODEV; | 1182 | return -ENODEV; |
1182 | 1183 | ||
1183 | lock_kernel(); | 1184 | mutex_lock(&isdn_mutex); |
1184 | if (minor <= ISDN_MINOR_BMAX) { | 1185 | if (minor <= ISDN_MINOR_BMAX) { |
1185 | printk(KERN_WARNING "isdn_write minor %d obsolete!\n", minor); | 1186 | printk(KERN_WARNING "isdn_write minor %d obsolete!\n", minor); |
1186 | drvidx = isdn_minor2drv(minor); | 1187 | drvidx = isdn_minor2drv(minor); |
@@ -1225,7 +1226,7 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off | |||
1225 | #endif | 1226 | #endif |
1226 | retval = -ENODEV; | 1227 | retval = -ENODEV; |
1227 | out: | 1228 | out: |
1228 | unlock_kernel(); | 1229 | mutex_unlock(&isdn_mutex); |
1229 | return retval; | 1230 | return retval; |
1230 | } | 1231 | } |
1231 | 1232 | ||
@@ -1236,7 +1237,7 @@ isdn_poll(struct file *file, poll_table * wait) | |||
1236 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 1237 | unsigned int minor = iminor(file->f_path.dentry->d_inode); |
1237 | int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); | 1238 | int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); |
1238 | 1239 | ||
1239 | lock_kernel(); | 1240 | mutex_lock(&isdn_mutex); |
1240 | if (minor == ISDN_MINOR_STATUS) { | 1241 | if (minor == ISDN_MINOR_STATUS) { |
1241 | poll_wait(file, &(dev->info_waitq), wait); | 1242 | poll_wait(file, &(dev->info_waitq), wait); |
1242 | /* mask = POLLOUT | POLLWRNORM; */ | 1243 | /* mask = POLLOUT | POLLWRNORM; */ |
@@ -1266,7 +1267,7 @@ isdn_poll(struct file *file, poll_table * wait) | |||
1266 | #endif | 1267 | #endif |
1267 | mask = POLLERR; | 1268 | mask = POLLERR; |
1268 | out: | 1269 | out: |
1269 | unlock_kernel(); | 1270 | mutex_unlock(&isdn_mutex); |
1270 | return mask; | 1271 | return mask; |
1271 | } | 1272 | } |
1272 | 1273 | ||
@@ -1727,9 +1728,9 @@ isdn_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1727 | { | 1728 | { |
1728 | int ret; | 1729 | int ret; |
1729 | 1730 | ||
1730 | lock_kernel(); | 1731 | mutex_lock(&isdn_mutex); |
1731 | ret = isdn_ioctl(file, cmd, arg); | 1732 | ret = isdn_ioctl(file, cmd, arg); |
1732 | unlock_kernel(); | 1733 | mutex_unlock(&isdn_mutex); |
1733 | 1734 | ||
1734 | return ret; | 1735 | return ret; |
1735 | } | 1736 | } |
@@ -1745,7 +1746,7 @@ isdn_open(struct inode *ino, struct file *filep) | |||
1745 | int chidx; | 1746 | int chidx; |
1746 | int retval = -ENODEV; | 1747 | int retval = -ENODEV; |
1747 | 1748 | ||
1748 | lock_kernel(); | 1749 | mutex_lock(&isdn_mutex); |
1749 | if (minor == ISDN_MINOR_STATUS) { | 1750 | if (minor == ISDN_MINOR_STATUS) { |
1750 | infostruct *p; | 1751 | infostruct *p; |
1751 | 1752 | ||
@@ -1796,7 +1797,7 @@ isdn_open(struct inode *ino, struct file *filep) | |||
1796 | #endif | 1797 | #endif |
1797 | out: | 1798 | out: |
1798 | nonseekable_open(ino, filep); | 1799 | nonseekable_open(ino, filep); |
1799 | unlock_kernel(); | 1800 | mutex_unlock(&isdn_mutex); |
1800 | return retval; | 1801 | return retval; |
1801 | } | 1802 | } |
1802 | 1803 | ||
@@ -1805,7 +1806,7 @@ isdn_close(struct inode *ino, struct file *filep) | |||
1805 | { | 1806 | { |
1806 | uint minor = iminor(ino); | 1807 | uint minor = iminor(ino); |
1807 | 1808 | ||
1808 | lock_kernel(); | 1809 | mutex_lock(&isdn_mutex); |
1809 | if (minor == ISDN_MINOR_STATUS) { | 1810 | if (minor == ISDN_MINOR_STATUS) { |
1810 | infostruct *p = dev->infochain; | 1811 | infostruct *p = dev->infochain; |
1811 | infostruct *q = NULL; | 1812 | infostruct *q = NULL; |
@@ -1839,7 +1840,7 @@ isdn_close(struct inode *ino, struct file *filep) | |||
1839 | #endif | 1840 | #endif |
1840 | 1841 | ||
1841 | out: | 1842 | out: |
1842 | unlock_kernel(); | 1843 | mutex_unlock(&isdn_mutex); |
1843 | return 0; | 1844 | return 0; |
1844 | } | 1845 | } |
1845 | 1846 | ||
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 8c85d1e88cc6..26d44c3ca1d8 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -2924,16 +2924,17 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg) | |||
2924 | cfg->dialtimeout = lp->dialtimeout >= 0 ? lp->dialtimeout / HZ : -1; | 2924 | cfg->dialtimeout = lp->dialtimeout >= 0 ? lp->dialtimeout / HZ : -1; |
2925 | cfg->dialwait = lp->dialwait / HZ; | 2925 | cfg->dialwait = lp->dialwait / HZ; |
2926 | if (lp->slave) { | 2926 | if (lp->slave) { |
2927 | if (strlen(lp->slave->name) > 8) | 2927 | if (strlen(lp->slave->name) >= 10) |
2928 | strcpy(cfg->slave, "too-long"); | 2928 | strcpy(cfg->slave, "too-long"); |
2929 | else | 2929 | else |
2930 | strcpy(cfg->slave, lp->slave->name); | 2930 | strcpy(cfg->slave, lp->slave->name); |
2931 | } else | 2931 | } else |
2932 | cfg->slave[0] = '\0'; | 2932 | cfg->slave[0] = '\0'; |
2933 | if (lp->master) { | 2933 | if (lp->master) { |
2934 | if (strlen(lp->master->name) > 8) | 2934 | if (strlen(lp->master->name) >= 10) |
2935 | strcpy(cfg->master, "too-long"); | 2935 | strcpy(cfg->master, "too-long"); |
2936 | strcpy(cfg->master, lp->master->name); | 2936 | else |
2937 | strcpy(cfg->master, lp->master->name); | ||
2937 | } else | 2938 | } else |
2938 | cfg->master[0] = '\0'; | 2939 | cfg->master[0] = '\0'; |
2939 | return 0; | 2940 | return 0; |
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 8c46baee621b..fe824e0cbb25 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
@@ -477,7 +477,7 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg) | |||
477 | struct isdn_ppp_comp_data data; | 477 | struct isdn_ppp_comp_data data; |
478 | void __user *argp = (void __user *)arg; | 478 | void __user *argp = (void __user *)arg; |
479 | 479 | ||
480 | is = (struct ippp_struct *) file->private_data; | 480 | is = file->private_data; |
481 | lp = is->lp; | 481 | lp = is->lp; |
482 | 482 | ||
483 | if (is->debug & 0x1) | 483 | if (is->debug & 0x1) |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index fc8454d2eea5..51dc60da333b 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -2636,12 +2636,6 @@ isdn_tty_modem_result(int code, modem_info * info) | |||
2636 | if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) { | 2636 | if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) { |
2637 | return; | 2637 | return; |
2638 | } | 2638 | } |
2639 | #ifdef CONFIG_ISDN_AUDIO | ||
2640 | if ( !info->vonline ) | ||
2641 | tty_ldisc_flush(info->tty); | ||
2642 | #else | ||
2643 | tty_ldisc_flush(info->tty); | ||
2644 | #endif | ||
2645 | if ((info->flags & ISDN_ASYNC_CHECK_CD) && | 2639 | if ((info->flags & ISDN_ASYNC_CHECK_CD) && |
2646 | (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) && | 2640 | (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) && |
2647 | (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) { | 2641 | (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) { |
diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c index 81048b8ed8ad..de43c8c70ad0 100644 --- a/drivers/isdn/mISDN/timerdev.c +++ b/drivers/isdn/mISDN/timerdev.c | |||
@@ -24,9 +24,10 @@ | |||
24 | #include <linux/miscdevice.h> | 24 | #include <linux/miscdevice.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/mISDNif.h> | 26 | #include <linux/mISDNif.h> |
27 | #include <linux/smp_lock.h> | 27 | #include <linux/mutex.h> |
28 | #include "core.h" | 28 | #include "core.h" |
29 | 29 | ||
30 | static DEFINE_MUTEX(mISDN_mutex); | ||
30 | static u_int *debug; | 31 | static u_int *debug; |
31 | 32 | ||
32 | 33 | ||
@@ -224,7 +225,7 @@ mISDN_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) | |||
224 | if (*debug & DEBUG_TIMER) | 225 | if (*debug & DEBUG_TIMER) |
225 | printk(KERN_DEBUG "%s(%p, %x, %lx)\n", __func__, | 226 | printk(KERN_DEBUG "%s(%p, %x, %lx)\n", __func__, |
226 | filep, cmd, arg); | 227 | filep, cmd, arg); |
227 | lock_kernel(); | 228 | mutex_lock(&mISDN_mutex); |
228 | switch (cmd) { | 229 | switch (cmd) { |
229 | case IMADDTIMER: | 230 | case IMADDTIMER: |
230 | if (get_user(tout, (int __user *)arg)) { | 231 | if (get_user(tout, (int __user *)arg)) { |
@@ -256,7 +257,7 @@ mISDN_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) | |||
256 | default: | 257 | default: |
257 | ret = -EINVAL; | 258 | ret = -EINVAL; |
258 | } | 259 | } |
259 | unlock_kernel(); | 260 | mutex_unlock(&mISDN_mutex); |
260 | return ret; | 261 | return ret; |
261 | } | 262 | } |
262 | 263 | ||