diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-08 14:59:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-08 14:59:30 -0400 |
commit | 5587481e92105734e8e45a24fd8603228ec02449 (patch) | |
tree | 2de22ddd94e21f681825de002887f3cc89118edd /drivers/isdn | |
parent | df87f344efac96cb9f9367e82509208216f1e0fa (diff) | |
parent | a4d63a943735efa30270ce70716d43323fd40f02 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (40 commits)
ethoc: limit the number of buffers to 128
ethoc: use system memory as buffer
ethoc: align received packet to make IP header at word boundary
ethoc: fix buffer address mapping
ethoc: fix typo to compute number of tx descriptors
au1000_eth: Duplicate test of RX_OVERLEN bit in update_rx_stats()
netxen: Fix Unlikely(x) > y
pasemi_mac: ethtool get settings fix
add maintainer for network drop monitor kernel service
tg3: Fix phylib locking strategy
rndis_host: support ETHTOOL_GPERMADDR
ipv4: arp_notify address list bug
gigaset: add kerneldoc comments
gigaset: correct debugging output selection
gigaset: improve error recovery
gigaset: fix device ERROR response handling
gigaset: announce if built with debugging
gigaset: handle isoc frame errors more gracefully
gigaset: linearize skb
gigaset: fix reject/hangup handling
...
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/capi/capi.c | 2 | ||||
-rw-r--r-- | drivers/isdn/capi/capidrv.c | 27 | ||||
-rw-r--r-- | drivers/isdn/gigaset/asyncdata.c | 28 | ||||
-rw-r--r-- | drivers/isdn/gigaset/bas-gigaset.c | 87 | ||||
-rw-r--r-- | drivers/isdn/gigaset/common.c | 134 | ||||
-rw-r--r-- | drivers/isdn/gigaset/ev-layer.c | 30 | ||||
-rw-r--r-- | drivers/isdn/gigaset/i4l.c | 23 | ||||
-rw-r--r-- | drivers/isdn/gigaset/interface.c | 9 | ||||
-rw-r--r-- | drivers/isdn/gigaset/isocdata.c | 30 |
9 files changed, 265 insertions, 105 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 2d8352419c0d..65bf91e16a42 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -603,7 +603,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) | |||
603 | 603 | ||
604 | if (CAPIMSG_CMD(skb->data) == CAPI_CONNECT_B3_CONF) { | 604 | if (CAPIMSG_CMD(skb->data) == CAPI_CONNECT_B3_CONF) { |
605 | u16 info = CAPIMSG_U16(skb->data, 12); // Info field | 605 | u16 info = CAPIMSG_U16(skb->data, 12); // Info field |
606 | if (info == 0) { | 606 | if ((info & 0xff00) == 0) { |
607 | mutex_lock(&cdev->ncci_list_mtx); | 607 | mutex_lock(&cdev->ncci_list_mtx); |
608 | capincci_alloc(cdev, CAPIMSG_NCCI(skb->data)); | 608 | capincci_alloc(cdev, CAPIMSG_NCCI(skb->data)); |
609 | mutex_unlock(&cdev->ncci_list_mtx); | 609 | mutex_unlock(&cdev->ncci_list_mtx); |
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c index 650120261abf..3e6d17f42a98 100644 --- a/drivers/isdn/capi/capidrv.c +++ b/drivers/isdn/capi/capidrv.c | |||
@@ -40,7 +40,7 @@ static int debugmode = 0; | |||
40 | MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux"); | 40 | MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux"); |
41 | MODULE_AUTHOR("Carsten Paeth"); | 41 | MODULE_AUTHOR("Carsten Paeth"); |
42 | MODULE_LICENSE("GPL"); | 42 | MODULE_LICENSE("GPL"); |
43 | module_param(debugmode, uint, 0); | 43 | module_param(debugmode, uint, S_IRUGO|S_IWUSR); |
44 | 44 | ||
45 | /* -------- type definitions ----------------------------------------- */ | 45 | /* -------- type definitions ----------------------------------------- */ |
46 | 46 | ||
@@ -671,8 +671,8 @@ static void n0(capidrv_contr * card, capidrv_ncci * ncci) | |||
671 | NULL, /* Useruserdata */ /* $$$$ */ | 671 | NULL, /* Useruserdata */ /* $$$$ */ |
672 | NULL /* Facilitydataarray */ | 672 | NULL /* Facilitydataarray */ |
673 | ); | 673 | ); |
674 | send_message(card, &cmsg); | ||
675 | plci_change_state(card, ncci->plcip, EV_PLCI_DISCONNECT_REQ); | 674 | plci_change_state(card, ncci->plcip, EV_PLCI_DISCONNECT_REQ); |
675 | send_message(card, &cmsg); | ||
676 | 676 | ||
677 | cmd.command = ISDN_STAT_BHUP; | 677 | cmd.command = ISDN_STAT_BHUP; |
678 | cmd.driver = card->myid; | 678 | cmd.driver = card->myid; |
@@ -924,8 +924,8 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) | |||
924 | */ | 924 | */ |
925 | capi_cmsg_answer(cmsg); | 925 | capi_cmsg_answer(cmsg); |
926 | cmsg->Reject = 1; /* ignore */ | 926 | cmsg->Reject = 1; /* ignore */ |
927 | send_message(card, cmsg); | ||
928 | plci_change_state(card, plcip, EV_PLCI_CONNECT_REJECT); | 927 | plci_change_state(card, plcip, EV_PLCI_CONNECT_REJECT); |
928 | send_message(card, cmsg); | ||
929 | printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s ignored\n", | 929 | printk(KERN_INFO "capidrv-%d: incoming call %s,%d,%d,%s ignored\n", |
930 | card->contrnr, | 930 | card->contrnr, |
931 | cmd.parm.setup.phone, | 931 | cmd.parm.setup.phone, |
@@ -974,8 +974,8 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) | |||
974 | case 2: /* Call will be rejected. */ | 974 | case 2: /* Call will be rejected. */ |
975 | capi_cmsg_answer(cmsg); | 975 | capi_cmsg_answer(cmsg); |
976 | cmsg->Reject = 2; /* reject call, normal call clearing */ | 976 | cmsg->Reject = 2; /* reject call, normal call clearing */ |
977 | send_message(card, cmsg); | ||
978 | plci_change_state(card, plcip, EV_PLCI_CONNECT_REJECT); | 977 | plci_change_state(card, plcip, EV_PLCI_CONNECT_REJECT); |
978 | send_message(card, cmsg); | ||
979 | break; | 979 | break; |
980 | 980 | ||
981 | default: | 981 | default: |
@@ -983,8 +983,8 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) | |||
983 | capi_cmsg_answer(cmsg); | 983 | capi_cmsg_answer(cmsg); |
984 | cmsg->Reject = 8; /* reject call, | 984 | cmsg->Reject = 8; /* reject call, |
985 | destination out of order */ | 985 | destination out of order */ |
986 | send_message(card, cmsg); | ||
987 | plci_change_state(card, plcip, EV_PLCI_CONNECT_REJECT); | 986 | plci_change_state(card, plcip, EV_PLCI_CONNECT_REJECT); |
987 | send_message(card, cmsg); | ||
988 | break; | 988 | break; |
989 | } | 989 | } |
990 | return; | 990 | return; |
@@ -1020,8 +1020,8 @@ static void handle_plci(_cmsg * cmsg) | |||
1020 | card->bchans[plcip->chan].disconnecting = 1; | 1020 | card->bchans[plcip->chan].disconnecting = 1; |
1021 | plci_change_state(card, plcip, EV_PLCI_DISCONNECT_IND); | 1021 | plci_change_state(card, plcip, EV_PLCI_DISCONNECT_IND); |
1022 | capi_cmsg_answer(cmsg); | 1022 | capi_cmsg_answer(cmsg); |
1023 | send_message(card, cmsg); | ||
1024 | plci_change_state(card, plcip, EV_PLCI_DISCONNECT_RESP); | 1023 | plci_change_state(card, plcip, EV_PLCI_DISCONNECT_RESP); |
1024 | send_message(card, cmsg); | ||
1025 | break; | 1025 | break; |
1026 | 1026 | ||
1027 | case CAPI_DISCONNECT_CONF: /* plci */ | 1027 | case CAPI_DISCONNECT_CONF: /* plci */ |
@@ -1078,8 +1078,8 @@ static void handle_plci(_cmsg * cmsg) | |||
1078 | 1078 | ||
1079 | if (card->bchans[plcip->chan].incoming) { | 1079 | if (card->bchans[plcip->chan].incoming) { |
1080 | capi_cmsg_answer(cmsg); | 1080 | capi_cmsg_answer(cmsg); |
1081 | send_message(card, cmsg); | ||
1082 | plci_change_state(card, plcip, EV_PLCI_CONNECT_ACTIVE_IND); | 1081 | plci_change_state(card, plcip, EV_PLCI_CONNECT_ACTIVE_IND); |
1082 | send_message(card, cmsg); | ||
1083 | } else { | 1083 | } else { |
1084 | capidrv_ncci *nccip; | 1084 | capidrv_ncci *nccip; |
1085 | capi_cmsg_answer(cmsg); | 1085 | capi_cmsg_answer(cmsg); |
@@ -1098,13 +1098,14 @@ static void handle_plci(_cmsg * cmsg) | |||
1098 | NULL /* NCPI */ | 1098 | NULL /* NCPI */ |
1099 | ); | 1099 | ); |
1100 | nccip->msgid = cmsg->Messagenumber; | 1100 | nccip->msgid = cmsg->Messagenumber; |
1101 | plci_change_state(card, plcip, | ||
1102 | EV_PLCI_CONNECT_ACTIVE_IND); | ||
1103 | ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_REQ); | ||
1101 | send_message(card, cmsg); | 1104 | send_message(card, cmsg); |
1102 | cmd.command = ISDN_STAT_DCONN; | 1105 | cmd.command = ISDN_STAT_DCONN; |
1103 | cmd.driver = card->myid; | 1106 | cmd.driver = card->myid; |
1104 | cmd.arg = plcip->chan; | 1107 | cmd.arg = plcip->chan; |
1105 | card->interface.statcallb(&cmd); | 1108 | card->interface.statcallb(&cmd); |
1106 | plci_change_state(card, plcip, EV_PLCI_CONNECT_ACTIVE_IND); | ||
1107 | ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_REQ); | ||
1108 | } | 1109 | } |
1109 | break; | 1110 | break; |
1110 | 1111 | ||
@@ -1193,8 +1194,8 @@ static void handle_ncci(_cmsg * cmsg) | |||
1193 | goto notfound; | 1194 | goto notfound; |
1194 | 1195 | ||
1195 | capi_cmsg_answer(cmsg); | 1196 | capi_cmsg_answer(cmsg); |
1196 | send_message(card, cmsg); | ||
1197 | ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_ACTIVE_IND); | 1197 | ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_ACTIVE_IND); |
1198 | send_message(card, cmsg); | ||
1198 | 1199 | ||
1199 | cmd.command = ISDN_STAT_BCONN; | 1200 | cmd.command = ISDN_STAT_BCONN; |
1200 | cmd.driver = card->myid; | 1201 | cmd.driver = card->myid; |
@@ -1222,8 +1223,8 @@ static void handle_ncci(_cmsg * cmsg) | |||
1222 | 0, /* Reject */ | 1223 | 0, /* Reject */ |
1223 | NULL /* NCPI */ | 1224 | NULL /* NCPI */ |
1224 | ); | 1225 | ); |
1225 | send_message(card, cmsg); | ||
1226 | ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_RESP); | 1226 | ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_RESP); |
1227 | send_message(card, cmsg); | ||
1227 | break; | 1228 | break; |
1228 | } | 1229 | } |
1229 | printk(KERN_ERR "capidrv-%d: no mem for ncci, sorry\n", card->contrnr); | 1230 | printk(KERN_ERR "capidrv-%d: no mem for ncci, sorry\n", card->contrnr); |
@@ -1299,8 +1300,8 @@ static void handle_ncci(_cmsg * cmsg) | |||
1299 | card->bchans[nccip->chan].disconnecting = 1; | 1300 | card->bchans[nccip->chan].disconnecting = 1; |
1300 | ncci_change_state(card, nccip, EV_NCCI_DISCONNECT_B3_IND); | 1301 | ncci_change_state(card, nccip, EV_NCCI_DISCONNECT_B3_IND); |
1301 | capi_cmsg_answer(cmsg); | 1302 | capi_cmsg_answer(cmsg); |
1302 | send_message(card, cmsg); | ||
1303 | ncci_change_state(card, nccip, EV_NCCI_DISCONNECT_B3_RESP); | 1303 | ncci_change_state(card, nccip, EV_NCCI_DISCONNECT_B3_RESP); |
1304 | send_message(card, cmsg); | ||
1304 | break; | 1305 | break; |
1305 | 1306 | ||
1306 | case CAPI_DISCONNECT_B3_CONF: /* ncci */ | 1307 | case CAPI_DISCONNECT_B3_CONF: /* ncci */ |
@@ -2014,8 +2015,8 @@ static void send_listen(capidrv_contr *card) | |||
2014 | card->cipmask, | 2015 | card->cipmask, |
2015 | card->cipmask2, | 2016 | card->cipmask2, |
2016 | NULL, NULL); | 2017 | NULL, NULL); |
2017 | send_message(card, &cmdcmsg); | ||
2018 | listen_change_state(card, EV_LISTEN_REQ); | 2018 | listen_change_state(card, EV_LISTEN_REQ); |
2019 | send_message(card, &cmdcmsg); | ||
2019 | } | 2020 | } |
2020 | 2021 | ||
2021 | static void listentimerfunc(unsigned long x) | 2022 | static void listentimerfunc(unsigned long x) |
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c index 234cc5d53312..44a58e6f8f65 100644 --- a/drivers/isdn/gigaset/asyncdata.c +++ b/drivers/isdn/gigaset/asyncdata.c | |||
@@ -334,7 +334,14 @@ static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes, | |||
334 | return startbytes - numbytes; | 334 | return startbytes - numbytes; |
335 | } | 335 | } |
336 | 336 | ||
337 | /* process a block of data received from the device | 337 | /** |
338 | * gigaset_m10x_input() - process a block of data received from the device | ||
339 | * @inbuf: received data and device descriptor structure. | ||
340 | * | ||
341 | * Called by hardware module {ser,usb}_gigaset with a block of received | ||
342 | * bytes. Separates the bytes received over the serial data channel into | ||
343 | * user data and command replies (locked/unlocked) according to the | ||
344 | * current state of the interface. | ||
338 | */ | 345 | */ |
339 | void gigaset_m10x_input(struct inbuf_t *inbuf) | 346 | void gigaset_m10x_input(struct inbuf_t *inbuf) |
340 | { | 347 | { |
@@ -543,16 +550,17 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb, int head, int tail) | |||
543 | return iraw_skb; | 550 | return iraw_skb; |
544 | } | 551 | } |
545 | 552 | ||
546 | /* gigaset_send_skb | 553 | /** |
547 | * called by common.c to queue an skb for sending | 554 | * gigaset_m10x_send_skb() - queue an skb for sending |
548 | * and start transmission if necessary | 555 | * @bcs: B channel descriptor structure. |
549 | * parameters: | 556 | * @skb: data to send. |
550 | * B Channel control structure | 557 | * |
551 | * skb | 558 | * Called by i4l.c to encode and queue an skb for sending, and start |
559 | * transmission if necessary. | ||
560 | * | ||
552 | * Return value: | 561 | * Return value: |
553 | * number of bytes accepted for sending | 562 | * number of bytes accepted for sending (skb->len) if ok, |
554 | * (skb->len if ok, 0 if out of buffer space) | 563 | * error code < 0 (eg. -ENOMEM) on error |
555 | * or error code (< 0, eg. -EINVAL) | ||
556 | */ | 564 | */ |
557 | int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb) | 565 | int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb) |
558 | { | 566 | { |
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 781c4041f7b0..5ed1d99eb9f3 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -134,6 +134,7 @@ struct bas_cardstate { | |||
134 | #define BS_ATRDPEND 0x040 /* urb_cmd_in in use */ | 134 | #define BS_ATRDPEND 0x040 /* urb_cmd_in in use */ |
135 | #define BS_ATWRPEND 0x080 /* urb_cmd_out in use */ | 135 | #define BS_ATWRPEND 0x080 /* urb_cmd_out in use */ |
136 | #define BS_SUSPEND 0x100 /* USB port suspended */ | 136 | #define BS_SUSPEND 0x100 /* USB port suspended */ |
137 | #define BS_RESETTING 0x200 /* waiting for HD_RESET_INTERRUPT_PIPE_ACK */ | ||
137 | 138 | ||
138 | 139 | ||
139 | static struct gigaset_driver *driver = NULL; | 140 | static struct gigaset_driver *driver = NULL; |
@@ -319,6 +320,21 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) | |||
319 | return -EINVAL; | 320 | return -EINVAL; |
320 | } | 321 | } |
321 | 322 | ||
323 | /* set/clear bits in base connection state, return previous state | ||
324 | */ | ||
325 | static inline int update_basstate(struct bas_cardstate *ucs, | ||
326 | int set, int clear) | ||
327 | { | ||
328 | unsigned long flags; | ||
329 | int state; | ||
330 | |||
331 | spin_lock_irqsave(&ucs->lock, flags); | ||
332 | state = ucs->basstate; | ||
333 | ucs->basstate = (state & ~clear) | set; | ||
334 | spin_unlock_irqrestore(&ucs->lock, flags); | ||
335 | return state; | ||
336 | } | ||
337 | |||
322 | /* error_hangup | 338 | /* error_hangup |
323 | * hang up any existing connection because of an unrecoverable error | 339 | * hang up any existing connection because of an unrecoverable error |
324 | * This function may be called from any context and takes care of scheduling | 340 | * This function may be called from any context and takes care of scheduling |
@@ -350,12 +366,9 @@ static inline void error_hangup(struct bc_state *bcs) | |||
350 | */ | 366 | */ |
351 | static inline void error_reset(struct cardstate *cs) | 367 | static inline void error_reset(struct cardstate *cs) |
352 | { | 368 | { |
353 | /* close AT command channel to recover (ignore errors) */ | 369 | /* reset interrupt pipe to recover (ignore errors) */ |
354 | req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT); | 370 | update_basstate(cs->hw.bas, BS_RESETTING, 0); |
355 | 371 | req_submit(cs->bcs, HD_RESET_INTERRUPT_PIPE, 0, BAS_TIMEOUT); | |
356 | //FIXME try to recover without bothering the user | ||
357 | dev_err(cs->dev, | ||
358 | "unrecoverable error - please disconnect Gigaset base to reset\n"); | ||
359 | } | 372 | } |
360 | 373 | ||
361 | /* check_pending | 374 | /* check_pending |
@@ -398,8 +411,13 @@ static void check_pending(struct bas_cardstate *ucs) | |||
398 | case HD_DEVICE_INIT_ACK: /* no reply expected */ | 411 | case HD_DEVICE_INIT_ACK: /* no reply expected */ |
399 | ucs->pending = 0; | 412 | ucs->pending = 0; |
400 | break; | 413 | break; |
401 | /* HD_READ_ATMESSAGE, HD_WRITE_ATMESSAGE, HD_RESET_INTERRUPTPIPE | 414 | case HD_RESET_INTERRUPT_PIPE: |
402 | * are handled separately and should never end up here | 415 | if (!(ucs->basstate & BS_RESETTING)) |
416 | ucs->pending = 0; | ||
417 | break; | ||
418 | /* | ||
419 | * HD_READ_ATMESSAGE and HD_WRITE_ATMESSAGE are handled separately | ||
420 | * and should never end up here | ||
403 | */ | 421 | */ |
404 | default: | 422 | default: |
405 | dev_warn(&ucs->interface->dev, | 423 | dev_warn(&ucs->interface->dev, |
@@ -449,21 +467,6 @@ static void cmd_in_timeout(unsigned long data) | |||
449 | error_reset(cs); | 467 | error_reset(cs); |
450 | } | 468 | } |
451 | 469 | ||
452 | /* set/clear bits in base connection state, return previous state | ||
453 | */ | ||
454 | inline static int update_basstate(struct bas_cardstate *ucs, | ||
455 | int set, int clear) | ||
456 | { | ||
457 | unsigned long flags; | ||
458 | int state; | ||
459 | |||
460 | spin_lock_irqsave(&ucs->lock, flags); | ||
461 | state = ucs->basstate; | ||
462 | ucs->basstate = (state & ~clear) | set; | ||
463 | spin_unlock_irqrestore(&ucs->lock, flags); | ||
464 | return state; | ||
465 | } | ||
466 | |||
467 | /* read_ctrl_callback | 470 | /* read_ctrl_callback |
468 | * USB completion handler for control pipe input | 471 | * USB completion handler for control pipe input |
469 | * called by the USB subsystem in interrupt context | 472 | * called by the USB subsystem in interrupt context |
@@ -762,7 +765,8 @@ static void read_int_callback(struct urb *urb) | |||
762 | break; | 765 | break; |
763 | 766 | ||
764 | case HD_RESET_INTERRUPT_PIPE_ACK: | 767 | case HD_RESET_INTERRUPT_PIPE_ACK: |
765 | gig_dbg(DEBUG_USBREQ, "HD_RESET_INTERRUPT_PIPE_ACK"); | 768 | update_basstate(ucs, 0, BS_RESETTING); |
769 | dev_notice(cs->dev, "interrupt pipe reset\n"); | ||
766 | break; | 770 | break; |
767 | 771 | ||
768 | case HD_SUSPEND_END: | 772 | case HD_SUSPEND_END: |
@@ -1331,28 +1335,24 @@ static void read_iso_tasklet(unsigned long data) | |||
1331 | rcvbuf = urb->transfer_buffer; | 1335 | rcvbuf = urb->transfer_buffer; |
1332 | totleft = urb->actual_length; | 1336 | totleft = urb->actual_length; |
1333 | for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { | 1337 | for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { |
1334 | if (unlikely(urb->iso_frame_desc[frame].status)) { | 1338 | numbytes = urb->iso_frame_desc[frame].actual_length; |
1339 | if (unlikely(urb->iso_frame_desc[frame].status)) | ||
1335 | dev_warn(cs->dev, | 1340 | dev_warn(cs->dev, |
1336 | "isochronous read: frame %d: %s\n", | 1341 | "isochronous read: frame %d[%d]: %s\n", |
1337 | frame, | 1342 | frame, numbytes, |
1338 | get_usb_statmsg( | 1343 | get_usb_statmsg( |
1339 | urb->iso_frame_desc[frame].status)); | 1344 | urb->iso_frame_desc[frame].status)); |
1340 | break; | 1345 | if (unlikely(numbytes > BAS_MAXFRAME)) |
1341 | } | ||
1342 | numbytes = urb->iso_frame_desc[frame].actual_length; | ||
1343 | if (unlikely(numbytes > BAS_MAXFRAME)) { | ||
1344 | dev_warn(cs->dev, | 1346 | dev_warn(cs->dev, |
1345 | "isochronous read: frame %d: " | 1347 | "isochronous read: frame %d: " |
1346 | "numbytes (%d) > BAS_MAXFRAME\n", | 1348 | "numbytes (%d) > BAS_MAXFRAME\n", |
1347 | frame, numbytes); | 1349 | frame, numbytes); |
1348 | break; | ||
1349 | } | ||
1350 | if (unlikely(numbytes > totleft)) { | 1350 | if (unlikely(numbytes > totleft)) { |
1351 | dev_warn(cs->dev, | 1351 | dev_warn(cs->dev, |
1352 | "isochronous read: frame %d: " | 1352 | "isochronous read: frame %d: " |
1353 | "numbytes (%d) > totleft (%d)\n", | 1353 | "numbytes (%d) > totleft (%d)\n", |
1354 | frame, numbytes, totleft); | 1354 | frame, numbytes, totleft); |
1355 | break; | 1355 | numbytes = totleft; |
1356 | } | 1356 | } |
1357 | offset = urb->iso_frame_desc[frame].offset; | 1357 | offset = urb->iso_frame_desc[frame].offset; |
1358 | if (unlikely(offset + numbytes > BAS_INBUFSIZE)) { | 1358 | if (unlikely(offset + numbytes > BAS_INBUFSIZE)) { |
@@ -1361,7 +1361,7 @@ static void read_iso_tasklet(unsigned long data) | |||
1361 | "offset (%d) + numbytes (%d) " | 1361 | "offset (%d) + numbytes (%d) " |
1362 | "> BAS_INBUFSIZE\n", | 1362 | "> BAS_INBUFSIZE\n", |
1363 | frame, offset, numbytes); | 1363 | frame, offset, numbytes); |
1364 | break; | 1364 | numbytes = BAS_INBUFSIZE - offset; |
1365 | } | 1365 | } |
1366 | gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs); | 1366 | gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs); |
1367 | totleft -= numbytes; | 1367 | totleft -= numbytes; |
@@ -1433,6 +1433,7 @@ static void req_timeout(unsigned long data) | |||
1433 | 1433 | ||
1434 | case HD_CLOSE_ATCHANNEL: | 1434 | case HD_CLOSE_ATCHANNEL: |
1435 | dev_err(bcs->cs->dev, "timeout closing AT channel\n"); | 1435 | dev_err(bcs->cs->dev, "timeout closing AT channel\n"); |
1436 | error_reset(bcs->cs); | ||
1436 | break; | 1437 | break; |
1437 | 1438 | ||
1438 | case HD_CLOSE_B2CHANNEL: | 1439 | case HD_CLOSE_B2CHANNEL: |
@@ -1442,6 +1443,13 @@ static void req_timeout(unsigned long data) | |||
1442 | error_reset(bcs->cs); | 1443 | error_reset(bcs->cs); |
1443 | break; | 1444 | break; |
1444 | 1445 | ||
1446 | case HD_RESET_INTERRUPT_PIPE: | ||
1447 | /* error recovery escalation */ | ||
1448 | dev_err(bcs->cs->dev, | ||
1449 | "reset interrupt pipe timeout, attempting USB reset\n"); | ||
1450 | usb_queue_reset_device(bcs->cs->hw.bas->interface); | ||
1451 | break; | ||
1452 | |||
1445 | default: | 1453 | default: |
1446 | dev_warn(bcs->cs->dev, "request 0x%02x timed out, clearing\n", | 1454 | dev_warn(bcs->cs->dev, "request 0x%02x timed out, clearing\n", |
1447 | pending); | 1455 | pending); |
@@ -1934,6 +1942,15 @@ static int gigaset_write_cmd(struct cardstate *cs, | |||
1934 | goto notqueued; | 1942 | goto notqueued; |
1935 | } | 1943 | } |
1936 | 1944 | ||
1945 | /* translate "+++" escape sequence sent as a single separate command | ||
1946 | * into "close AT channel" command for error recovery | ||
1947 | * The next command will reopen the AT channel automatically. | ||
1948 | */ | ||
1949 | if (len == 3 && !memcmp(buf, "+++", 3)) { | ||
1950 | rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT); | ||
1951 | goto notqueued; | ||
1952 | } | ||
1953 | |||
1937 | if (len > IF_WRITEBUF) | 1954 | if (len > IF_WRITEBUF) |
1938 | len = IF_WRITEBUF; | 1955 | len = IF_WRITEBUF; |
1939 | if (!(cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC))) { | 1956 | if (!(cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC))) { |
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index e4141bf8b2f3..33dcd8d72b7c 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
@@ -22,6 +22,12 @@ | |||
22 | #define DRIVER_AUTHOR "Hansjoerg Lipp <hjlipp@web.de>, Tilman Schmidt <tilman@imap.cc>, Stefan Eilers" | 22 | #define DRIVER_AUTHOR "Hansjoerg Lipp <hjlipp@web.de>, Tilman Schmidt <tilman@imap.cc>, Stefan Eilers" |
23 | #define DRIVER_DESC "Driver for Gigaset 307x" | 23 | #define DRIVER_DESC "Driver for Gigaset 307x" |
24 | 24 | ||
25 | #ifdef CONFIG_GIGASET_DEBUG | ||
26 | #define DRIVER_DESC_DEBUG " (debug build)" | ||
27 | #else | ||
28 | #define DRIVER_DESC_DEBUG "" | ||
29 | #endif | ||
30 | |||
25 | /* Module parameters */ | 31 | /* Module parameters */ |
26 | int gigaset_debuglevel = DEBUG_DEFAULT; | 32 | int gigaset_debuglevel = DEBUG_DEFAULT; |
27 | EXPORT_SYMBOL_GPL(gigaset_debuglevel); | 33 | EXPORT_SYMBOL_GPL(gigaset_debuglevel); |
@@ -32,6 +38,17 @@ MODULE_PARM_DESC(debug, "debug level"); | |||
32 | #define VALID_MINOR 0x01 | 38 | #define VALID_MINOR 0x01 |
33 | #define VALID_ID 0x02 | 39 | #define VALID_ID 0x02 |
34 | 40 | ||
41 | /** | ||
42 | * gigaset_dbg_buffer() - dump data in ASCII and hex for debugging | ||
43 | * @level: debugging level. | ||
44 | * @msg: message prefix. | ||
45 | * @len: number of bytes to dump. | ||
46 | * @buf: data to dump. | ||
47 | * | ||
48 | * If the current debugging level includes one of the bits set in @level, | ||
49 | * @len bytes starting at @buf are logged to dmesg at KERN_DEBUG prio, | ||
50 | * prefixed by the text @msg. | ||
51 | */ | ||
35 | void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, | 52 | void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, |
36 | size_t len, const unsigned char *buf) | 53 | size_t len, const unsigned char *buf) |
37 | { | 54 | { |
@@ -274,6 +291,20 @@ static void clear_events(struct cardstate *cs) | |||
274 | spin_unlock_irqrestore(&cs->ev_lock, flags); | 291 | spin_unlock_irqrestore(&cs->ev_lock, flags); |
275 | } | 292 | } |
276 | 293 | ||
294 | /** | ||
295 | * gigaset_add_event() - add event to device event queue | ||
296 | * @cs: device descriptor structure. | ||
297 | * @at_state: connection state structure. | ||
298 | * @type: event type. | ||
299 | * @ptr: pointer parameter for event. | ||
300 | * @parameter: integer parameter for event. | ||
301 | * @arg: pointer parameter for event. | ||
302 | * | ||
303 | * Allocate an event queue entry from the device's event queue, and set it up | ||
304 | * with the parameters given. | ||
305 | * | ||
306 | * Return value: added event | ||
307 | */ | ||
277 | struct event_t *gigaset_add_event(struct cardstate *cs, | 308 | struct event_t *gigaset_add_event(struct cardstate *cs, |
278 | struct at_state_t *at_state, int type, | 309 | struct at_state_t *at_state, int type, |
279 | void *ptr, int parameter, void *arg) | 310 | void *ptr, int parameter, void *arg) |
@@ -398,6 +429,15 @@ static void make_invalid(struct cardstate *cs, unsigned mask) | |||
398 | spin_unlock_irqrestore(&drv->lock, flags); | 429 | spin_unlock_irqrestore(&drv->lock, flags); |
399 | } | 430 | } |
400 | 431 | ||
432 | /** | ||
433 | * gigaset_freecs() - free all associated ressources of a device | ||
434 | * @cs: device descriptor structure. | ||
435 | * | ||
436 | * Stops all tasklets and timers, unregisters the device from all | ||
437 | * subsystems it was registered to, deallocates the device structure | ||
438 | * @cs and all structures referenced from it. | ||
439 | * Operations on the device should be stopped before calling this. | ||
440 | */ | ||
401 | void gigaset_freecs(struct cardstate *cs) | 441 | void gigaset_freecs(struct cardstate *cs) |
402 | { | 442 | { |
403 | int i; | 443 | int i; |
@@ -506,7 +546,12 @@ static void gigaset_inbuf_init(struct inbuf_t *inbuf, struct bc_state *bcs, | |||
506 | inbuf->inputstate = inputstate; | 546 | inbuf->inputstate = inputstate; |
507 | } | 547 | } |
508 | 548 | ||
509 | /* append received bytes to inbuf */ | 549 | /** |
550 | * gigaset_fill_inbuf() - append received data to input buffer | ||
551 | * @inbuf: buffer structure. | ||
552 | * @src: received data. | ||
553 | * @numbytes: number of bytes received. | ||
554 | */ | ||
510 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, | 555 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, |
511 | unsigned numbytes) | 556 | unsigned numbytes) |
512 | { | 557 | { |
@@ -606,20 +651,22 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs, | |||
606 | return NULL; | 651 | return NULL; |
607 | } | 652 | } |
608 | 653 | ||
609 | /* gigaset_initcs | 654 | /** |
655 | * gigaset_initcs() - initialize device structure | ||
656 | * @drv: hardware driver the device belongs to | ||
657 | * @channels: number of B channels supported by device | ||
658 | * @onechannel: !=0 if B channel data and AT commands share one | ||
659 | * communication channel (M10x), | ||
660 | * ==0 if B channels have separate communication channels (base) | ||
661 | * @ignoreframes: number of frames to ignore after setting up B channel | ||
662 | * @cidmode: !=0: start in CallID mode | ||
663 | * @modulename: name of driver module for LL registration | ||
664 | * | ||
610 | * Allocate and initialize cardstate structure for Gigaset driver | 665 | * Allocate and initialize cardstate structure for Gigaset driver |
611 | * Calls hardware dependent gigaset_initcshw() function | 666 | * Calls hardware dependent gigaset_initcshw() function |
612 | * Calls B channel initialization function gigaset_initbcs() for each B channel | 667 | * Calls B channel initialization function gigaset_initbcs() for each B channel |
613 | * parameters: | 668 | * |
614 | * drv hardware driver the device belongs to | 669 | * Return value: |
615 | * channels number of B channels supported by device | ||
616 | * onechannel !=0: B channel data and AT commands share one | ||
617 | * communication channel | ||
618 | * ==0: B channels have separate communication channels | ||
619 | * ignoreframes number of frames to ignore after setting up B channel | ||
620 | * cidmode !=0: start in CallID mode | ||
621 | * modulename name of driver module (used for I4L registration) | ||
622 | * return value: | ||
623 | * pointer to cardstate structure | 670 | * pointer to cardstate structure |
624 | */ | 671 | */ |
625 | struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | 672 | struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, |
@@ -837,6 +884,17 @@ static void cleanup_cs(struct cardstate *cs) | |||
837 | } | 884 | } |
838 | 885 | ||
839 | 886 | ||
887 | /** | ||
888 | * gigaset_start() - start device operations | ||
889 | * @cs: device descriptor structure. | ||
890 | * | ||
891 | * Prepares the device for use by setting up communication parameters, | ||
892 | * scheduling an EV_START event to initiate device initialization, and | ||
893 | * waiting for completion of the initialization. | ||
894 | * | ||
895 | * Return value: | ||
896 | * 1 - success, 0 - error | ||
897 | */ | ||
840 | int gigaset_start(struct cardstate *cs) | 898 | int gigaset_start(struct cardstate *cs) |
841 | { | 899 | { |
842 | unsigned long flags; | 900 | unsigned long flags; |
@@ -879,9 +937,15 @@ error: | |||
879 | } | 937 | } |
880 | EXPORT_SYMBOL_GPL(gigaset_start); | 938 | EXPORT_SYMBOL_GPL(gigaset_start); |
881 | 939 | ||
882 | /* gigaset_shutdown | 940 | /** |
883 | * check if a device is associated to the cardstate structure and stop it | 941 | * gigaset_shutdown() - shut down device operations |
884 | * return value: 0 if ok, -1 if no device was associated | 942 | * @cs: device descriptor structure. |
943 | * | ||
944 | * Deactivates the device by scheduling an EV_SHUTDOWN event and | ||
945 | * waiting for completion of the shutdown. | ||
946 | * | ||
947 | * Return value: | ||
948 | * 0 - success, -1 - error (no device associated) | ||
885 | */ | 949 | */ |
886 | int gigaset_shutdown(struct cardstate *cs) | 950 | int gigaset_shutdown(struct cardstate *cs) |
887 | { | 951 | { |
@@ -912,6 +976,13 @@ exit: | |||
912 | } | 976 | } |
913 | EXPORT_SYMBOL_GPL(gigaset_shutdown); | 977 | EXPORT_SYMBOL_GPL(gigaset_shutdown); |
914 | 978 | ||
979 | /** | ||
980 | * gigaset_stop() - stop device operations | ||
981 | * @cs: device descriptor structure. | ||
982 | * | ||
983 | * Stops operations on the device by scheduling an EV_STOP event and | ||
984 | * waiting for completion of the shutdown. | ||
985 | */ | ||
915 | void gigaset_stop(struct cardstate *cs) | 986 | void gigaset_stop(struct cardstate *cs) |
916 | { | 987 | { |
917 | mutex_lock(&cs->mutex); | 988 | mutex_lock(&cs->mutex); |
@@ -1020,6 +1091,14 @@ struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty) | |||
1020 | return gigaset_get_cs_by_minor(tty->index + tty->driver->minor_start); | 1091 | return gigaset_get_cs_by_minor(tty->index + tty->driver->minor_start); |
1021 | } | 1092 | } |
1022 | 1093 | ||
1094 | /** | ||
1095 | * gigaset_freedriver() - free all associated ressources of a driver | ||
1096 | * @drv: driver descriptor structure. | ||
1097 | * | ||
1098 | * Unregisters the driver from the system and deallocates the driver | ||
1099 | * structure @drv and all structures referenced from it. | ||
1100 | * All devices should be shut down before calling this. | ||
1101 | */ | ||
1023 | void gigaset_freedriver(struct gigaset_driver *drv) | 1102 | void gigaset_freedriver(struct gigaset_driver *drv) |
1024 | { | 1103 | { |
1025 | unsigned long flags; | 1104 | unsigned long flags; |
@@ -1035,14 +1114,16 @@ void gigaset_freedriver(struct gigaset_driver *drv) | |||
1035 | } | 1114 | } |
1036 | EXPORT_SYMBOL_GPL(gigaset_freedriver); | 1115 | EXPORT_SYMBOL_GPL(gigaset_freedriver); |
1037 | 1116 | ||
1038 | /* gigaset_initdriver | 1117 | /** |
1118 | * gigaset_initdriver() - initialize driver structure | ||
1119 | * @minor: First minor number | ||
1120 | * @minors: Number of minors this driver can handle | ||
1121 | * @procname: Name of the driver | ||
1122 | * @devname: Name of the device files (prefix without minor number) | ||
1123 | * | ||
1039 | * Allocate and initialize gigaset_driver structure. Initialize interface. | 1124 | * Allocate and initialize gigaset_driver structure. Initialize interface. |
1040 | * parameters: | 1125 | * |
1041 | * minor First minor number | 1126 | * Return value: |
1042 | * minors Number of minors this driver can handle | ||
1043 | * procname Name of the driver | ||
1044 | * devname Name of the device files (prefix without minor number) | ||
1045 | * return value: | ||
1046 | * Pointer to the gigaset_driver structure on success, NULL on failure. | 1127 | * Pointer to the gigaset_driver structure on success, NULL on failure. |
1047 | */ | 1128 | */ |
1048 | struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, | 1129 | struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, |
@@ -1095,6 +1176,13 @@ error: | |||
1095 | } | 1176 | } |
1096 | EXPORT_SYMBOL_GPL(gigaset_initdriver); | 1177 | EXPORT_SYMBOL_GPL(gigaset_initdriver); |
1097 | 1178 | ||
1179 | /** | ||
1180 | * gigaset_blockdriver() - block driver | ||
1181 | * @drv: driver descriptor structure. | ||
1182 | * | ||
1183 | * Prevents the driver from attaching new devices, in preparation for | ||
1184 | * deregistration. | ||
1185 | */ | ||
1098 | void gigaset_blockdriver(struct gigaset_driver *drv) | 1186 | void gigaset_blockdriver(struct gigaset_driver *drv) |
1099 | { | 1187 | { |
1100 | drv->blocked = 1; | 1188 | drv->blocked = 1; |
@@ -1110,7 +1198,7 @@ static int __init gigaset_init_module(void) | |||
1110 | if (gigaset_debuglevel == 1) | 1198 | if (gigaset_debuglevel == 1) |
1111 | gigaset_debuglevel = DEBUG_DEFAULT; | 1199 | gigaset_debuglevel = DEBUG_DEFAULT; |
1112 | 1200 | ||
1113 | pr_info(DRIVER_DESC "\n"); | 1201 | pr_info(DRIVER_DESC DRIVER_DESC_DEBUG "\n"); |
1114 | return 0; | 1202 | return 0; |
1115 | } | 1203 | } |
1116 | 1204 | ||
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index 2d91049571a4..cc768caa38f5 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c | |||
@@ -207,7 +207,6 @@ struct reply_t gigaset_tab_nocid[] = | |||
207 | /* leave dle mode */ | 207 | /* leave dle mode */ |
208 | {RSP_INIT, 0, 0,SEQ_DLE0, 201, 5, {0}, "^SDLE=0\r"}, | 208 | {RSP_INIT, 0, 0,SEQ_DLE0, 201, 5, {0}, "^SDLE=0\r"}, |
209 | {RSP_OK, 201,201, -1, 202,-1}, | 209 | {RSP_OK, 201,201, -1, 202,-1}, |
210 | //{RSP_ZDLE, 202,202, 0, 202, 0, {ACT_ERROR}},//DELETE | ||
211 | {RSP_ZDLE, 202,202, 0, 0, 0, {ACT_DLE0}}, | 210 | {RSP_ZDLE, 202,202, 0, 0, 0, {ACT_DLE0}}, |
212 | {RSP_NODEV, 200,249, -1, 0, 0, {ACT_FAKEDLE0}}, | 211 | {RSP_NODEV, 200,249, -1, 0, 0, {ACT_FAKEDLE0}}, |
213 | {RSP_ERROR, 200,249, -1, 0, 0, {ACT_FAILDLE0}}, | 212 | {RSP_ERROR, 200,249, -1, 0, 0, {ACT_FAILDLE0}}, |
@@ -265,6 +264,7 @@ struct reply_t gigaset_tab_nocid[] = | |||
265 | {EV_SHUTDOWN, -1, -1, -1, -1,-1, {ACT_SHUTDOWN}}, //FIXME | 264 | {EV_SHUTDOWN, -1, -1, -1, -1,-1, {ACT_SHUTDOWN}}, //FIXME |
266 | 265 | ||
267 | /* misc. */ | 266 | /* misc. */ |
267 | {RSP_ERROR, -1, -1, -1, -1, -1, {ACT_ERROR} }, | ||
268 | {RSP_EMPTY, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME | 268 | {RSP_EMPTY, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME |
269 | {RSP_ZCFGT, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME | 269 | {RSP_ZCFGT, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME |
270 | {RSP_ZCFG, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME | 270 | {RSP_ZCFG, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME |
@@ -328,10 +328,9 @@ struct reply_t gigaset_tab_cid[] = | |||
328 | {RSP_INIT, -1, -1,SEQ_HUP, 401, 5, {0}, "+VLS=0\r"}, /* hang up */ //-1,-1? | 328 | {RSP_INIT, -1, -1,SEQ_HUP, 401, 5, {0}, "+VLS=0\r"}, /* hang up */ //-1,-1? |
329 | {RSP_OK, 401,401, -1, 402, 5}, | 329 | {RSP_OK, 401,401, -1, 402, 5}, |
330 | {RSP_ZVLS, 402,402, 0, 403, 5}, | 330 | {RSP_ZVLS, 402,402, 0, 403, 5}, |
331 | {RSP_ZSAU, 403,403,ZSAU_DISCONNECT_REQ, -1,-1, {ACT_DEBUG}}, /* if not remote hup */ | 331 | {RSP_ZSAU, 403, 403, ZSAU_DISCONNECT_REQ, -1, -1, {ACT_DEBUG} }, |
332 | //{RSP_ZSAU, 403,403,ZSAU_NULL, 401, 0, {ACT_ERROR}}, //DELETE//FIXME -> DLE0 // should we do this _before_ hanging up for base driver? | 332 | {RSP_ZSAU, 403, 403, ZSAU_NULL, 0, 0, {ACT_DISCONNECT} }, |
333 | {RSP_ZSAU, 403,403,ZSAU_NULL, 0, 0, {ACT_DISCONNECT}}, //FIXME -> DLE0 // should we do this _before_ hanging up for base driver? | 333 | {RSP_NODEV, 401, 403, -1, 0, 0, {ACT_FAKEHUP} }, |
334 | {RSP_NODEV, 401,403, -1, 0, 0, {ACT_FAKEHUP}}, //FIXME -> DLE0 // should we do this _before_ hanging up for base driver? | ||
335 | {RSP_ERROR, 401,401, -1, 0, 0, {ACT_ABORTHUP}}, | 334 | {RSP_ERROR, 401,401, -1, 0, 0, {ACT_ABORTHUP}}, |
336 | {EV_TIMEOUT, 401,403, -1, 0, 0, {ACT_ABORTHUP}}, | 335 | {EV_TIMEOUT, 401,403, -1, 0, 0, {ACT_ABORTHUP}}, |
337 | 336 | ||
@@ -474,8 +473,13 @@ static int cid_of_response(char *s) | |||
474 | //FIXME is ;<digit>+ at end of non-CID response really impossible? | 473 | //FIXME is ;<digit>+ at end of non-CID response really impossible? |
475 | } | 474 | } |
476 | 475 | ||
477 | /* This function will be called via task queue from the callback handler. | 476 | /** |
478 | * We received a modem response and have to handle it.. | 477 | * gigaset_handle_modem_response() - process received modem response |
478 | * @cs: device descriptor structure. | ||
479 | * | ||
480 | * Called by asyncdata/isocdata if a block of data received from the | ||
481 | * device must be processed as a modem command response. The data is | ||
482 | * already in the cs structure. | ||
479 | */ | 483 | */ |
480 | void gigaset_handle_modem_response(struct cardstate *cs) | 484 | void gigaset_handle_modem_response(struct cardstate *cs) |
481 | { | 485 | { |
@@ -707,6 +711,11 @@ static void disconnect(struct at_state_t **at_state_p) | |||
707 | if (bcs) { | 711 | if (bcs) { |
708 | /* B channel assigned: invoke hardware specific handler */ | 712 | /* B channel assigned: invoke hardware specific handler */ |
709 | cs->ops->close_bchannel(bcs); | 713 | cs->ops->close_bchannel(bcs); |
714 | /* notify LL */ | ||
715 | if (bcs->chstate & (CHS_D_UP | CHS_NOTIFY_LL)) { | ||
716 | bcs->chstate &= ~(CHS_D_UP | CHS_NOTIFY_LL); | ||
717 | gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DHUP); | ||
718 | } | ||
710 | } else { | 719 | } else { |
711 | /* no B channel assigned: just deallocate */ | 720 | /* no B channel assigned: just deallocate */ |
712 | spin_lock_irqsave(&cs->lock, flags); | 721 | spin_lock_irqsave(&cs->lock, flags); |
@@ -1429,11 +1438,12 @@ static void do_action(int action, struct cardstate *cs, | |||
1429 | cs->gotfwver = -1; | 1438 | cs->gotfwver = -1; |
1430 | dev_err(cs->dev, "could not read firmware version.\n"); | 1439 | dev_err(cs->dev, "could not read firmware version.\n"); |
1431 | break; | 1440 | break; |
1432 | #ifdef CONFIG_GIGASET_DEBUG | ||
1433 | case ACT_ERROR: | 1441 | case ACT_ERROR: |
1434 | *p_genresp = 1; | 1442 | gig_dbg(DEBUG_ANY, "%s: ERROR response in ConState %d", |
1435 | *p_resp_code = RSP_ERROR; | 1443 | __func__, at_state->ConState); |
1444 | cs->cur_at_seq = SEQ_NONE; | ||
1436 | break; | 1445 | break; |
1446 | #ifdef CONFIG_GIGASET_DEBUG | ||
1437 | case ACT_TEST: | 1447 | case ACT_TEST: |
1438 | { | 1448 | { |
1439 | static int count = 3; //2; //1; | 1449 | static int count = 3; //2; //1; |
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c index 9b22f9cf2f33..654489d836cd 100644 --- a/drivers/isdn/gigaset/i4l.c +++ b/drivers/isdn/gigaset/i4l.c | |||
@@ -51,6 +51,12 @@ static int writebuf_from_LL(int driverID, int channel, int ack, | |||
51 | return -ENODEV; | 51 | return -ENODEV; |
52 | } | 52 | } |
53 | bcs = &cs->bcs[channel]; | 53 | bcs = &cs->bcs[channel]; |
54 | |||
55 | /* can only handle linear sk_buffs */ | ||
56 | if (skb_linearize(skb) < 0) { | ||
57 | dev_err(cs->dev, "%s: skb_linearize failed\n", __func__); | ||
58 | return -ENOMEM; | ||
59 | } | ||
54 | len = skb->len; | 60 | len = skb->len; |
55 | 61 | ||
56 | gig_dbg(DEBUG_LLDATA, | 62 | gig_dbg(DEBUG_LLDATA, |
@@ -79,6 +85,14 @@ static int writebuf_from_LL(int driverID, int channel, int ack, | |||
79 | return cs->ops->send_skb(bcs, skb); | 85 | return cs->ops->send_skb(bcs, skb); |
80 | } | 86 | } |
81 | 87 | ||
88 | /** | ||
89 | * gigaset_skb_sent() - acknowledge sending an skb | ||
90 | * @bcs: B channel descriptor structure. | ||
91 | * @skb: sent data. | ||
92 | * | ||
93 | * Called by hardware module {bas,ser,usb}_gigaset when the data in a | ||
94 | * skb has been successfully sent, for signalling completion to the LL. | ||
95 | */ | ||
82 | void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) | 96 | void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) |
83 | { | 97 | { |
84 | unsigned len; | 98 | unsigned len; |
@@ -455,6 +469,15 @@ int gigaset_isdn_setup_accept(struct at_state_t *at_state) | |||
455 | return 0; | 469 | return 0; |
456 | } | 470 | } |
457 | 471 | ||
472 | /** | ||
473 | * gigaset_isdn_icall() - signal incoming call | ||
474 | * @at_state: connection state structure. | ||
475 | * | ||
476 | * Called by main module to notify the LL that an incoming call has been | ||
477 | * received. @at_state contains the parameters of the call. | ||
478 | * | ||
479 | * Return value: call disposition (ICALL_*) | ||
480 | */ | ||
458 | int gigaset_isdn_icall(struct at_state_t *at_state) | 481 | int gigaset_isdn_icall(struct at_state_t *at_state) |
459 | { | 482 | { |
460 | struct cardstate *cs = at_state->cs; | 483 | struct cardstate *cs = at_state->cs; |
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index f33ac27de643..6a8e1384e7bd 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c | |||
@@ -616,6 +616,15 @@ void gigaset_if_free(struct cardstate *cs) | |||
616 | tty_unregister_device(drv->tty, cs->minor_index); | 616 | tty_unregister_device(drv->tty, cs->minor_index); |
617 | } | 617 | } |
618 | 618 | ||
619 | /** | ||
620 | * gigaset_if_receive() - pass a received block of data to the tty device | ||
621 | * @cs: device descriptor structure. | ||
622 | * @buffer: received data. | ||
623 | * @len: number of bytes received. | ||
624 | * | ||
625 | * Called by asyncdata/isocdata if a block of data received from the | ||
626 | * device must be sent to userspace through the ttyG* device. | ||
627 | */ | ||
619 | void gigaset_if_receive(struct cardstate *cs, | 628 | void gigaset_if_receive(struct cardstate *cs, |
620 | unsigned char *buffer, size_t len) | 629 | unsigned char *buffer, size_t len) |
621 | { | 630 | { |
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index bed38fcc432b..9f3ef7b4248c 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
@@ -429,7 +429,7 @@ static inline int hdlc_buildframe(struct isowbuf_t *iwb, | |||
429 | return -EAGAIN; | 429 | return -EAGAIN; |
430 | } | 430 | } |
431 | 431 | ||
432 | dump_bytes(DEBUG_STREAM, "snd data", in, count); | 432 | dump_bytes(DEBUG_STREAM_DUMP, "snd data", in, count); |
433 | 433 | ||
434 | /* bitstuff and checksum input data */ | 434 | /* bitstuff and checksum input data */ |
435 | fcs = PPP_INITFCS; | 435 | fcs = PPP_INITFCS; |
@@ -448,7 +448,6 @@ static inline int hdlc_buildframe(struct isowbuf_t *iwb, | |||
448 | /* put closing flag and repeat byte for flag idle */ | 448 | /* put closing flag and repeat byte for flag idle */ |
449 | isowbuf_putflag(iwb); | 449 | isowbuf_putflag(iwb); |
450 | end = isowbuf_donewrite(iwb); | 450 | end = isowbuf_donewrite(iwb); |
451 | dump_bytes(DEBUG_STREAM_DUMP, "isowbuf", iwb->data, end + 1); | ||
452 | return end; | 451 | return end; |
453 | } | 452 | } |
454 | 453 | ||
@@ -482,6 +481,8 @@ static inline int trans_buildframe(struct isowbuf_t *iwb, | |||
482 | } | 481 | } |
483 | 482 | ||
484 | gig_dbg(DEBUG_STREAM, "put %d bytes", count); | 483 | gig_dbg(DEBUG_STREAM, "put %d bytes", count); |
484 | dump_bytes(DEBUG_STREAM_DUMP, "snd data", in, count); | ||
485 | |||
485 | write = iwb->write; | 486 | write = iwb->write; |
486 | do { | 487 | do { |
487 | c = bitrev8(*in++); | 488 | c = bitrev8(*in++); |
@@ -583,7 +584,7 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
583 | procskb->tail -= 2; | 584 | procskb->tail -= 2; |
584 | gig_dbg(DEBUG_ISO, "%s: good frame (%d octets)", | 585 | gig_dbg(DEBUG_ISO, "%s: good frame (%d octets)", |
585 | __func__, procskb->len); | 586 | __func__, procskb->len); |
586 | dump_bytes(DEBUG_STREAM, | 587 | dump_bytes(DEBUG_STREAM_DUMP, |
587 | "rcv data", procskb->data, procskb->len); | 588 | "rcv data", procskb->data, procskb->len); |
588 | bcs->hw.bas->goodbytes += procskb->len; | 589 | bcs->hw.bas->goodbytes += procskb->len; |
589 | gigaset_rcv_skb(procskb, bcs->cs, bcs); | 590 | gigaset_rcv_skb(procskb, bcs->cs, bcs); |
@@ -878,6 +879,8 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
878 | dobytes--; | 879 | dobytes--; |
879 | } | 880 | } |
880 | if (dobytes == 0) { | 881 | if (dobytes == 0) { |
882 | dump_bytes(DEBUG_STREAM_DUMP, | ||
883 | "rcv data", skb->data, skb->len); | ||
881 | gigaset_rcv_skb(skb, bcs->cs, bcs); | 884 | gigaset_rcv_skb(skb, bcs->cs, bcs); |
882 | bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN); | 885 | bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN); |
883 | if (!skb) { | 886 | if (!skb) { |
@@ -973,16 +976,17 @@ void gigaset_isoc_input(struct inbuf_t *inbuf) | |||
973 | 976 | ||
974 | /* == data output ========================================================== */ | 977 | /* == data output ========================================================== */ |
975 | 978 | ||
976 | /* gigaset_send_skb | 979 | /** |
977 | * called by common.c to queue an skb for sending | 980 | * gigaset_isoc_send_skb() - queue an skb for sending |
978 | * and start transmission if necessary | 981 | * @bcs: B channel descriptor structure. |
979 | * parameters: | 982 | * @skb: data to send. |
980 | * B Channel control structure | 983 | * |
981 | * skb | 984 | * Called by i4l.c to queue an skb for sending, and start transmission if |
982 | * return value: | 985 | * necessary. |
983 | * number of bytes accepted for sending | 986 | * |
984 | * (skb->len if ok, 0 if out of buffer space) | 987 | * Return value: |
985 | * or error code (< 0, eg. -EINVAL) | 988 | * number of bytes accepted for sending (skb->len) if ok, |
989 | * error code < 0 (eg. -ENODEV) on error | ||
986 | */ | 990 | */ |
987 | int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb) | 991 | int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb) |
988 | { | 992 | { |