aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2006-04-11 01:55:00 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 09:18:49 -0400
commit917f5085ddb3498033551e711fb22f48ddeb8378 (patch)
treeff67547a8f4cbf27e4a30b795635778d8e6cc79d
parent08a53cdce62d37d918530bbbf726cc01b21dc3d1 (diff)
[PATCH] isdn4linux: Siemens Gigaset drivers: code cleanup
With Hansjoerg Lipp <hjlipp@web.de> Source code formatting cleanups for the Siemens Gigaset drivers, such as line length, comments, removal of unused declarations, and typo corrections. It does not introduce any functional changes. Signed-off-by: Hansjoerg Lipp <hjlipp@web.de> Signed-off-by: Tilman Schmidt <tilman@imap.cc> Cc: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/isdn/gigaset/asyncdata.c13
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c41
-rw-r--r--drivers/isdn/gigaset/common.c36
-rw-r--r--drivers/isdn/gigaset/ev-layer.c289
-rw-r--r--drivers/isdn/gigaset/gigaset.h470
-rw-r--r--drivers/isdn/gigaset/i4l.c40
-rw-r--r--drivers/isdn/gigaset/interface.c18
-rw-r--r--drivers/isdn/gigaset/isocdata.c16
-rw-r--r--drivers/isdn/gigaset/proc.c12
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c129
10 files changed, 523 insertions, 541 deletions
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c
index 171f8b703d61..778d864ab612 100644
--- a/drivers/isdn/gigaset/asyncdata.c
+++ b/drivers/isdn/gigaset/asyncdata.c
@@ -11,10 +11,6 @@
11 * published by the Free Software Foundation; either version 2 of 11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: ...
15 * =====================================================================
16 * Version: $Id: asyncdata.c,v 1.2.2.7 2005/11/13 23:05:18 hjlipp Exp $
17 * =====================================================================
18 */ 14 */
19 15
20#include "gigaset.h" 16#include "gigaset.h"
@@ -58,7 +54,8 @@ static inline int cmd_loop(unsigned char c, unsigned char *src, int numbytes,
58 dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)", 54 dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
59 __func__, cbytes); 55 __func__, cbytes);
60 cs->cbytes = cbytes; 56 cs->cbytes = cbytes;
61 gigaset_handle_modem_response(cs); /* can change cs->dle */ 57 gigaset_handle_modem_response(cs); /* can change
58 cs->dle */
62 cbytes = 0; 59 cbytes = 0;
63 60
64 if (cs->dle && 61 if (cs->dle &&
@@ -100,7 +97,8 @@ static inline int lock_loop(unsigned char *src, int numbytes,
100{ 97{
101 struct cardstate *cs = inbuf->cs; 98 struct cardstate *cs = inbuf->cs;
102 99
103 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response", numbytes, src, 0); 100 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
101 numbytes, src, 0);
104 gigaset_if_receive(cs, src, numbytes); 102 gigaset_if_receive(cs, src, numbytes);
105 103
106 return numbytes; 104 return numbytes;
@@ -392,8 +390,7 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
392 390
393 if (!(inbuf->inputstate & INS_DLE_char)) { 391 if (!(inbuf->inputstate & INS_DLE_char)) {
394 392
395 /* FIXME Einfach je nach Modus Funktionszeiger in cs setzen [hier+hdlc_loop]? */ 393 /* FIXME use function pointers? */
396 /* FIXME Spart folgendes "if" und ermoeglicht andere Protokolle */
397 if (inbuf->inputstate & INS_command) 394 if (inbuf->inputstate & INS_command)
398 procbytes = cmd_loop(c, src, numbytes, inbuf); 395 procbytes = cmd_loop(c, src, numbytes, inbuf);
399 else if (inbuf->bcs->proto2 == ISDN_PROTO_L2_HDLC) 396 else if (inbuf->bcs->proto2 == ISDN_PROTO_L2_HDLC)
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 31f0f07832bc..fb2c13ae7cfd 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -13,10 +13,6 @@
13 * published by the Free Software Foundation; either version 2 of 13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version. 14 * the License, or (at your option) any later version.
15 * ===================================================================== 15 * =====================================================================
16 * ToDo: ...
17 * =====================================================================
18 * Version: $Id: bas-gigaset.c,v 1.52.4.19 2006/02/04 18:28:16 hjlipp Exp $
19 * =====================================================================
20 */ 16 */
21 17
22#include "gigaset.h" 18#include "gigaset.h"
@@ -70,9 +66,6 @@ static struct usb_device_id gigaset_table [] = {
70 66
71MODULE_DEVICE_TABLE(usb, gigaset_table); 67MODULE_DEVICE_TABLE(usb, gigaset_table);
72 68
73/* Get a minor range for your devices from the usb maintainer */
74#define USB_SKEL_MINOR_BASE 200
75
76/*======================= local function prototypes =============================*/ 69/*======================= local function prototypes =============================*/
77 70
78/* This function is called if a new device is connected to the USB port. It 71/* This function is called if a new device is connected to the USB port. It
@@ -240,7 +233,8 @@ static inline void dump_urb(enum debuglevel level, const char *tag,
240 (unsigned long) urb->context, 233 (unsigned long) urb->context,
241 (unsigned long) urb->complete); 234 (unsigned long) urb->complete);
242 for (i = 0; i < urb->number_of_packets; i++) { 235 for (i = 0; i < urb->number_of_packets; i++) {
243 struct usb_iso_packet_descriptor *pifd = &urb->iso_frame_desc[i]; 236 struct usb_iso_packet_descriptor *pifd
237 = &urb->iso_frame_desc[i];
244 dbg(level, 238 dbg(level,
245 " {offset=%u, length=%u, actual_length=%u, " 239 " {offset=%u, length=%u, actual_length=%u, "
246 "status=%u}", 240 "status=%u}",
@@ -777,10 +771,11 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs)
777 urb->iso_frame_desc[i].actual_length = 0; 771 urb->iso_frame_desc[i].actual_length = 0;
778 } 772 }
779 if (likely(atomic_read(&ubc->running))) { 773 if (likely(atomic_read(&ubc->running))) {
780 urb->dev = bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */ 774 urb->dev = bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */
781 urb->transfer_flags = URB_ISO_ASAP; 775 urb->transfer_flags = URB_ISO_ASAP;
782 urb->number_of_packets = BAS_NUMFRAMES; 776 urb->number_of_packets = BAS_NUMFRAMES;
783 dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", __func__); 777 dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit",
778 __func__);
784 rc = usb_submit_urb(urb, SLAB_ATOMIC); 779 rc = usb_submit_urb(urb, SLAB_ATOMIC);
785 if (unlikely(rc != 0)) { 780 if (unlikely(rc != 0)) {
786 err("could not resubmit isochronous read URB: %s", 781 err("could not resubmit isochronous read URB: %s",
@@ -989,7 +984,7 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
989 ubc = ucx->bcs->hw.bas; 984 ubc = ucx->bcs->hw.bas;
990 IFNULLRETVAL(ubc, -EFAULT); 985 IFNULLRETVAL(ubc, -EFAULT);
991 986
992 urb->dev = ucx->bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */ 987 urb->dev = ucx->bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */
993 urb->transfer_flags = URB_ISO_ASAP; 988 urb->transfer_flags = URB_ISO_ASAP;
994 urb->transfer_buffer = ubc->isooutbuf->data; 989 urb->transfer_buffer = ubc->isooutbuf->data;
995 urb->transfer_buffer_length = sizeof(ubc->isooutbuf->data); 990 urb->transfer_buffer_length = sizeof(ubc->isooutbuf->data);
@@ -1011,7 +1006,8 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
1011 //dbg(DEBUG_ISO, "%s: frame %d length=%d", __func__, nframe, ifd->length); 1006 //dbg(DEBUG_ISO, "%s: frame %d length=%d", __func__, nframe, ifd->length);
1012 1007
1013 /* retrieve block of data to send */ 1008 /* retrieve block of data to send */
1014 ifd->offset = gigaset_isowbuf_getbytes(ubc->isooutbuf, ifd->length); 1009 ifd->offset = gigaset_isowbuf_getbytes(ubc->isooutbuf,
1010 ifd->length);
1015 if (ifd->offset < 0) { 1011 if (ifd->offset < 0) {
1016 if (ifd->offset == -EBUSY) { 1012 if (ifd->offset == -EBUSY) {
1017 dbg(DEBUG_ISO, "%s: buffer busy at frame %d", 1013 dbg(DEBUG_ISO, "%s: buffer busy at frame %d",
@@ -1123,7 +1119,8 @@ static void write_iso_tasklet(unsigned long data)
1123 break; 1119 break;
1124 case -EXDEV: /* inspect individual frames */ 1120 case -EXDEV: /* inspect individual frames */
1125 /* assumptions (for lack of documentation): 1121 /* assumptions (for lack of documentation):
1126 * - actual_length bytes of the frame in error are successfully sent 1122 * - actual_length bytes of the frame in error are
1123 * successfully sent
1127 * - all following frames are not sent at all 1124 * - all following frames are not sent at all
1128 */ 1125 */
1129 dbg(DEBUG_ISO, "%s: URB partially completed", __func__); 1126 dbg(DEBUG_ISO, "%s: URB partially completed", __func__);
@@ -1260,7 +1257,8 @@ static void read_iso_tasklet(unsigned long data)
1260 switch (urb->status) { 1257 switch (urb->status) {
1261 case 0: /* normal completion */ 1258 case 0: /* normal completion */
1262 break; 1259 break;
1263 case -EXDEV: /* inspect individual frames (we do that anyway) */ 1260 case -EXDEV: /* inspect individual frames
1261 (we do that anyway) */
1264 dbg(DEBUG_ISO, "%s: URB partially completed", __func__); 1262 dbg(DEBUG_ISO, "%s: URB partially completed", __func__);
1265 break; 1263 break;
1266 case -ENOENT: 1264 case -ENOENT:
@@ -1284,8 +1282,8 @@ static void read_iso_tasklet(unsigned long data)
1284 totleft = urb->actual_length; 1282 totleft = urb->actual_length;
1285 for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { 1283 for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) {
1286 if (unlikely(urb->iso_frame_desc[frame].status)) { 1284 if (unlikely(urb->iso_frame_desc[frame].status)) {
1287 warn("isochronous read: frame %d: %s", 1285 warn("isochronous read: frame %d: %s", frame,
1288 frame, get_usb_statmsg(urb->iso_frame_desc[frame].status)); 1286 get_usb_statmsg(urb->iso_frame_desc[frame].status));
1289 break; 1287 break;
1290 } 1288 }
1291 numbytes = urb->iso_frame_desc[frame].actual_length; 1289 numbytes = urb->iso_frame_desc[frame].actual_length;
@@ -1318,7 +1316,7 @@ static void read_iso_tasklet(unsigned long data)
1318 urb->iso_frame_desc[frame].status = 0; 1316 urb->iso_frame_desc[frame].status = 0;
1319 urb->iso_frame_desc[frame].actual_length = 0; 1317 urb->iso_frame_desc[frame].actual_length = 0;
1320 } 1318 }
1321 urb->dev = bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */ 1319 urb->dev = bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */
1322 urb->transfer_flags = URB_ISO_ASAP; 1320 urb->transfer_flags = URB_ISO_ASAP;
1323 urb->number_of_packets = BAS_NUMFRAMES; 1321 urb->number_of_packets = BAS_NUMFRAMES;
1324 if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { 1322 if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) {
@@ -1792,7 +1790,8 @@ static int start_cbsend(struct cardstate *cs)
1792 * cs controller state structure 1790 * cs controller state structure
1793 * buf command string to send 1791 * buf command string to send
1794 * len number of bytes to send (max. IF_WRITEBUF) 1792 * len number of bytes to send (max. IF_WRITEBUF)
1795 * wake_tasklet tasklet to run when transmission is completed (NULL if none) 1793 * wake_tasklet tasklet to run when transmission is completed
1794 * (NULL if none)
1796 * return value: 1795 * return value:
1797 * number of bytes queued on success 1796 * number of bytes queued on success
1798 * error code < 0 on error 1797 * error code < 0 on error
@@ -1849,7 +1848,8 @@ static int gigaset_write_cmd(struct cardstate *cs,
1849 1848
1850/* gigaset_write_room 1849/* gigaset_write_room
1851 * tty_driver.write_room interface routine 1850 * tty_driver.write_room interface routine
1852 * return number of characters the driver will accept to be written via gigaset_write_cmd 1851 * return number of characters the driver will accept to be written via
1852 * gigaset_write_cmd
1853 * parameter: 1853 * parameter:
1854 * controller state structure 1854 * controller state structure
1855 * return value: 1855 * return value:
@@ -2299,7 +2299,8 @@ static int __init bas_gigaset_init(void)
2299 goto error; 2299 goto error;
2300 2300
2301 /* allocate memory for our device state and intialize it */ 2301 /* allocate memory for our device state and intialize it */
2302 cardstate = gigaset_initcs(driver, 2, 0, 0, cidmode, GIGASET_MODULENAME); 2302 cardstate = gigaset_initcs(driver, 2, 0, 0, cidmode,
2303 GIGASET_MODULENAME);
2303 if (!cardstate) 2304 if (!cardstate)
2304 goto error; 2305 goto error;
2305 2306
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 64371995c1a9..1163d316f58c 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -11,10 +11,6 @@
11 * published by the Free Software Foundation; either version 2 of 11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: ...
15 * =====================================================================
16 * Version: $Id: common.c,v 1.104.4.22 2006/02/04 18:28:16 hjlipp Exp $
17 * =====================================================================
18 */ 14 */
19 15
20#include "gigaset.h" 16#include "gigaset.h"
@@ -101,7 +97,8 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
101 } else { 97 } else {
102 numin = len < sizeof inbuf ? len : sizeof inbuf; 98 numin = len < sizeof inbuf ? len : sizeof inbuf;
103 in = inbuf; 99 in = inbuf;
104 if (copy_from_user(inbuf, (const unsigned char __user *) buf, numin)) { 100 if (copy_from_user(inbuf, (const unsigned char __user *) buf,
101 numin)) {
105 strncpy(inbuf, "<FAULT>", sizeof inbuf); 102 strncpy(inbuf, "<FAULT>", sizeof inbuf);
106 numin = sizeof "<FAULT>" - 1; 103 numin = sizeof "<FAULT>" - 1;
107 } 104 }
@@ -425,7 +422,8 @@ void gigaset_freecs(struct cardstate *cs)
425 422
426 spin_lock_irqsave(&cs->lock, flags); 423 spin_lock_irqsave(&cs->lock, flags);
427 atomic_set(&cs->running, 0); 424 atomic_set(&cs->running, 0);
428 spin_unlock_irqrestore(&cs->lock, flags); /* event handler and timer are not rescheduled below */ 425 spin_unlock_irqrestore(&cs->lock, flags); /* event handler and timer are
426 not rescheduled below */
429 427
430 tasklet_kill(&cs->event_tasklet); 428 tasklet_kill(&cs->event_tasklet);
431 del_timer_sync(&cs->timer); 429 del_timer_sync(&cs->timer);
@@ -563,7 +561,6 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
563 if (cs->ops->initbcshw(bcs)) 561 if (cs->ops->initbcshw(bcs))
564 return bcs; 562 return bcs;
565 563
566//error:
567 dbg(DEBUG_INIT, " failed"); 564 dbg(DEBUG_INIT, " failed");
568 565
569 dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel); 566 dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel);
@@ -580,7 +577,8 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
580 * parameters: 577 * parameters:
581 * drv hardware driver the device belongs to 578 * drv hardware driver the device belongs to
582 * channels number of B channels supported by device 579 * channels number of B channels supported by device
583 * onechannel !=0: B channel data and AT commands share one communication channel 580 * onechannel !=0: B channel data and AT commands share one
581 * communication channel
584 * ==0: B channels have separate communication channels 582 * ==0: B channels have separate communication channels
585 * ignoreframes number of frames to ignore after setting up B channel 583 * ignoreframes number of frames to ignore after setting up B channel
586 * cidmode !=0: start in CallID mode 584 * cidmode !=0: start in CallID mode
@@ -619,7 +617,8 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
619 atomic_set(&cs->ev_tail, 0); 617 atomic_set(&cs->ev_tail, 0);
620 atomic_set(&cs->ev_head, 0); 618 atomic_set(&cs->ev_head, 0);
621 init_MUTEX_LOCKED(&cs->sem); 619 init_MUTEX_LOCKED(&cs->sem);
622 tasklet_init(&cs->event_tasklet, &gigaset_handle_event, (unsigned long) cs); 620 tasklet_init(&cs->event_tasklet, &gigaset_handle_event,
621 (unsigned long) cs);
623 atomic_set(&cs->commands_pending, 0); 622 atomic_set(&cs->commands_pending, 0);
624 cs->cur_at_seq = 0; 623 cs->cur_at_seq = 0;
625 cs->gotfwver = -1; 624 cs->gotfwver = -1;
@@ -669,14 +668,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
669 cs->curlen = 0; 668 cs->curlen = 0;
670 cs->cmdbytes = 0; 669 cs->cmdbytes = 0;
671 670
672 /*
673 * Tell the ISDN4Linux subsystem (the LL) that
674 * a driver for a USB-Device is available !
675 * If this is done, "isdnctrl" is able to bind a device for this driver even
676 * if no physical usb-device is currently connected.
677 * But this device will just be accessable if a physical USB device is connected
678 * (via "gigaset_probe") .
679 */
680 dbg(DEBUG_INIT, "setting up iif"); 671 dbg(DEBUG_INIT, "setting up iif");
681 if (!gigaset_register_to_LL(cs, modulename)) { 672 if (!gigaset_register_to_LL(cs, modulename)) {
682 err("register_isdn=>error"); 673 err("register_isdn=>error");
@@ -713,7 +704,8 @@ error: if (cs)
713} 704}
714EXPORT_SYMBOL_GPL(gigaset_initcs); 705EXPORT_SYMBOL_GPL(gigaset_initcs);
715 706
716/* ReInitialize the b-channel structure */ /* e.g. called on hangup, disconnect */ 707/* ReInitialize the b-channel structure */
708/* e.g. called on hangup, disconnect */
717void gigaset_bcs_reinit(struct bc_state *bcs) 709void gigaset_bcs_reinit(struct bc_state *bcs)
718{ 710{
719 struct sk_buff *skb; 711 struct sk_buff *skb;
@@ -723,7 +715,7 @@ void gigaset_bcs_reinit(struct bc_state *bcs)
723 while ((skb = skb_dequeue(&bcs->squeue)) != NULL) 715 while ((skb = skb_dequeue(&bcs->squeue)) != NULL)
724 dev_kfree_skb(skb); 716 dev_kfree_skb(skb);
725 717
726 spin_lock_irqsave(&cs->lock, flags); //FIXME 718 spin_lock_irqsave(&cs->lock, flags);
727 clear_at_state(&bcs->at_state); 719 clear_at_state(&bcs->at_state);
728 bcs->at_state.ConState = 0; 720 bcs->at_state.ConState = 0;
729 bcs->at_state.timer_active = 0; 721 bcs->at_state.timer_active = 0;
@@ -805,7 +797,6 @@ int gigaset_start(struct cardstate *cs)
805{ 797{
806 if (down_interruptible(&cs->sem)) 798 if (down_interruptible(&cs->sem))
807 return 0; 799 return 0;
808 //info("USB device for Gigaset 307x now attached to Dev %d", ucs->minor);
809 800
810 atomic_set(&cs->connected, 1); 801 atomic_set(&cs->connected, 1);
811 802
@@ -954,7 +945,8 @@ void gigaset_debugdrivers(void)
954 dbg(DEBUG_DRIVER, " flags 0x%02x", drv->flags[i]); 945 dbg(DEBUG_DRIVER, " flags 0x%02x", drv->flags[i]);
955 cs = drv->cs + i; 946 cs = drv->cs + i;
956 dbg(DEBUG_DRIVER, " cardstate %p", cs); 947 dbg(DEBUG_DRIVER, " cardstate %p", cs);
957 dbg(DEBUG_DRIVER, " minor_index %u", cs->minor_index); 948 dbg(DEBUG_DRIVER, " minor_index %u",
949 cs->minor_index);
958 dbg(DEBUG_DRIVER, " driver %p", cs->driver); 950 dbg(DEBUG_DRIVER, " driver %p", cs->driver);
959 dbg(DEBUG_DRIVER, " i4l id %d", cs->myid); 951 dbg(DEBUG_DRIVER, " i4l id %d", cs->myid);
960 } 952 }
@@ -1016,7 +1008,7 @@ EXPORT_SYMBOL_GPL(gigaset_freedriver);
1016 * parameters: 1008 * parameters:
1017 * minor First minor number 1009 * minor First minor number
1018 * minors Number of minors this driver can handle 1010 * minors Number of minors this driver can handle
1019 * procname Name of the driver (e.g. for /proc/tty/drivers, path in /proc/driver) 1011 * procname Name of the driver
1020 * devname Name of the device files (prefix without minor number) 1012 * devname Name of the device files (prefix without minor number)
1021 * devfsname Devfs name of the device files without %d 1013 * devfsname Devfs name of the device files without %d
1022 * return value: 1014 * return value:
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index fdcb80bb21c7..6c1000491231 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -11,82 +11,78 @@
11 * published by the Free Software Foundation; either version 2 of 11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: ...
15 * =====================================================================
16 * Version: $Id: ev-layer.c,v 1.4.2.18 2006/02/04 18:28:16 hjlipp Exp $
17 * =====================================================================
18 */ 14 */
19 15
20#include "gigaset.h" 16#include "gigaset.h"
21 17
22/* ========================================================== */ 18/* ========================================================== */
23/* bit masks for pending commands */ 19/* bit masks for pending commands */
24#define PC_INIT 0x004 20#define PC_DIAL 0x001
25#define PC_DLE0 0x008 21#define PC_HUP 0x002
26#define PC_DLE1 0x010 22#define PC_INIT 0x004
27#define PC_CID 0x080 23#define PC_DLE0 0x008
28#define PC_NOCID 0x100 24#define PC_DLE1 0x010
29#define PC_HUP 0x002 25#define PC_SHUTDOWN 0x020
30#define PC_DIAL 0x001 26#define PC_ACCEPT 0x040
31#define PC_ACCEPT 0x040 27#define PC_CID 0x080
32#define PC_SHUTDOWN 0x020 28#define PC_NOCID 0x100
33#define PC_CIDMODE 0x200 29#define PC_CIDMODE 0x200
34#define PC_UMMODE 0x400 30#define PC_UMMODE 0x400
35 31
36/* types of modem responses */ 32/* types of modem responses */
37#define RT_NOTHING 0 33#define RT_NOTHING 0
38#define RT_ZSAU 1 34#define RT_ZSAU 1
39#define RT_RING 2 35#define RT_RING 2
40#define RT_NUMBER 3 36#define RT_NUMBER 3
41#define RT_STRING 4 37#define RT_STRING 4
42#define RT_HEX 5 38#define RT_HEX 5
43#define RT_ZCAU 6 39#define RT_ZCAU 6
44 40
45/* Possible ASCII responses */ 41/* Possible ASCII responses */
46#define RSP_OK 0 42#define RSP_OK 0
47//#define RSP_BUSY 1 43//#define RSP_BUSY 1
48//#define RSP_CONNECT 2 44//#define RSP_CONNECT 2
49#define RSP_ZGCI 3 45#define RSP_ZGCI 3
50#define RSP_RING 4 46#define RSP_RING 4
51#define RSP_ZAOC 5 47#define RSP_ZAOC 5
52#define RSP_ZCSTR 6 48#define RSP_ZCSTR 6
53#define RSP_ZCFGT 7 49#define RSP_ZCFGT 7
54#define RSP_ZCFG 8 50#define RSP_ZCFG 8
55#define RSP_ZCCR 9 51#define RSP_ZCCR 9
56#define RSP_EMPTY 10 52#define RSP_EMPTY 10
57#define RSP_ZLOG 11 53#define RSP_ZLOG 11
58#define RSP_ZCAU 12 54#define RSP_ZCAU 12
59#define RSP_ZMWI 13 55#define RSP_ZMWI 13
60#define RSP_ZABINFO 14 56#define RSP_ZABINFO 14
61#define RSP_ZSMLSTCHG 15 57#define RSP_ZSMLSTCHG 15
62#define RSP_VAR 100 58#define RSP_VAR 100
63#define RSP_ZSAU (RSP_VAR + VAR_ZSAU) 59#define RSP_ZSAU (RSP_VAR + VAR_ZSAU)
64#define RSP_ZDLE (RSP_VAR + VAR_ZDLE) 60#define RSP_ZDLE (RSP_VAR + VAR_ZDLE)
65#define RSP_ZVLS (RSP_VAR + VAR_ZVLS) 61#define RSP_ZVLS (RSP_VAR + VAR_ZVLS)
66#define RSP_ZCTP (RSP_VAR + VAR_ZCTP) 62#define RSP_ZCTP (RSP_VAR + VAR_ZCTP)
67#define RSP_STR (RSP_VAR + VAR_NUM) 63#define RSP_STR (RSP_VAR + VAR_NUM)
68#define RSP_NMBR (RSP_STR + STR_NMBR) 64#define RSP_NMBR (RSP_STR + STR_NMBR)
69#define RSP_ZCPN (RSP_STR + STR_ZCPN) 65#define RSP_ZCPN (RSP_STR + STR_ZCPN)
70#define RSP_ZCON (RSP_STR + STR_ZCON) 66#define RSP_ZCON (RSP_STR + STR_ZCON)
71#define RSP_ZBC (RSP_STR + STR_ZBC) 67#define RSP_ZBC (RSP_STR + STR_ZBC)
72#define RSP_ZHLC (RSP_STR + STR_ZHLC) 68#define RSP_ZHLC (RSP_STR + STR_ZHLC)
73#define RSP_ERROR -1 /* ERROR */ 69#define RSP_ERROR -1 /* ERROR */
74#define RSP_WRONG_CID -2 /* unknown cid in cmd */ 70#define RSP_WRONG_CID -2 /* unknown cid in cmd */
75//#define RSP_EMPTY -3 71//#define RSP_EMPTY -3
76#define RSP_UNKNOWN -4 /* unknown response */ 72#define RSP_UNKNOWN -4 /* unknown response */
77#define RSP_FAIL -5 /* internal error */ 73#define RSP_FAIL -5 /* internal error */
78#define RSP_INVAL -6 /* invalid response */ 74#define RSP_INVAL -6 /* invalid response */
79 75
80#define RSP_NONE -19 76#define RSP_NONE -19
81#define RSP_STRING -20 77#define RSP_STRING -20
82#define RSP_NULL -21 78#define RSP_NULL -21
83//#define RSP_RETRYFAIL -22 79//#define RSP_RETRYFAIL -22
84//#define RSP_RETRY -23 80//#define RSP_RETRY -23
85//#define RSP_SKIP -24 81//#define RSP_SKIP -24
86#define RSP_INIT -27 82#define RSP_INIT -27
87#define RSP_ANY -26 83#define RSP_ANY -26
88#define RSP_LAST -28 84#define RSP_LAST -28
89#define RSP_NODEV -9 85#define RSP_NODEV -9
90 86
91/* actions for process_response */ 87/* actions for process_response */
92#define ACT_NOTHING 0 88#define ACT_NOTHING 0
@@ -112,7 +108,7 @@
112#define ACT_DISCONNECT 20 108#define ACT_DISCONNECT 20
113#define ACT_CONNECT 21 109#define ACT_CONNECT 21
114#define ACT_REMOTEREJECT 22 110#define ACT_REMOTEREJECT 22
115#define ACT_CONNTIMEOUT 23 111#define ACT_CONNTIMEOUT 23
116#define ACT_REMOTEHUP 24 112#define ACT_REMOTEHUP 24
117#define ACT_ABORTHUP 25 113#define ACT_ABORTHUP 25
118#define ACT_ICALL 26 114#define ACT_ICALL 26
@@ -127,40 +123,40 @@
127#define ACT_ERROR 35 123#define ACT_ERROR 35
128#define ACT_ABORTCID 36 124#define ACT_ABORTCID 36
129#define ACT_ZCAU 37 125#define ACT_ZCAU 37
130#define ACT_NOTIFY_BC_DOWN 38 126#define ACT_NOTIFY_BC_DOWN 38
131#define ACT_NOTIFY_BC_UP 39 127#define ACT_NOTIFY_BC_UP 39
132#define ACT_DIAL 40 128#define ACT_DIAL 40
133#define ACT_ACCEPT 41 129#define ACT_ACCEPT 41
134#define ACT_PROTO_L2 42 130#define ACT_PROTO_L2 42
135#define ACT_HUP 43 131#define ACT_HUP 43
136#define ACT_IF_LOCK 44 132#define ACT_IF_LOCK 44
137#define ACT_START 45 133#define ACT_START 45
138#define ACT_STOP 46 134#define ACT_STOP 46
139#define ACT_FAKEDLE0 47 135#define ACT_FAKEDLE0 47
140#define ACT_FAKEHUP 48 136#define ACT_FAKEHUP 48
141#define ACT_FAKESDOWN 49 137#define ACT_FAKESDOWN 49
142#define ACT_SHUTDOWN 50 138#define ACT_SHUTDOWN 50
143#define ACT_PROC_CIDMODE 51 139#define ACT_PROC_CIDMODE 51
144#define ACT_UMODESET 52 140#define ACT_UMODESET 52
145#define ACT_FAILUMODE 53 141#define ACT_FAILUMODE 53
146#define ACT_CMODESET 54 142#define ACT_CMODESET 54
147#define ACT_FAILCMODE 55 143#define ACT_FAILCMODE 55
148#define ACT_IF_VER 56 144#define ACT_IF_VER 56
149#define ACT_CMD 100 145#define ACT_CMD 100
150 146
151/* at command sequences */ 147/* at command sequences */
152#define SEQ_NONE 0 148#define SEQ_NONE 0
153#define SEQ_INIT 100 149#define SEQ_INIT 100
154#define SEQ_DLE0 200 150#define SEQ_DLE0 200
155#define SEQ_DLE1 250 151#define SEQ_DLE1 250
156#define SEQ_CID 300 152#define SEQ_CID 300
157#define SEQ_NOCID 350 153#define SEQ_NOCID 350
158#define SEQ_HUP 400 154#define SEQ_HUP 400
159#define SEQ_DIAL 600 155#define SEQ_DIAL 600
160#define SEQ_ACCEPT 720 156#define SEQ_ACCEPT 720
161#define SEQ_SHUTDOWN 500 157#define SEQ_SHUTDOWN 500
162#define SEQ_CIDMODE 10 158#define SEQ_CIDMODE 10
163#define SEQ_UMMODE 11 159#define SEQ_UMMODE 11
164 160
165 161
166// 100: init, 200: dle0, 250:dle1, 300: get cid (dial), 350: "hup" (no cid), 400: hup, 500: reset, 600: dial, 700: ring 162// 100: init, 200: dle0, 250:dle1, 300: get cid (dial), 350: "hup" (no cid), 400: hup, 500: reset, 600: dial, 700: ring
@@ -393,7 +389,7 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */
393 389
394 390
395#if 0 391#if 0
396static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME aenderungen uebernehmen 392static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME
397{ 393{
398 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */ 394 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */
399 395
@@ -401,7 +397,7 @@ static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME aenderungen ueberne
401 {RSP_LAST,0,0,0,0,0,0} 397 {RSP_LAST,0,0,0,0,0,0}
402}; 398};
403 399
404static struct reply_t tab_cid[] = /* no dle mode */ //FIXME aenderungen uebernehmen 400static struct reply_t tab_cid[] = /* no dle mode */ //FIXME
405{ 401{
406 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */ 402 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */
407 403
@@ -412,30 +408,30 @@ static struct reply_t tab_cid[] = /* no dle mode */ //FIXME aenderungen ueberneh
412 408
413static struct resp_type_t resp_type[]= 409static struct resp_type_t resp_type[]=
414{ 410{
415 /*{"", RSP_EMPTY, RT_NOTHING},*/ 411 /*{"", RSP_EMPTY, RT_NOTHING},*/
416 {"OK", RSP_OK, RT_NOTHING}, 412 {"OK", RSP_OK, RT_NOTHING},
417 {"ERROR", RSP_ERROR, RT_NOTHING}, 413 {"ERROR", RSP_ERROR, RT_NOTHING},
418 {"ZSAU", RSP_ZSAU, RT_ZSAU}, 414 {"ZSAU", RSP_ZSAU, RT_ZSAU},
419 {"ZCAU", RSP_ZCAU, RT_ZCAU}, 415 {"ZCAU", RSP_ZCAU, RT_ZCAU},
420 {"RING", RSP_RING, RT_RING}, 416 {"RING", RSP_RING, RT_RING},
421 {"ZGCI", RSP_ZGCI, RT_NUMBER}, 417 {"ZGCI", RSP_ZGCI, RT_NUMBER},
422 {"ZVLS", RSP_ZVLS, RT_NUMBER}, 418 {"ZVLS", RSP_ZVLS, RT_NUMBER},
423 {"ZCTP", RSP_ZCTP, RT_NUMBER}, 419 {"ZCTP", RSP_ZCTP, RT_NUMBER},
424 {"ZDLE", RSP_ZDLE, RT_NUMBER}, 420 {"ZDLE", RSP_ZDLE, RT_NUMBER},
425 {"ZCFGT", RSP_ZCFGT, RT_NUMBER}, 421 {"ZCFGT", RSP_ZCFGT, RT_NUMBER},
426 {"ZCCR", RSP_ZCCR, RT_NUMBER}, 422 {"ZCCR", RSP_ZCCR, RT_NUMBER},
427 {"ZMWI", RSP_ZMWI, RT_NUMBER}, 423 {"ZMWI", RSP_ZMWI, RT_NUMBER},
428 {"ZHLC", RSP_ZHLC, RT_STRING}, 424 {"ZHLC", RSP_ZHLC, RT_STRING},
429 {"ZBC", RSP_ZBC, RT_STRING}, 425 {"ZBC", RSP_ZBC, RT_STRING},
430 {"NMBR", RSP_NMBR, RT_STRING}, 426 {"NMBR", RSP_NMBR, RT_STRING},
431 {"ZCPN", RSP_ZCPN, RT_STRING}, 427 {"ZCPN", RSP_ZCPN, RT_STRING},
432 {"ZCON", RSP_ZCON, RT_STRING}, 428 {"ZCON", RSP_ZCON, RT_STRING},
433 {"ZAOC", RSP_ZAOC, RT_STRING}, 429 {"ZAOC", RSP_ZAOC, RT_STRING},
434 {"ZCSTR", RSP_ZCSTR, RT_STRING}, 430 {"ZCSTR", RSP_ZCSTR, RT_STRING},
435 {"ZCFG", RSP_ZCFG, RT_HEX}, 431 {"ZCFG", RSP_ZCFG, RT_HEX},
436 {"ZLOG", RSP_ZLOG, RT_NOTHING}, 432 {"ZLOG", RSP_ZLOG, RT_NOTHING},
437 {"ZABINFO", RSP_ZABINFO, RT_NOTHING}, 433 {"ZABINFO", RSP_ZABINFO, RT_NOTHING},
438 {"ZSMLSTCHG", RSP_ZSMLSTCHG, RT_NOTHING}, 434 {"ZSMLSTCHG", RSP_ZSMLSTCHG, RT_NOTHING},
439 {NULL,0,0} 435 {NULL,0,0}
440}; 436};
441 437
@@ -837,7 +833,8 @@ static void schedule_init(struct cardstate *cs, int state)
837 dbg(DEBUG_CMD, "Scheduling PC_INIT"); 833 dbg(DEBUG_CMD, "Scheduling PC_INIT");
838} 834}
839 835
840/* Add "AT" to a command, add the cid, dle encode it, send the result to the hardware. */ 836/* Add "AT" to a command, add the cid, dle encode it, send the result to the
837 hardware. */
841static void send_command(struct cardstate *cs, const char *cmd, int cid, 838static void send_command(struct cardstate *cs, const char *cmd, int cid,
842 int dle, gfp_t kmallocflags) 839 int dle, gfp_t kmallocflags)
843{ 840{
@@ -966,19 +963,13 @@ static void start_dial(struct at_state_t *at_state, void *data, int seq_index)
966 963
967 at_state->pending_commands |= PC_CID; 964 at_state->pending_commands |= PC_CID;
968 dbg(DEBUG_CMD, "Scheduling PC_CID"); 965 dbg(DEBUG_CMD, "Scheduling PC_CID");
969//#ifdef GIG_MAYINITONDIAL 966 atomic_set(&cs->commands_pending, 1);
970// if (atomic_read(&cs->MState) == MS_UNKNOWN) {
971// cs->at_state.pending_commands |= PC_INIT;
972// dbg(DEBUG_CMD, "Scheduling PC_INIT");
973// }
974//#endif
975 atomic_set(&cs->commands_pending, 1); //FIXME
976 return; 967 return;
977 968
978error: 969error:
979 at_state->pending_commands |= PC_NOCID; 970 at_state->pending_commands |= PC_NOCID;
980 dbg(DEBUG_CMD, "Scheduling PC_NOCID"); 971 dbg(DEBUG_CMD, "Scheduling PC_NOCID");
981 atomic_set(&cs->commands_pending, 1); //FIXME 972 atomic_set(&cs->commands_pending, 1);
982 return; 973 return;
983} 974}
984 975
@@ -992,12 +983,12 @@ static void start_accept(struct at_state_t *at_state)
992 if (retval == 0) { 983 if (retval == 0) {
993 at_state->pending_commands |= PC_ACCEPT; 984 at_state->pending_commands |= PC_ACCEPT;
994 dbg(DEBUG_CMD, "Scheduling PC_ACCEPT"); 985 dbg(DEBUG_CMD, "Scheduling PC_ACCEPT");
995 atomic_set(&cs->commands_pending, 1); //FIXME 986 atomic_set(&cs->commands_pending, 1);
996 } else { 987 } else {
997 //FIXME 988 //FIXME
998 at_state->pending_commands |= PC_HUP; 989 at_state->pending_commands |= PC_HUP;
999 dbg(DEBUG_CMD, "Scheduling PC_HUP"); 990 dbg(DEBUG_CMD, "Scheduling PC_HUP");
1000 atomic_set(&cs->commands_pending, 1); //FIXME 991 atomic_set(&cs->commands_pending, 1);
1001 } 992 }
1002} 993}
1003 994
@@ -1037,9 +1028,8 @@ static void do_shutdown(struct cardstate *cs)
1037 if (atomic_read(&cs->mstate) == MS_READY) { 1028 if (atomic_read(&cs->mstate) == MS_READY) {
1038 atomic_set(&cs->mstate, MS_SHUTDOWN); 1029 atomic_set(&cs->mstate, MS_SHUTDOWN);
1039 cs->at_state.pending_commands |= PC_SHUTDOWN; 1030 cs->at_state.pending_commands |= PC_SHUTDOWN;
1040 atomic_set(&cs->commands_pending, 1); //FIXME 1031 atomic_set(&cs->commands_pending, 1);
1041 dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN"); //FIXME 1032 dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN");
1042 //gigaset_schedule_event(cs); //FIXME
1043 } else 1033 } else
1044 finish_shutdown(cs); 1034 finish_shutdown(cs);
1045} 1035}
@@ -1160,7 +1150,6 @@ static int do_lock(struct cardstate *cs)
1160 mode = atomic_read(&cs->mode); 1150 mode = atomic_read(&cs->mode);
1161 atomic_set(&cs->mstate, MS_LOCKED); 1151 atomic_set(&cs->mstate, MS_LOCKED);
1162 atomic_set(&cs->mode, M_UNKNOWN); 1152 atomic_set(&cs->mode, M_UNKNOWN);
1163 //FIXME reset card state / at states / bcs states
1164 1153
1165 return mode; 1154 return mode;
1166} 1155}
@@ -1173,7 +1162,6 @@ static int do_unlock(struct cardstate *cs)
1173 atomic_set(&cs->mstate, MS_UNINITIALIZED); 1162 atomic_set(&cs->mstate, MS_UNINITIALIZED);
1174 atomic_set(&cs->mode, M_UNKNOWN); 1163 atomic_set(&cs->mode, M_UNKNOWN);
1175 gigaset_free_channels(cs); 1164 gigaset_free_channels(cs);
1176 //FIXME reset card state / at states / bcs states
1177 if (atomic_read(&cs->connected)) 1165 if (atomic_read(&cs->connected))
1178 schedule_init(cs, MS_INIT); 1166 schedule_init(cs, MS_INIT);
1179 1167
@@ -1203,7 +1191,6 @@ static void do_action(int action, struct cardstate *cs,
1203 at_state->waiting = 1; 1191 at_state->waiting = 1;
1204 break; 1192 break;
1205 case ACT_INIT: 1193 case ACT_INIT:
1206 //FIXME setup everything
1207 cs->at_state.pending_commands &= ~PC_INIT; 1194 cs->at_state.pending_commands &= ~PC_INIT;
1208 cs->cur_at_seq = SEQ_NONE; 1195 cs->cur_at_seq = SEQ_NONE;
1209 atomic_set(&cs->mode, M_UNIMODEM); 1196 atomic_set(&cs->mode, M_UNIMODEM);
@@ -1213,7 +1200,7 @@ static void do_action(int action, struct cardstate *cs,
1213 break; 1200 break;
1214 } 1201 }
1215 cs->at_state.pending_commands |= PC_CIDMODE; 1202 cs->at_state.pending_commands |= PC_CIDMODE;
1216 atomic_set(&cs->commands_pending, 1); //FIXME 1203 atomic_set(&cs->commands_pending, 1);
1217 dbg(DEBUG_CMD, "Scheduling PC_CIDMODE"); 1204 dbg(DEBUG_CMD, "Scheduling PC_CIDMODE");
1218 break; 1205 break;
1219 case ACT_FAILINIT: 1206 case ACT_FAILINIT:
@@ -1428,7 +1415,8 @@ static void do_action(int action, struct cardstate *cs,
1428 at_state->pending_commands |= PC_HUP; 1415 at_state->pending_commands |= PC_HUP;
1429 atomic_set(&cs->commands_pending, 1); 1416 atomic_set(&cs->commands_pending, 1);
1430 break; 1417 break;
1431 case ACT_GETSTRING: /* warning: RING, ZDLE, ... are not handled properly any more */ 1418 case ACT_GETSTRING: /* warning: RING, ZDLE, ...
1419 are not handled properly any more */
1432 at_state->getstring = 1; 1420 at_state->getstring = 1;
1433 break; 1421 break;
1434 case ACT_SETVER: 1422 case ACT_SETVER:
@@ -1522,7 +1510,7 @@ static void do_action(int action, struct cardstate *cs,
1522 break; 1510 break;
1523 case ACT_HUP: 1511 case ACT_HUP:
1524 at_state->pending_commands |= PC_HUP; 1512 at_state->pending_commands |= PC_HUP;
1525 atomic_set(&cs->commands_pending, 1); //FIXME 1513 atomic_set(&cs->commands_pending, 1);
1526 dbg(DEBUG_CMD, "Scheduling PC_HUP"); 1514 dbg(DEBUG_CMD, "Scheduling PC_HUP");
1527 break; 1515 break;
1528 1516
@@ -1649,7 +1637,8 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1649 dbg(DEBUG_ANY, "stopped waiting"); 1637 dbg(DEBUG_ANY, "stopped waiting");
1650 } 1638 }
1651 1639
1652 /* if the response belongs to a variable in at_state->int_var[VAR_XXXX] or at_state->str_var[STR_XXXX], set it */ 1640 /* if the response belongs to a variable in at_state->int_var[VAR_XXXX]
1641 or at_state->str_var[STR_XXXX], set it */
1653 if (ev->type >= RSP_VAR && ev->type < RSP_VAR + VAR_NUM) { 1642 if (ev->type >= RSP_VAR && ev->type < RSP_VAR + VAR_NUM) {
1654 index = ev->type - RSP_VAR; 1643 index = ev->type - RSP_VAR;
1655 at_state->int_var[index] = ev->parameter; 1644 at_state->int_var[index] = ev->parameter;
@@ -1657,13 +1646,15 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1657 index = ev->type - RSP_STR; 1646 index = ev->type - RSP_STR;
1658 kfree(at_state->str_var[index]); 1647 kfree(at_state->str_var[index]);
1659 at_state->str_var[index] = ev->ptr; 1648 at_state->str_var[index] = ev->ptr;
1660 ev->ptr = NULL; /* prevent process_events() from deallocating ptr */ 1649 ev->ptr = NULL; /* prevent process_events() from
1650 deallocating ptr */
1661 } 1651 }
1662 1652
1663 if (ev->type == EV_TIMEOUT || ev->type == RSP_STRING) 1653 if (ev->type == EV_TIMEOUT || ev->type == RSP_STRING)
1664 at_state->getstring = 0; 1654 at_state->getstring = 0;
1665 1655
1666 /* Search row in dial array which matches modem response and current constate */ 1656 /* Search row in dial array which matches modem response and current
1657 constate */
1667 for (;; rep++) { 1658 for (;; rep++) {
1668 rcode = rep->resp_code; 1659 rcode = rep->resp_code;
1669 /* dbg (DEBUG_ANY, "rcode %d", rcode); */ 1660 /* dbg (DEBUG_ANY, "rcode %d", rcode); */
@@ -1865,11 +1856,7 @@ static void process_command_flags(struct cardstate *cs)
1865 if (cs->at_state.pending_commands & PC_CIDMODE) { 1856 if (cs->at_state.pending_commands & PC_CIDMODE) {
1866 cs->at_state.pending_commands &= ~PC_CIDMODE; 1857 cs->at_state.pending_commands &= ~PC_CIDMODE;
1867 if (atomic_read(&cs->mode) == M_UNIMODEM) { 1858 if (atomic_read(&cs->mode) == M_UNIMODEM) {
1868#if 0
1869 cs->retry_count = 2;
1870#else
1871 cs->retry_count = 1; 1859 cs->retry_count = 1;
1872#endif
1873 schedule_sequence(cs, &cs->at_state, SEQ_CIDMODE); 1860 schedule_sequence(cs, &cs->at_state, SEQ_CIDMODE);
1874 return; 1861 return;
1875 } 1862 }
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index 729edcdb6dac..d34f0023ac74 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -1,11 +1,16 @@
1/* Siemens Gigaset 307x driver 1/*
2 * Siemens Gigaset 307x driver
2 * Common header file for all connection variants 3 * Common header file for all connection variants
3 * 4 *
4 * Written by Stefan Eilers <Eilers.Stefan@epost.de> 5 * Written by Stefan Eilers <Eilers.Stefan@epost.de>
5 * and Hansjoerg Lipp <hjlipp@web.de> 6 * and Hansjoerg Lipp <hjlipp@web.de>
6 * 7 *
7 * Version: $Id: gigaset.h,v 1.97.4.26 2006/02/04 18:28:16 hjlipp Exp $ 8 * =====================================================================
8 * =========================================================================== 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 * =====================================================================
9 */ 14 */
10 15
11#ifndef GIGASET_H 16#ifndef GIGASET_H
@@ -15,7 +20,6 @@
15#include <linux/kernel.h> 20#include <linux/kernel.h>
16#include <linux/compiler.h> 21#include <linux/compiler.h>
17#include <linux/types.h> 22#include <linux/types.h>
18#include <asm/atomic.h>
19#include <linux/spinlock.h> 23#include <linux/spinlock.h>
20#include <linux/isdnif.h> 24#include <linux/isdnif.h>
21#include <linux/usb.h> 25#include <linux/usb.h>
@@ -27,21 +31,22 @@
27#include <linux/tty.h> 31#include <linux/tty.h>
28#include <linux/tty_driver.h> 32#include <linux/tty_driver.h>
29#include <linux/list.h> 33#include <linux/list.h>
34#include <asm/atomic.h>
30 35
31#define GIG_VERSION {0,5,0,0} 36#define GIG_VERSION {0,5,0,0}
32#define GIG_COMPAT {0,4,0,0} 37#define GIG_COMPAT {0,4,0,0}
33 38
34#define MAX_REC_PARAMS 10 /* Max. number of params in response string */ 39#define MAX_REC_PARAMS 10 /* Max. number of params in response string */
35#define MAX_RESP_SIZE 512 /* Max. size of a response string */ 40#define MAX_RESP_SIZE 512 /* Max. size of a response string */
36#define HW_HDR_LEN 2 /* Header size used to store ack info */ 41#define HW_HDR_LEN 2 /* Header size used to store ack info */
37 42
38#define MAX_EVENTS 64 /* size of event queue */ 43#define MAX_EVENTS 64 /* size of event queue */
39 44
40#define RBUFSIZE 8192 45#define RBUFSIZE 8192
41#define SBUFSIZE 4096 /* sk_buff payload size */ 46#define SBUFSIZE 4096 /* sk_buff payload size */
42 47
43#define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */ 48#define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */
44#define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */ 49#define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */
45 50
46/* compile time options */ 51/* compile time options */
47#define GIG_MAJOR 0 52#define GIG_MAJOR 0
@@ -67,68 +72,108 @@
67 72
68#define MAXACT 3 73#define MAXACT 3
69 74
70#define IFNULL(a) if (unlikely(!(a))) 75#define IFNULL(a) \
71#define IFNULLRET(a) if (unlikely(!(a))) {err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); return; } 76 if (unlikely(!(a)))
72#define IFNULLRETVAL(a,b) if (unlikely(!(a))) {err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); return (b); } 77
73#define IFNULLCONT(a) if (unlikely(!(a))) {err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); continue; } 78#define IFNULLRET(a) \
74#define IFNULLGOTO(a,b) if (unlikely(!(a))) {err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); goto b; } 79 if (unlikely(!(a))) { \
80 err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
81 return; \
82 }
83
84#define IFNULLRETVAL(a,b) \
85 if (unlikely(!(a))) { \
86 err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
87 return (b); \
88 }
89
90#define IFNULLCONT(a) \
91 if (unlikely(!(a))) { \
92 err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
93 continue; \
94 }
95
96#define IFNULLGOTO(a,b) \
97 if (unlikely(!(a))) { \
98 err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
99 goto b; \
100 }
75 101
76extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */ 102extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */
77 103
78/* any combination of these can be given with the 'debug=' parameter to insmod, e.g. 104/* any combination of these can be given with the 'debug=' parameter to insmod,
79 * 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and DEBUG_INTR. */ 105 * e.g. 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and
106 * DEBUG_INTR.
107 */
80enum debuglevel { /* up to 24 bits (atomic_t) */ 108enum debuglevel { /* up to 24 bits (atomic_t) */
81 DEBUG_REG = 0x0002, /* serial port I/O register operations */ 109 DEBUG_REG = 0x0002,/* serial port I/O register operations */
82 DEBUG_OPEN = 0x0004, /* open/close serial port */ 110 DEBUG_OPEN = 0x0004, /* open/close serial port */
83 DEBUG_INTR = 0x0008, /* interrupt processing */ 111 DEBUG_INTR = 0x0008, /* interrupt processing */
84 DEBUG_INTR_DUMP = 0x0010, /* Activating hexdump debug output on interrupt 112 DEBUG_INTR_DUMP = 0x0010, /* Activating hexdump debug output on
85 requests, not available as run-time option */ 113 interrupt requests, not available as
114 run-time option */
86 DEBUG_CMD = 0x00020, /* sent/received LL commands */ 115 DEBUG_CMD = 0x00020, /* sent/received LL commands */
87 DEBUG_STREAM = 0x00040, /* application data stream I/O events */ 116 DEBUG_STREAM = 0x00040, /* application data stream I/O events */
88 DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */ 117 DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */
89 DEBUG_LLDATA = 0x00100, /* sent/received LL data */ 118 DEBUG_LLDATA = 0x00100, /* sent/received LL data */
90 DEBUG_INTR_0 = 0x00200, /* serial port output interrupt processing */ 119 DEBUG_INTR_0 = 0x00200, /* serial port interrupt processing */
91 DEBUG_DRIVER = 0x00400, /* driver structure */ 120 DEBUG_DRIVER = 0x00400, /* driver structure */
92 DEBUG_HDLC = 0x00800, /* M10x HDLC processing */ 121 DEBUG_HDLC = 0x00800, /* M10x HDLC processing */
93 DEBUG_WRITE = 0x01000, /* M105 data write */ 122 DEBUG_WRITE = 0x01000, /* M105 data write */
94 DEBUG_TRANSCMD = 0x02000, /*AT-COMMANDS+RESPONSES*/ 123 DEBUG_TRANSCMD = 0x02000, /* AT-COMMANDS+RESPONSES */
95 DEBUG_MCMD = 0x04000, /*COMMANDS THAT ARE SENT VERY OFTEN*/ 124 DEBUG_MCMD = 0x04000, /* COMMANDS THAT ARE SENT VERY OFTEN */
96 DEBUG_INIT = 0x08000, /* (de)allocation+initialization of data structures */ 125 DEBUG_INIT = 0x08000, /* (de)allocation+initialization of data
126 structures */
97 DEBUG_LOCK = 0x10000, /* semaphore operations */ 127 DEBUG_LOCK = 0x10000, /* semaphore operations */
98 DEBUG_OUTPUT = 0x20000, /* output to device */ 128 DEBUG_OUTPUT = 0x20000, /* output to device */
99 DEBUG_ISO = 0x40000, /* isochronous transfers */ 129 DEBUG_ISO = 0x40000, /* isochronous transfers */
100 DEBUG_IF = 0x80000, /* character device operations */ 130 DEBUG_IF = 0x80000, /* character device operations */
101 DEBUG_USBREQ = 0x100000, /* USB communication (except payload data) */ 131 DEBUG_USBREQ = 0x100000, /* USB communication (except payload
102 DEBUG_LOCKCMD = 0x200000, /* AT commands and responses when MS_LOCKED */ 132 data) */
133 DEBUG_LOCKCMD = 0x200000, /* AT commands and responses when
134 MS_LOCKED */
103 135
104 DEBUG_ANY = 0x3fffff, /* print message if any of the others is activated */ 136 DEBUG_ANY = 0x3fffff, /* print message if any of the others is
137 activated */
105}; 138};
106 139
107#ifdef CONFIG_GIGASET_DEBUG 140#ifdef CONFIG_GIGASET_DEBUG
108#define DEBUG_DEFAULT (DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ) 141#define DEBUG_DEFAULT (DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ)
109//#define DEBUG_DEFAULT (DEBUG_LOCK | DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUF_IF | DEBUG_DRIVER | DEBUG_OUTPUT | DEBUG_INTR)
110#else 142#else
111#define DEBUG_DEFAULT 0 143#define DEBUG_DEFAULT 0
112#endif 144#endif
113 145
114/* redefine syslog macros to prepend module name instead of entire source path */ 146/* redefine syslog macros to prepend module name instead of entire
115/* The space before the comma in ", ##" is needed by gcc 2.95 */ 147 * source path */
116#undef info 148#undef info
117#define info(format, arg...) printk(KERN_INFO "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg) 149#define info(format, arg...) \
150 printk(KERN_INFO "%s: " format "\n", \
151 THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
118 152
119#undef notice 153#undef notice
120#define notice(format, arg...) printk(KERN_NOTICE "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg) 154#define notice(format, arg...) \
155 printk(KERN_NOTICE "%s: " format "\n", \
156 THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
121 157
122#undef warn 158#undef warn
123#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg) 159#define warn(format, arg...) \
160 printk(KERN_WARNING "%s: " format "\n", \
161 THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
124 162
125#undef err 163#undef err
126#define err(format, arg...) printk(KERN_ERR "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg) 164#define err(format, arg...) \
165 printk(KERN_ERR "%s: " format "\n", \
166 THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
127 167
128#undef dbg 168#undef dbg
129#ifdef CONFIG_GIGASET_DEBUG 169#ifdef CONFIG_GIGASET_DEBUG
130#define dbg(level, format, arg...) do { if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \ 170#define dbg(level, format, arg...) \
131 printk(KERN_DEBUG "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg); } while (0) 171 do { \
172 if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \
173 printk(KERN_DEBUG "%s: " format "\n", \
174 THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" \
175 , ## arg); \
176 } while (0)
132#else 177#else
133#define dbg(level, format, arg...) do {} while (0) 178#define dbg(level, format, arg...) do {} while (0)
134#endif 179#endif
@@ -148,13 +193,14 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
148#define ZSAU_UNKNOWN -1 193#define ZSAU_UNKNOWN -1
149 194
150/* USB control transfer requests */ 195/* USB control transfer requests */
151#define OUT_VENDOR_REQ (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT) 196#define OUT_VENDOR_REQ (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT)
152#define IN_VENDOR_REQ (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT) 197#define IN_VENDOR_REQ (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT)
153 198
154/* int-in-events 3070 */ 199/* int-in-events 3070 */
155#define HD_B1_FLOW_CONTROL 0x80 200#define HD_B1_FLOW_CONTROL 0x80
156#define HD_B2_FLOW_CONTROL 0x81 201#define HD_B2_FLOW_CONTROL 0x81
157#define HD_RECEIVEATDATA_ACK (0x35) // 3070 // att: HD_RECEIVE>>AT<<DATA_ACK 202#define HD_RECEIVEATDATA_ACK (0x35) // 3070
203 // att: HD_RECEIVE>>AT<<DATA_ACK
158#define HD_READY_SEND_ATDATA (0x36) // 3070 204#define HD_READY_SEND_ATDATA (0x36) // 3070
159#define HD_OPEN_ATCHANNEL_ACK (0x37) // 3070 205#define HD_OPEN_ATCHANNEL_ACK (0x37) // 3070
160#define HD_CLOSE_ATCHANNEL_ACK (0x38) // 3070 206#define HD_CLOSE_ATCHANNEL_ACK (0x38) // 3070
@@ -181,17 +227,18 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
181#define HD_CLOSE_ATCHANNEL (0x29) // 3070 227#define HD_CLOSE_ATCHANNEL (0x29) // 3070
182 228
183/* USB frames for isochronous transfer */ 229/* USB frames for isochronous transfer */
184#define BAS_FRAMETIME 1 /* number of milliseconds between frames */ 230#define BAS_FRAMETIME 1 /* number of milliseconds between frames */
185#define BAS_NUMFRAMES 8 /* number of frames per URB */ 231#define BAS_NUMFRAMES 8 /* number of frames per URB */
186#define BAS_MAXFRAME 16 /* allocated bytes per frame */ 232#define BAS_MAXFRAME 16 /* allocated bytes per frame */
187#define BAS_NORMFRAME 8 /* send size without flow control */ 233#define BAS_NORMFRAME 8 /* send size without flow control */
188#define BAS_HIGHFRAME 10 /* " " with positive flow control */ 234#define BAS_HIGHFRAME 10 /* " " with positive flow control */
189#define BAS_LOWFRAME 5 /* " " with negative flow control */ 235#define BAS_LOWFRAME 5 /* " " with negative flow control */
190#define BAS_CORRFRAMES 4 /* flow control multiplicator */ 236#define BAS_CORRFRAMES 4 /* flow control multiplicator */
191 237
192#define BAS_INBUFSIZE (BAS_MAXFRAME * BAS_NUMFRAMES) /* size of isochronous input buffer per URB */ 238#define BAS_INBUFSIZE (BAS_MAXFRAME * BAS_NUMFRAMES)
193#define BAS_OUTBUFSIZE 4096 /* size of common isochronous output buffer */ 239 /* size of isoc in buf per URB */
194#define BAS_OUTBUFPAD BAS_MAXFRAME /* size of pad area for isochronous output buffer */ 240#define BAS_OUTBUFSIZE 4096 /* size of common isoc out buffer */
241#define BAS_OUTBUFPAD BAS_MAXFRAME /* size of pad area for isoc out buf */
195 242
196#define BAS_INURBS 3 243#define BAS_INURBS 3
197#define BAS_OUTURBS 3 244#define BAS_OUTURBS 3
@@ -207,40 +254,40 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
207#define AT_NUM 7 254#define AT_NUM 7
208 255
209/* variables in struct at_state_t */ 256/* variables in struct at_state_t */
210#define VAR_ZSAU 0 257#define VAR_ZSAU 0
211#define VAR_ZDLE 1 258#define VAR_ZDLE 1
212#define VAR_ZVLS 2 259#define VAR_ZVLS 2
213#define VAR_ZCTP 3 260#define VAR_ZCTP 3
214#define VAR_NUM 4 261#define VAR_NUM 4
215 262
216#define STR_NMBR 0 263#define STR_NMBR 0
217#define STR_ZCPN 1 264#define STR_ZCPN 1
218#define STR_ZCON 2 265#define STR_ZCON 2
219#define STR_ZBC 3 266#define STR_ZBC 3
220#define STR_ZHLC 4 267#define STR_ZHLC 4
221#define STR_NUM 5 268#define STR_NUM 5
222 269
223#define EV_TIMEOUT -105 270#define EV_TIMEOUT -105
224#define EV_IF_VER -106 271#define EV_IF_VER -106
225#define EV_PROC_CIDMODE -107 272#define EV_PROC_CIDMODE -107
226#define EV_SHUTDOWN -108 273#define EV_SHUTDOWN -108
227#define EV_START -110 274#define EV_START -110
228#define EV_STOP -111 275#define EV_STOP -111
229#define EV_IF_LOCK -112 276#define EV_IF_LOCK -112
230#define EV_PROTO_L2 -113 277#define EV_PROTO_L2 -113
231#define EV_ACCEPT -114 278#define EV_ACCEPT -114
232#define EV_DIAL -115 279#define EV_DIAL -115
233#define EV_HUP -116 280#define EV_HUP -116
234#define EV_BC_OPEN -117 281#define EV_BC_OPEN -117
235#define EV_BC_CLOSED -118 282#define EV_BC_CLOSED -118
236 283
237/* input state */ 284/* input state */
238#define INS_command 0x0001 285#define INS_command 0x0001
239#define INS_DLE_char 0x0002 286#define INS_DLE_char 0x0002
240#define INS_byte_stuff 0x0004 287#define INS_byte_stuff 0x0004
241#define INS_have_data 0x0008 288#define INS_have_data 0x0008
242#define INS_skip_frame 0x0010 289#define INS_skip_frame 0x0010
243#define INS_DLE_command 0x0020 290#define INS_DLE_command 0x0020
244#define INS_flag_hunt 0x0040 291#define INS_flag_hunt 0x0040
245 292
246/* channel state */ 293/* channel state */
@@ -248,27 +295,27 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
248#define CHS_B_UP 0x02 295#define CHS_B_UP 0x02
249#define CHS_NOTIFY_LL 0x04 296#define CHS_NOTIFY_LL 0x04
250 297
251#define ICALL_REJECT 0 298#define ICALL_REJECT 0
252#define ICALL_ACCEPT 1 299#define ICALL_ACCEPT 1
253#define ICALL_IGNORE 2 300#define ICALL_IGNORE 2
254 301
255/* device state */ 302/* device state */
256#define MS_UNINITIALIZED 0 303#define MS_UNINITIALIZED 0
257#define MS_INIT 1 304#define MS_INIT 1
258#define MS_LOCKED 2 305#define MS_LOCKED 2
259#define MS_SHUTDOWN 3 306#define MS_SHUTDOWN 3
260#define MS_RECOVER 4 307#define MS_RECOVER 4
261#define MS_READY 5 308#define MS_READY 5
262 309
263/* mode */ 310/* mode */
264#define M_UNKNOWN 0 311#define M_UNKNOWN 0
265#define M_CONFIG 1 312#define M_CONFIG 1
266#define M_UNIMODEM 2 313#define M_UNIMODEM 2
267#define M_CID 3 314#define M_CID 3
268 315
269/* start mode */ 316/* start mode */
270#define SM_LOCKED 0 317#define SM_LOCKED 0
271#define SM_ISDN 1 /* default */ 318#define SM_ISDN 1 /* default */
272 319
273struct gigaset_ops; 320struct gigaset_ops;
274struct gigaset_driver; 321struct gigaset_driver;
@@ -283,27 +330,26 @@ struct ser_bc_state;
283struct bas_bc_state; 330struct bas_bc_state;
284 331
285struct reply_t { 332struct reply_t {
286 int resp_code; /* RSP_XXXX */ 333 int resp_code; /* RSP_XXXX */
287 int min_ConState; /* <0 => ignore */ 334 int min_ConState; /* <0 => ignore */
288 int max_ConState; /* <0 => ignore */ 335 int max_ConState; /* <0 => ignore */
289 int parameter; /* e.g. ZSAU_XXXX <0: ignore*/ 336 int parameter; /* e.g. ZSAU_XXXX <0: ignore*/
290 int new_ConState; /* <0 => ignore */ 337 int new_ConState; /* <0 => ignore */
291 int timeout; /* >0 => *HZ; <=0 => TOUT_XXXX*/ 338 int timeout; /* >0 => *HZ; <=0 => TOUT_XXXX*/
292 int action[MAXACT]; /* ACT_XXXX */ 339 int action[MAXACT]; /* ACT_XXXX */
293 char *command; /* NULL==none */ 340 char *command; /* NULL==none */
294}; 341};
295 342
296extern struct reply_t gigaset_tab_cid_m10x[]; 343extern struct reply_t gigaset_tab_cid_m10x[];
297extern struct reply_t gigaset_tab_nocid_m10x[]; 344extern struct reply_t gigaset_tab_nocid_m10x[];
298 345
299struct inbuf_t { 346struct inbuf_t {
300 unsigned char *rcvbuf; /* usb-gigaset receive buffer */ 347 unsigned char *rcvbuf; /* usb-gigaset receive buffer */
301 struct bc_state *bcs; 348 struct bc_state *bcs;
302 struct cardstate *cs; 349 struct cardstate *cs;
303 int inputstate; 350 int inputstate;
304 351 atomic_t head, tail;
305 atomic_t head, tail; 352 unsigned char data[RBUFSIZE];
306 unsigned char data[RBUFSIZE];
307}; 353};
308 354
309/* isochronous write buffer structure 355/* isochronous write buffer structure
@@ -319,16 +365,19 @@ struct inbuf_t {
319 * if writesem <= 0, data[write..read-1] is currently being written to 365 * if writesem <= 0, data[write..read-1] is currently being written to
320 * - idle contains the byte value to repeat when the end of valid data is 366 * - idle contains the byte value to repeat when the end of valid data is
321 * reached; if nextread==write (buffer contains no data to send), either the 367 * reached; if nextread==write (buffer contains no data to send), either the
322 * BAS_OUTBUFPAD bytes immediately before data[write] (if write>=BAS_OUTBUFPAD) 368 * BAS_OUTBUFPAD bytes immediately before data[write] (if
323 * or those of the pad area (if write<BAS_OUTBUFPAD) are also filled with that 369 * write>=BAS_OUTBUFPAD) or those of the pad area (if write<BAS_OUTBUFPAD)
324 * value 370 * are also filled with that value
325 * - optionally, the following statistics on the buffer's usage can be collected: 371 * - optionally, the following statistics on the buffer's usage can be
326 * maxfill: maximum number of bytes occupied 372 * collected:
327 * idlefills: number of times a frame of idle bytes is prepared 373 * maxfill: maximum number of bytes occupied
328 * emptygets: number of times the buffer was empty when a data frame was requested 374 * idlefills: number of times a frame of idle bytes is prepared
375 * emptygets: number of times the buffer was empty when a data frame was
376 * requested
329 * backtoback: number of times two data packets were entered into the buffer 377 * backtoback: number of times two data packets were entered into the buffer
330 * without intervening idle flags 378 * without intervening idle flags
331 * nakedback: set if no idle flags have been inserted since the last data packet 379 * nakedback: set if no idle flags have been inserted since the last data
380 * packet
332 */ 381 */
333struct isowbuf_t { 382struct isowbuf_t {
334 atomic_t read; 383 atomic_t read;
@@ -358,34 +407,28 @@ struct isow_urbctx_t {
358 * it is currently assigned a B channel 407 * it is currently assigned a B channel
359 */ 408 */
360struct at_state_t { 409struct at_state_t {
361 struct list_head list; 410 struct list_head list;
362 int waiting; 411 int waiting;
363 int getstring; 412 int getstring;
364 atomic_t timer_index; 413 atomic_t timer_index;
365 unsigned long timer_expires; 414 unsigned long timer_expires;
366 int timer_active; 415 int timer_active;
367 unsigned int ConState; /* State of connection */ 416 unsigned int ConState; /* State of connection */
368 struct reply_t *replystruct; 417 struct reply_t *replystruct;
369 int cid; 418 int cid;
370 int int_var[VAR_NUM]; /* see VAR_XXXX */ 419 int int_var[VAR_NUM]; /* see VAR_XXXX */
371 char *str_var[STR_NUM]; /* see STR_XXXX */ 420 char *str_var[STR_NUM]; /* see STR_XXXX */
372 unsigned pending_commands; /* see PC_XXXX */ 421 unsigned pending_commands; /* see PC_XXXX */
373 atomic_t seq_index; 422 atomic_t seq_index;
374 423
375 struct cardstate *cs; 424 struct cardstate *cs;
376 struct bc_state *bcs; 425 struct bc_state *bcs;
377}; 426};
378 427
379struct resp_type_t { 428struct resp_type_t {
380 unsigned char *response; 429 unsigned char *response;
381 int resp_code; /* RSP_XXXX */ 430 int resp_code; /* RSP_XXXX */
382 int type; /* RT_XXXX */ 431 int type; /* RT_XXXX */
383};
384
385struct prot_skb {
386 atomic_t empty;
387 struct semaphore *sem;
388 struct sk_buff *skb;
389}; 432};
390 433
391struct event_t { 434struct event_t {
@@ -398,29 +441,29 @@ struct event_t {
398 441
399/* This buffer holds all information about the used B-Channel */ 442/* This buffer holds all information about the used B-Channel */
400struct bc_state { 443struct bc_state {
401 struct sk_buff *tx_skb; /* Current transfer buffer to modem */ 444 struct sk_buff *tx_skb; /* Current transfer buffer to modem */
402 struct sk_buff_head squeue; /* B-Channel send Queue */ 445 struct sk_buff_head squeue; /* B-Channel send Queue */
403 446
404 /* Variables for debugging .. */ 447 /* Variables for debugging .. */
405 int corrupted; /* Counter for corrupted packages */ 448 int corrupted; /* Counter for corrupted packages */
406 int trans_down; /* Counter of packages (downstream) */ 449 int trans_down; /* Counter of packages (downstream) */
407 int trans_up; /* Counter of packages (upstream) */ 450 int trans_up; /* Counter of packages (upstream) */
408 451
409 struct at_state_t at_state; 452 struct at_state_t at_state;
410 unsigned long rcvbytes; 453 unsigned long rcvbytes;
411 454
412 __u16 fcs; 455 __u16 fcs;
413 struct sk_buff *skb; 456 struct sk_buff *skb;
414 int inputstate; /* see INS_XXXX */ 457 int inputstate; /* see INS_XXXX */
415 458
416 int channel; 459 int channel;
417 460
418 struct cardstate *cs; 461 struct cardstate *cs;
419 462
420 unsigned chstate; /* bitmap (CHS_*) */ 463 unsigned chstate; /* bitmap (CHS_*) */
421 int ignore; 464 int ignore;
422 unsigned proto2; /* Layer 2 protocol (ISDN_PROTO_L2_*) */ 465 unsigned proto2; /* Layer 2 protocol (ISDN_PROTO_L2_*) */
423 char *commands[AT_NUM]; /* see AT_XXXX */ 466 char *commands[AT_NUM]; /* see AT_XXXX */
424 467
425#ifdef CONFIG_GIGASET_DEBUG 468#ifdef CONFIG_GIGASET_DEBUG
426 int emptycount; 469 int emptycount;
@@ -430,9 +473,9 @@ struct bc_state {
430 473
431 /* hardware drivers */ 474 /* hardware drivers */
432 union { 475 union {
433 struct ser_bc_state *ser; /* private data of serial hardware driver */ 476 struct ser_bc_state *ser; /* serial hardware driver */
434 struct usb_bc_state *usb; /* private data of usb hardware driver */ 477 struct usb_bc_state *usb; /* usb hardware driver (m105) */
435 struct bas_bc_state *bas; 478 struct bas_bc_state *bas; /* usb hardware driver (base) */
436 } hw; 479 } hw;
437}; 480};
438 481
@@ -443,22 +486,23 @@ struct cardstate {
443 const struct gigaset_ops *ops; 486 const struct gigaset_ops *ops;
444 487
445 /* Stuff to handle communication */ 488 /* Stuff to handle communication */
446 //wait_queue_head_t initwait;
447 wait_queue_head_t waitqueue; 489 wait_queue_head_t waitqueue;
448 int waiting; 490 int waiting;
449 atomic_t mode; /* see M_XXXX */ 491 atomic_t mode; /* see M_XXXX */
450 atomic_t mstate; /* Modem state: see MS_XXXX */ 492 atomic_t mstate; /* Modem state: see MS_XXXX */
451 /* only changed by the event layer */ 493 /* only changed by the event layer */
452 int cmd_result; 494 int cmd_result;
453 495
454 int channels; 496 int channels;
455 struct bc_state *bcs; /* Array of struct bc_state */ 497 struct bc_state *bcs; /* Array of struct bc_state */
456 498
457 int onechannel; /* data and commands transmitted in one stream (M10x) */ 499 int onechannel; /* data and commands transmitted in one
500 stream (M10x) */
458 501
459 spinlock_t lock; 502 spinlock_t lock;
460 struct at_state_t at_state; /* at_state_t for cid == 0 */ 503 struct at_state_t at_state; /* at_state_t for cid == 0 */
461 struct list_head temp_at_states; /* list of temporary "struct at_state_t"s without B channel */ 504 struct list_head temp_at_states;/* list of temporary "struct
505 at_state_t"s without B channel */
462 506
463 struct inbuf_t *inbuf; 507 struct inbuf_t *inbuf;
464 508
@@ -474,36 +518,47 @@ struct cardstate {
474 unsigned fwver[4]; 518 unsigned fwver[4];
475 int gotfwver; 519 int gotfwver;
476 520
477 atomic_t running; /* !=0 if events are handled */ 521 atomic_t running; /* !=0 if events are handled */
478 atomic_t connected; /* !=0 if hardware is connected */ 522 atomic_t connected; /* !=0 if hardware is connected */
479 523
480 atomic_t cidmode; 524 atomic_t cidmode;
481 525
482 int myid; /* id for communication with LL */ 526 int myid; /* id for communication with LL */
483 isdn_if iif; 527 isdn_if iif;
484 528
485 struct reply_t *tabnocid; 529 struct reply_t *tabnocid;
486 struct reply_t *tabcid; 530 struct reply_t *tabcid;
487 int cs_init; 531 int cs_init;
488 int ignoreframes; /* frames to ignore after setting up the B channel */ 532 int ignoreframes; /* frames to ignore after setting up the
489 struct semaphore sem; /* locks this structure: */ 533 B channel */
490 /* connected is not changed, */ 534 struct semaphore sem; /* locks this structure: */
491 /* hardware_up is not changed, */ 535 /* connected is not changed, */
492 /* MState is not changed to or from MS_LOCKED */ 536 /* hardware_up is not changed, */
537 /* MState is not changed to or from
538 MS_LOCKED */
493 539
494 struct timer_list timer; 540 struct timer_list timer;
495 int retry_count; 541 int retry_count;
496 int dle; /* !=0 if modem commands/responses are dle encoded */ 542 int dle; /* !=0 if modem commands/responses are
497 int cur_at_seq; /* sequence of AT commands being processed */ 543 dle encoded */
498 int curchannel; /* channel, those commands are meant for */ 544 int cur_at_seq; /* sequence of AT commands being
499 atomic_t commands_pending; /* flag(s) in xxx.commands_pending have been set */ 545 processed */
500 struct tasklet_struct event_tasklet; /* tasklet for serializing AT commands. Scheduled 546 int curchannel; /* channel, those commands are meant
501 * -> for modem reponses (and incomming data for M10x) 547 for */
502 * -> on timeout 548 atomic_t commands_pending; /* flag(s) in xxx.commands_pending have
503 * -> after setting bits in xxx.at_state.pending_command 549 been set */
504 * (e.g. command from LL) */ 550 struct tasklet_struct event_tasklet;
505 struct tasklet_struct write_tasklet; /* tasklet for serial output 551 /* tasklet for serializing AT commands.
506 * (not used in base driver) */ 552 * Scheduled
553 * -> for modem reponses (and
554 * incomming data for M10x)
555 * -> on timeout
556 * -> after setting bits in
557 * xxx.at_state.pending_command
558 * (e.g. command from LL) */
559 struct tasklet_struct write_tasklet;
560 /* tasklet for serial output
561 * (not used in base driver) */
507 562
508 /* event queue */ 563 /* event queue */
509 struct event_t events[MAX_EVENTS]; 564 struct event_t events[MAX_EVENTS];
@@ -516,16 +571,15 @@ struct cardstate {
516 571
517 /* hardware drivers */ 572 /* hardware drivers */
518 union { 573 union {
519 struct usb_cardstate *usb; /* private data of USB hardware driver */ 574 struct usb_cardstate *usb; /* USB hardware driver (m105) */
520 struct ser_cardstate *ser; /* private data of serial hardware driver */ 575 struct ser_cardstate *ser; /* serial hardware driver */
521 struct bas_cardstate *bas; /* private data of base hardware driver */ 576 struct bas_cardstate *bas; /* USB hardware driver (base) */
522 } hw; 577 } hw;
523}; 578};
524 579
525struct gigaset_driver { 580struct gigaset_driver {
526 struct list_head list; 581 struct list_head list;
527 spinlock_t lock; /* locks minor tables and blocked */ 582 spinlock_t lock; /* locks minor tables and blocked */
528 //struct semaphore sem; /* locks this structure */
529 struct tty_driver *tty; 583 struct tty_driver *tty;
530 unsigned have_tty; 584 unsigned have_tty;
531 unsigned minor; 585 unsigned minor;
@@ -553,7 +607,8 @@ struct bas_bc_state {
553 struct isow_urbctx_t isoouturbs[BAS_OUTURBS]; 607 struct isow_urbctx_t isoouturbs[BAS_OUTURBS];
554 struct isow_urbctx_t *isooutdone, *isooutfree, *isooutovfl; 608 struct isow_urbctx_t *isooutdone, *isooutfree, *isooutovfl;
555 struct isowbuf_t *isooutbuf; 609 struct isowbuf_t *isooutbuf;
556 unsigned numsub; /* submitted URB counter (for diagnostic messages only) */ 610 unsigned numsub; /* submitted URB counter (for
611 diagnostic messages only) */
557 struct tasklet_struct sent_tasklet; 612 struct tasklet_struct sent_tasklet;
558 613
559 /* isochronous input state */ 614 /* isochronous input state */
@@ -563,24 +618,31 @@ struct bas_bc_state {
563 struct urb *isoindone; /* completed isoc read URB */ 618 struct urb *isoindone; /* completed isoc read URB */
564 int loststatus; /* status of dropped URB */ 619 int loststatus; /* status of dropped URB */
565 unsigned isoinlost; /* number of bytes lost */ 620 unsigned isoinlost; /* number of bytes lost */
566 /* state of bit unstuffing algorithm (in addition to BC_state.inputstate) */ 621 /* state of bit unstuffing algorithm (in addition to
567 unsigned seqlen; /* number of '1' bits not yet unstuffed */ 622 BC_state.inputstate) */
568 unsigned inbyte, inbits; /* collected bits for next byte */ 623 unsigned seqlen; /* number of '1' bits not yet
624 unstuffed */
625 unsigned inbyte, inbits; /* collected bits for next byte
626 */
569 /* statistics */ 627 /* statistics */
570 unsigned goodbytes; /* bytes correctly received */ 628 unsigned goodbytes; /* bytes correctly received */
571 unsigned alignerrs; /* frames with incomplete byte at end */ 629 unsigned alignerrs; /* frames with incomplete byte
630 at end */
572 unsigned fcserrs; /* FCS errors */ 631 unsigned fcserrs; /* FCS errors */
573 unsigned frameerrs; /* framing errors */ 632 unsigned frameerrs; /* framing errors */
574 unsigned giants; /* long frames */ 633 unsigned giants; /* long frames */
575 unsigned runts; /* short frames */ 634 unsigned runts; /* short frames */
576 unsigned aborts; /* HDLC aborts */ 635 unsigned aborts; /* HDLC aborts */
577 unsigned shared0s; /* '0' bits shared between flags */ 636 unsigned shared0s; /* '0' bits shared between flags
578 unsigned stolen0s; /* '0' stuff bits also serving as leading flag bits */ 637 */
638 unsigned stolen0s; /* '0' stuff bits also serving
639 as leading flag bits */
579 struct tasklet_struct rcvd_tasklet; 640 struct tasklet_struct rcvd_tasklet;
580}; 641};
581 642
582struct gigaset_ops { 643struct gigaset_ops {
583 /* Called from ev-layer.c/interface.c for sending AT commands to the device */ 644 /* Called from ev-layer.c/interface.c for sending AT commands to the
645 device */
584 int (*write_cmd)(struct cardstate *cs, 646 int (*write_cmd)(struct cardstate *cs,
585 const unsigned char *buf, int len, 647 const unsigned char *buf, int len,
586 struct tasklet_struct *wake_tasklet); 648 struct tasklet_struct *wake_tasklet);
@@ -604,7 +666,8 @@ struct gigaset_ops {
604 /* Called by gigaset_freecs() for freeing bcs->hw.xxx */ 666 /* Called by gigaset_freecs() for freeing bcs->hw.xxx */
605 int (*freebcshw)(struct bc_state *bcs); 667 int (*freebcshw)(struct bc_state *bcs);
606 668
607 /* Called by gigaset_stop() or gigaset_bchannel_down() for resetting bcs->hw.xxx */ 669 /* Called by gigaset_stop() or gigaset_bchannel_down() for resetting
670 bcs->hw.xxx */
608 void (*reinitbcshw)(struct bc_state *bcs); 671 void (*reinitbcshw)(struct bc_state *bcs);
609 672
610 /* Called by gigaset_initcs() for setting up cs->hw.xxx */ 673 /* Called by gigaset_initcs() for setting up cs->hw.xxx */
@@ -613,13 +676,10 @@ struct gigaset_ops {
613 /* Called by gigaset_freecs() for freeing cs->hw.xxx */ 676 /* Called by gigaset_freecs() for freeing cs->hw.xxx */
614 void (*freecshw)(struct cardstate *cs); 677 void (*freecshw)(struct cardstate *cs);
615 678
616 ///* Called by gigaset_stop() for killing URBs, shutting down the device, ... 679 /* Called from common.c/interface.c for additional serial port
617 // hardwareup: ==0: don't try to shut down the device, hardware is really not accessible 680 control */
618 // !=0: hardware still up */ 681 int (*set_modem_ctrl)(struct cardstate *cs, unsigned old_state,
619 //void (*stophw)(struct cardstate *cs, int hardwareup); 682 unsigned new_state);
620
621 /* Called from common.c/interface.c for additional serial port control */
622 int (*set_modem_ctrl)(struct cardstate *cs, unsigned old_state, unsigned new_state);
623 int (*baud_rate)(struct cardstate *cs, unsigned cflag); 683 int (*baud_rate)(struct cardstate *cs, unsigned cflag);
624 int (*set_line_ctrl)(struct cardstate *cs, unsigned cflag); 684 int (*set_line_ctrl)(struct cardstate *cs, unsigned cflag);
625 685
@@ -667,7 +727,8 @@ void gigaset_isoc_input(struct inbuf_t *inbuf);
667 727
668/* Called from bas-gigaset.c to process a block of data 728/* Called from bas-gigaset.c to process a block of data
669 * received through the isochronous channel */ 729 * received through the isochronous channel */
670void gigaset_isoc_receive(unsigned char *src, unsigned count, struct bc_state *bcs); 730void gigaset_isoc_receive(unsigned char *src, unsigned count,
731 struct bc_state *bcs);
671 732
672/* Called from bas-gigaset.c to put a block of data 733/* Called from bas-gigaset.c to put a block of data
673 * into the isochronous output buffer */ 734 * into the isochronous output buffer */
@@ -763,7 +824,8 @@ struct cardstate *gigaset_getunassignedcs(struct gigaset_driver *drv);
763void gigaset_unassign(struct cardstate *cs); 824void gigaset_unassign(struct cardstate *cs);
764void gigaset_blockdriver(struct gigaset_driver *drv); 825void gigaset_blockdriver(struct gigaset_driver *drv);
765 826
766/* Allocate and initialize card state. Calls hardware dependent gigaset_init[b]cs(). */ 827/* Allocate and initialize card state. Calls hardware dependent
828 gigaset_init[b]cs(). */
767struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, 829struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
768 int onechannel, int ignoreframes, 830 int onechannel, int ignoreframes,
769 int cidmode, const char *modulename); 831 int cidmode, const char *modulename);
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index 731a675f21b0..e30275d4e148 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -11,10 +11,6 @@
11 * published by the Free Software Foundation; either version 2 of 11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: ...
15 * =====================================================================
16 * Version: $Id: i4l.c,v 1.3.2.9 2006/02/04 18:28:16 hjlipp Exp $
17 * =====================================================================
18 */ 14 */
19 15
20#include "gigaset.h" 16#include "gigaset.h"
@@ -29,7 +25,8 @@
29 * parameters: 25 * parameters:
30 * driverID driver ID as assigned by LL 26 * driverID driver ID as assigned by LL
31 * channel channel number 27 * channel channel number
32 * ack if != 0 LL wants to be notified on completion via statcallb(ISDN_STAT_BSENT) 28 * ack if != 0 LL wants to be notified on completion via
29 * statcallb(ISDN_STAT_BSENT)
33 * skb skb containing data to send 30 * skb skb containing data to send
34 * return value: 31 * return value:
35 * number of accepted bytes 32 * number of accepted bytes
@@ -123,9 +120,6 @@ static int command_from_LL(isdn_ctrl *cntrl)
123 //dbg(DEBUG_ANY, "Gigaset_HW: Receiving command"); 120 //dbg(DEBUG_ANY, "Gigaset_HW: Receiving command");
124 gigaset_debugdrivers(); 121 gigaset_debugdrivers();
125 122
126 /* Terminate this call if no device is present. Bt if the command is "ISDN_CMD_LOCK" or
127 * "ISDN_CMD_UNLOCK" then execute it due to the fact that they are device independent !
128 */
129 //FIXME "remove test for &connected" 123 //FIXME "remove test for &connected"
130 if ((!cs || !atomic_read(&cs->connected))) { 124 if ((!cs || !atomic_read(&cs->connected))) {
131 warn("LL tried to access unknown device with nr. %d", 125 warn("LL tried to access unknown device with nr. %d",
@@ -222,15 +216,15 @@ static int command_from_LL(isdn_ctrl *cntrl)
222 gigaset_schedule_event(cs); 216 gigaset_schedule_event(cs);
223 217
224 break; 218 break;
225 case ISDN_CMD_CLREAZ: /* Do not signal incoming signals */ //FIXME 219 case ISDN_CMD_CLREAZ: /* Do not signal incoming signals */ //FIXME
226 dbg(DEBUG_ANY, "ISDN_CMD_CLREAZ"); 220 dbg(DEBUG_ANY, "ISDN_CMD_CLREAZ");
227 break; 221 break;
228 case ISDN_CMD_SETEAZ: /* Signal incoming calls for given MSN */ //FIXME 222 case ISDN_CMD_SETEAZ: /* Signal incoming calls for given MSN */ //FIXME
229 dbg(DEBUG_ANY, 223 dbg(DEBUG_ANY,
230 "ISDN_CMD_SETEAZ (id:%d, channel: %ld, number: %s)", 224 "ISDN_CMD_SETEAZ (id:%d, channel: %ld, number: %s)",
231 cntrl->driver, cntrl->arg, cntrl->parm.num); 225 cntrl->driver, cntrl->arg, cntrl->parm.num);
232 break; 226 break;
233 case ISDN_CMD_SETL2: /* Set L2 to given protocol */ 227 case ISDN_CMD_SETL2: /* Set L2 to given protocol */
234 dbg(DEBUG_ANY, "ISDN_CMD_SETL2 (Channel: %ld, Proto: %lx)", 228 dbg(DEBUG_ANY, "ISDN_CMD_SETL2 (Channel: %ld, Proto: %lx)",
235 cntrl->arg & 0xff, (cntrl->arg >> 8)); 229 cntrl->arg & 0xff, (cntrl->arg >> 8));
236 230
@@ -250,7 +244,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
250 dbg(DEBUG_CMD, "scheduling PROTO_L2"); 244 dbg(DEBUG_CMD, "scheduling PROTO_L2");
251 gigaset_schedule_event(cs); 245 gigaset_schedule_event(cs);
252 break; 246 break;
253 case ISDN_CMD_SETL3: /* Set L3 to given protocol */ 247 case ISDN_CMD_SETL3: /* Set L3 to given protocol */
254 dbg(DEBUG_ANY, "ISDN_CMD_SETL3 (Channel: %ld, Proto: %lx)", 248 dbg(DEBUG_ANY, "ISDN_CMD_SETL3 (Channel: %ld, Proto: %lx)",
255 cntrl->arg & 0xff, (cntrl->arg >> 8)); 249 cntrl->arg & 0xff, (cntrl->arg >> 8));
256 250
@@ -396,10 +390,14 @@ int gigaset_isdn_setup_dial(struct at_state_t *at_state, void *data)
396 } 390 }
397 391
398 if (bcs->commands[AT_MSN]) 392 if (bcs->commands[AT_MSN])
399 snprintf(bcs->commands[AT_MSN], length[AT_MSN], "^SMSN=%s\r", sp->eazmsn); 393 snprintf(bcs->commands[AT_MSN], length[AT_MSN],
400 snprintf(bcs->commands[AT_BC ], length[AT_BC ], "^SBC=%s\r", bc); 394 "^SMSN=%s\r", sp->eazmsn);
401 snprintf(bcs->commands[AT_PROTO], length[AT_PROTO], "^SBPR=%u\r", proto); 395 snprintf(bcs->commands[AT_BC ], length[AT_BC ],
402 snprintf(bcs->commands[AT_ISO ], length[AT_ISO ], "^SISO=%u\r", (unsigned)bcs->channel + 1); 396 "^SBC=%s\r", bc);
397 snprintf(bcs->commands[AT_PROTO], length[AT_PROTO],
398 "^SBPR=%u\r", proto);
399 snprintf(bcs->commands[AT_ISO ], length[AT_ISO ],
400 "^SISO=%u\r", (unsigned)bcs->channel + 1);
403 401
404 return 0; 402 return 0;
405} 403}
@@ -441,8 +439,10 @@ int gigaset_isdn_setup_accept(struct at_state_t *at_state)
441 } 439 }
442 } 440 }
443 441
444 snprintf(bcs->commands[AT_PROTO], length[AT_PROTO], "^SBPR=%u\r", proto); 442 snprintf(bcs->commands[AT_PROTO], length[AT_PROTO],
445 snprintf(bcs->commands[AT_ISO ], length[AT_ISO ], "^SISO=%u\r", (unsigned) bcs->channel + 1); 443 "^SBPR=%u\r", proto);
444 snprintf(bcs->commands[AT_ISO ], length[AT_ISO ],
445 "^SISO=%u\r", (unsigned) bcs->channel + 1);
446 446
447 return 0; 447 return 0;
448} 448}
@@ -542,9 +542,9 @@ int gigaset_register_to_LL(struct cardstate *cs, const char *isdnid)
542 return -ENOMEM; //FIXME EINVAL/...?? 542 return -ENOMEM; //FIXME EINVAL/...??
543 543
544 iif->owner = THIS_MODULE; 544 iif->owner = THIS_MODULE;
545 iif->channels = cs->channels; /* I am supporting just one channel *//* I was supporting...*/ 545 iif->channels = cs->channels;
546 iif->maxbufsize = MAX_BUF_SIZE; 546 iif->maxbufsize = MAX_BUF_SIZE;
547 iif->features = ISDN_FEATURE_L2_TRANS | /* Our device is very advanced, therefore */ 547 iif->features = ISDN_FEATURE_L2_TRANS |
548 ISDN_FEATURE_L2_HDLC | 548 ISDN_FEATURE_L2_HDLC |
549#ifdef GIG_X75 549#ifdef GIG_X75
550 ISDN_FEATURE_L2_X75I | 550 ISDN_FEATURE_L2_X75I |
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index 3a81d9c65141..c225de9620b1 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -9,8 +9,6 @@
9 * published by the Free Software Foundation; either version 2 of 9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version. 10 * the License, or (at your option) any later version.
11 * ===================================================================== 11 * =====================================================================
12 * Version: $Id: interface.c,v 1.14.4.15 2006/02/04 18:28:16 hjlipp Exp $
13 * =====================================================================
14 */ 12 */
15 13
16#include "gigaset.h" 14#include "gigaset.h"
@@ -173,7 +171,6 @@ static int if_open(struct tty_struct *tty, struct file *filp)
173 cs->tty = tty; 171 cs->tty = tty;
174 spin_unlock_irqrestore(&cs->lock, flags); 172 spin_unlock_irqrestore(&cs->lock, flags);
175 tty->low_latency = 1; //FIXME test 173 tty->low_latency = 1; //FIXME test
176 //FIXME
177 } 174 }
178 175
179 up(&cs->sem); 176 up(&cs->sem);
@@ -202,7 +199,6 @@ static void if_close(struct tty_struct *tty, struct file *filp)
202 spin_lock_irqsave(&cs->lock, flags); 199 spin_lock_irqsave(&cs->lock, flags);
203 cs->tty = NULL; 200 cs->tty = NULL;
204 spin_unlock_irqrestore(&cs->lock, flags); 201 spin_unlock_irqrestore(&cs->lock, flags);
205 //FIXME
206 } 202 }
207 } 203 }
208 204
@@ -253,24 +249,26 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
253 gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS", 249 gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
254 6, (const unsigned char *) arg, 1); 250 6, (const unsigned char *) arg, 1);
255 if (!atomic_read(&cs->connected)) { 251 if (!atomic_read(&cs->connected)) {
256 dbg(DEBUG_ANY, "can't communicate with unplugged device"); 252 dbg(DEBUG_ANY,
253 "can't communicate with unplugged device");
257 retval = -ENODEV; 254 retval = -ENODEV;
258 break; 255 break;
259 } 256 }
260 retval = copy_from_user(&buf, 257 retval = copy_from_user(&buf,
261 (const unsigned char __user *) arg, 6) 258 (const unsigned char __user *) arg, 6)
262 ? -EFAULT : 0; 259 ? -EFAULT : 0;
263 if (retval >= 0) 260 if (retval >= 0)
264 retval = cs->ops->brkchars(cs, buf); 261 retval = cs->ops->brkchars(cs, buf);
265 break; 262 break;
266 case GIGASET_VERSION: 263 case GIGASET_VERSION:
267 retval = copy_from_user(version, (unsigned __user *) arg, 264 retval = copy_from_user(version,
265 (unsigned __user *) arg,
268 sizeof version) ? -EFAULT : 0; 266 sizeof version) ? -EFAULT : 0;
269 if (retval >= 0) 267 if (retval >= 0)
270 retval = if_version(cs, version); 268 retval = if_version(cs, version);
271 if (retval >= 0) 269 if (retval >= 0)
272 retval = copy_to_user((unsigned __user *) arg, version, 270 retval = copy_to_user((unsigned __user *) arg,
273 sizeof version) 271 version, sizeof version)
274 ? -EFAULT : 0; 272 ? -EFAULT : 0;
275 break; 273 break;
276 default: 274 default:
@@ -575,7 +573,7 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
575 new_state &= ~(TIOCM_DTR | TIOCM_RTS); 573 new_state &= ~(TIOCM_DTR | TIOCM_RTS);
576 if (new_state != control_state) { 574 if (new_state != control_state) {
577 dbg(DEBUG_IF, "%u: new_state %x", cs->minor_index, new_state); 575 dbg(DEBUG_IF, "%u: new_state %x", cs->minor_index, new_state);
578 gigaset_set_modem_ctrl(cs, control_state, new_state); // FIXME: mct_u232.c sets the old state here. is this a bug? 576 gigaset_set_modem_ctrl(cs, control_state, new_state);
579 control_state = new_state; 577 control_state = new_state;
580 } 578 }
581#endif 579#endif
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index 5744eb91b315..e2d93e935530 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -10,10 +10,6 @@
10 * published by the Free Software Foundation; either version 2 of 10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version. 11 * the License, or (at your option) any later version.
12 * ===================================================================== 12 * =====================================================================
13 * ToDo: ...
14 * =====================================================================
15 * Version: $Id: isocdata.c,v 1.2.2.5 2005/11/13 23:05:19 hjlipp Exp $
16 * =====================================================================
17 */ 13 */
18 14
19#include "gigaset.h" 15#include "gigaset.h"
@@ -196,7 +192,8 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
196 return -EBUSY; 192 return -EBUSY;
197 /* write position could have changed */ 193 /* write position could have changed */
198 if (limit >= (write = atomic_read(&iwb->write))) { 194 if (limit >= (write = atomic_read(&iwb->write))) {
199 pbyte = iwb->data[write]; /* save partial byte */ 195 pbyte = iwb->data[write]; /* save
196 partial byte */
200 limit = write + BAS_OUTBUFPAD; 197 limit = write + BAS_OUTBUFPAD;
201 dbg(DEBUG_STREAM, 198 dbg(DEBUG_STREAM,
202 "%s: filling %d->%d with %02x", 199 "%s: filling %d->%d with %02x",
@@ -213,7 +210,8 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
213 } 210 }
214 dbg(DEBUG_STREAM, "%s: restoring %02x at %d", 211 dbg(DEBUG_STREAM, "%s: restoring %02x at %d",
215 __func__, pbyte, limit); 212 __func__, pbyte, limit);
216 iwb->data[limit] = pbyte; /* restore partial byte */ 213 iwb->data[limit] = pbyte; /* restore
214 partial byte */
217 atomic_set(&iwb->write, limit); 215 atomic_set(&iwb->write, limit);
218 } 216 }
219 isowbuf_donewrite(iwb); 217 isowbuf_donewrite(iwb);
@@ -508,11 +506,13 @@ int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len)
508 switch (bcs->proto2) { 506 switch (bcs->proto2) {
509 case ISDN_PROTO_L2_HDLC: 507 case ISDN_PROTO_L2_HDLC:
510 result = hdlc_buildframe(bcs->hw.bas->isooutbuf, in, len); 508 result = hdlc_buildframe(bcs->hw.bas->isooutbuf, in, len);
511 dbg(DEBUG_ISO, "%s: %d bytes HDLC -> %d", __func__, len, result); 509 dbg(DEBUG_ISO, "%s: %d bytes HDLC -> %d",
510 __func__, len, result);
512 break; 511 break;
513 default: /* assume transparent */ 512 default: /* assume transparent */
514 result = trans_buildframe(bcs->hw.bas->isooutbuf, in, len); 513 result = trans_buildframe(bcs->hw.bas->isooutbuf, in, len);
515 dbg(DEBUG_ISO, "%s: %d bytes trans -> %d", __func__, len, result); 514 dbg(DEBUG_ISO, "%s: %d bytes trans -> %d",
515 __func__, len, result);
516 } 516 }
517 return result; 517 return result;
518} 518}
diff --git a/drivers/isdn/gigaset/proc.c b/drivers/isdn/gigaset/proc.c
index c6915fa2be6c..c30ea80d517a 100644
--- a/drivers/isdn/gigaset/proc.c
+++ b/drivers/isdn/gigaset/proc.c
@@ -11,23 +11,21 @@
11 * published by the Free Software Foundation; either version 2 of 11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * ===================================================================== 13 * =====================================================================
14 * ToDo: ...
15 * =====================================================================
16 * Version: $Id: proc.c,v 1.5.2.13 2006/02/04 18:28:16 hjlipp Exp $
17 * =====================================================================
18 */ 14 */
19 15
20#include "gigaset.h" 16#include "gigaset.h"
21#include <linux/ctype.h> 17#include <linux/ctype.h>
22 18
23static ssize_t show_cidmode(struct device *dev, struct device_attribute *attr, char *buf) 19static ssize_t show_cidmode(struct device *dev, struct device_attribute *attr,
20 char *buf)
24{ 21{
25 struct usb_interface *intf = to_usb_interface(dev); 22 struct usb_interface *intf = to_usb_interface(dev);
26 struct cardstate *cs = usb_get_intfdata(intf); 23 struct cardstate *cs = usb_get_intfdata(intf);
27 return sprintf(buf, "%d\n", atomic_read(&cs->cidmode)); // FIXME use scnprintf for 13607 bit architectures (if PAGE_SIZE==4096) 24 return sprintf(buf, "%d\n", atomic_read(&cs->cidmode));
28} 25}
29 26
30static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 27static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr,
28 const char *buf, size_t count)
31{ 29{
32 struct usb_interface *intf = to_usb_interface(dev); 30 struct usb_interface *intf = to_usb_interface(dev);
33 struct cardstate *cs = usb_get_intfdata(intf); 31 struct cardstate *cs = usb_get_intfdata(intf);
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index 323fc7349dec..0f5aa46cf8f3 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -13,10 +13,6 @@
13 * published by the Free Software Foundation; either version 2 of 13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version. 14 * the License, or (at your option) any later version.
15 * ===================================================================== 15 * =====================================================================
16 * ToDo: ...
17 * =====================================================================
18 * Version: $Id: usb-gigaset.c,v 1.85.4.18 2006/02/04 18:28:16 hjlipp Exp $
19 * =====================================================================
20 */ 16 */
21 17
22#include "gigaset.h" 18#include "gigaset.h"
@@ -62,10 +58,6 @@ static struct usb_device_id gigaset_table [] = {
62 58
63MODULE_DEVICE_TABLE(usb, gigaset_table); 59MODULE_DEVICE_TABLE(usb, gigaset_table);
64 60
65/* Get a minor range for your devices from the usb maintainer */
66#define USB_SKEL_MINOR_BASE 200
67
68
69/* 61/*
70 * Control requests (empty fields: 00) 62 * Control requests (empty fields: 00)
71 * 63 *
@@ -122,29 +114,29 @@ static struct cardstate *cardstate = NULL;
122 114
123/* usb specific object needed to register this driver with the usb subsystem */ 115/* usb specific object needed to register this driver with the usb subsystem */
124static struct usb_driver gigaset_usb_driver = { 116static struct usb_driver gigaset_usb_driver = {
125 .name = GIGASET_MODULENAME, 117 .name = GIGASET_MODULENAME,
126 .probe = gigaset_probe, 118 .probe = gigaset_probe,
127 .disconnect = gigaset_disconnect, 119 .disconnect = gigaset_disconnect,
128 .id_table = gigaset_table, 120 .id_table = gigaset_table,
129}; 121};
130 122
131struct usb_cardstate { 123struct usb_cardstate {
132 struct usb_device *udev; /* save off the usb device pointer */ 124 struct usb_device *udev; /* usb device pointer */
133 struct usb_interface *interface; /* the interface for this device */ 125 struct usb_interface *interface; /* interface for this device */
134 atomic_t busy; /* bulk output in progress */ 126 atomic_t busy; /* bulk output in progress */
135 127
136 /* Output buffer for commands (M105: and data)*/ 128 /* Output buffer */
137 unsigned char *bulk_out_buffer; /* the buffer to send data */ 129 unsigned char *bulk_out_buffer; /* send buffer */
138 int bulk_out_size; /* the size of the send buffer */ 130 int bulk_out_size; /* send buffer size */
139 __u8 bulk_out_endpointAddr; /* the address of the bulk out endpoint */ 131 __u8 bulk_out_endpointAddr; /* bulk out endpoint */
140 struct urb *bulk_out_urb; /* the urb used to transmit data */ 132 struct urb *bulk_out_urb; /* bulk out urb */
141 133
142 /* Input buffer for command responses (M105: and data)*/ 134 /* Input buffer */
143 int rcvbuf_size; /* the size of the receive buffer */ 135 int rcvbuf_size; /* rcv buffer */
144 struct urb *read_urb; /* the urb used to receive data */ 136 struct urb *read_urb; /* rcv buffer size */
145 __u8 int_in_endpointAddr; /* the address of the bulk in endpoint */ 137 __u8 int_in_endpointAddr; /* int in endpoint */
146 138
147 char bchars[6]; /* req. 0x19 */ 139 char bchars[6]; /* request 0x19 */
148}; 140};
149 141
150struct usb_bc_state {}; 142struct usb_bc_state {};
@@ -166,10 +158,11 @@ static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state,
166 val = tiocm_to_gigaset(new_state); 158 val = tiocm_to_gigaset(new_state);
167 159
168 dbg(DEBUG_USBREQ, "set flags 0x%02x with mask 0x%02x", val, mask); 160 dbg(DEBUG_USBREQ, "set flags 0x%02x with mask 0x%02x", val, mask);
161 // don't use this in an interrupt/BH
169 r = usb_control_msg(cs->hw.usb->udev, 162 r = usb_control_msg(cs->hw.usb->udev,
170 usb_sndctrlpipe(cs->hw.usb->udev, 0), 7, 0x41, 163 usb_sndctrlpipe(cs->hw.usb->udev, 0), 7, 0x41,
171 (val & 0xff) | ((mask & 0xff) << 8), 0, 164 (val & 0xff) | ((mask & 0xff) << 8), 0,
172 NULL, 0, 2000 /*timeout??*/); // don't use this in an interrupt/BH 165 NULL, 0, 2000 /* timeout? */);
173 if (r < 0) 166 if (r < 0)
174 return r; 167 return r;
175 //.. 168 //..
@@ -309,15 +302,12 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
309 return 0; 302 return 0;
310} 303}
311 304
312//void send_ack_to_LL(void *data);
313static int write_modem(struct cardstate *cs); 305static int write_modem(struct cardstate *cs);
314static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb); 306static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb);
315 307
316 308
317/* Handling of send queue. If there is already a skb opened, put data to 309/* Write tasklet handler: Continue sending current skb, or send command, or
318 * the transfer buffer by calling "write_modem". Otherwise take a new skb out of the queue. 310 * start sending an skb from the send queue.
319 * This function will be called by the ISR via "transmit_chars" (USB: B-Channel Bulk callback handler
320 * via immediate task queue) or by writebuf_from_LL if the LL wants to transmit data.
321 */ 311 */
322static void gigaset_modem_fill(unsigned long data) 312static void gigaset_modem_fill(unsigned long data)
323{ 313{
@@ -345,7 +335,8 @@ static void gigaset_modem_fill(unsigned long data)
345 if (send_cb(cs, cb) < 0) { 335 if (send_cb(cs, cb) < 0) {
346 dbg(DEBUG_OUTPUT, 336 dbg(DEBUG_OUTPUT,
347 "modem_fill: send_cb failed"); 337 "modem_fill: send_cb failed");
348 again = 1; /* no callback will be called! */ 338 again = 1; /* no callback will be
339 called! */
349 } 340 }
350 } else { /* skbs to send? */ 341 } else { /* skbs to send? */
351 bcs->tx_skb = skb_dequeue(&bcs->squeue); 342 bcs->tx_skb = skb_dequeue(&bcs->squeue);
@@ -371,8 +362,7 @@ static void gigaset_modem_fill(unsigned long data)
371/** 362/**
372 * gigaset_read_int_callback 363 * gigaset_read_int_callback
373 * 364 *
374 * It is called if the data was received from the device. This is almost similiar to 365 * It is called if the data was received from the device.
375 * the interrupt service routine in the serial device.
376 */ 366 */
377static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs) 367static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs)
378{ 368{
@@ -381,13 +371,11 @@ static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs)
381 struct cardstate *cs; 371 struct cardstate *cs;
382 unsigned numbytes; 372 unsigned numbytes;
383 unsigned char *src; 373 unsigned char *src;
384 //unsigned long flags;
385 struct inbuf_t *inbuf; 374 struct inbuf_t *inbuf;
386 375
387 IFNULLRET(urb); 376 IFNULLRET(urb);
388 inbuf = (struct inbuf_t *) urb->context; 377 inbuf = (struct inbuf_t *) urb->context;
389 IFNULLRET(inbuf); 378 IFNULLRET(inbuf);
390 //spin_lock_irqsave(&inbuf->lock, flags);
391 cs = inbuf->cs; 379 cs = inbuf->cs;
392 IFNULLGOTO(cs, exit); 380 IFNULLGOTO(cs, exit);
393 IFNULLGOTO(cardstate, exit); 381 IFNULLGOTO(cardstate, exit);
@@ -422,7 +410,6 @@ static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs)
422 resubmit = 1; 410 resubmit = 1;
423 } 411 }
424exit: 412exit:
425 //spin_unlock_irqrestore(&inbuf->lock, flags);
426 if (resubmit) { 413 if (resubmit) {
427 r = usb_submit_urb(urb, SLAB_ATOMIC); 414 r = usb_submit_urb(urb, SLAB_ATOMIC);
428 if (r) 415 if (r)
@@ -431,11 +418,7 @@ exit:
431} 418}
432 419
433 420
434/* This callback routine is called when data was transmitted to a B-Channel. 421/* This callback routine is called when data was transmitted to the device. */
435 * Therefore it has to check if there is still data to transmit. This
436 * happens by calling modem_fill via task queue.
437 *
438 */
439static void gigaset_write_bulk_callback(struct urb *urb, struct pt_regs *regs) 422static void gigaset_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
440{ 423{
441 struct cardstate *cs = (struct cardstate *) urb->context; 424 struct cardstate *cs = (struct cardstate *) urb->context;
@@ -448,8 +431,9 @@ static void gigaset_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
448 } 431 }
449#endif 432#endif
450 if (urb->status) 433 if (urb->status)
451 err("bulk transfer failed (status %d)", -urb->status); /* That's all we can do. Communication problems 434 err("bulk transfer failed (status %d)", -urb->status);
452 are handeled by timeouts or network protocols */ 435 /* That's all we can do. Communication problems
436 are handeled by timeouts or network protocols */
453 437
454 atomic_set(&cs->hw.usb->busy, 0); 438 atomic_set(&cs->hw.usb->busy, 0);
455 tasklet_schedule(&cs->write_tasklet); 439 tasklet_schedule(&cs->write_tasklet);
@@ -503,16 +487,16 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
503 atomic_set(&ucs->busy, 0); 487 atomic_set(&ucs->busy, 0);
504 err("could not submit urb (error %d).", 488 err("could not submit urb (error %d).",
505 -status); 489 -status);
506 cb->len = 0; /* skip urb => remove cb+wakeup in next loop cycle */ 490 cb->len = 0; /* skip urb => remove cb+wakeup
491 in next loop cycle */
507 } 492 }
508 } 493 }
509 } while (cb && status); /* bei Fehler naechster Befehl //FIXME: ist das OK? */ 494 } while (cb && status); /* next command on error */
510 495
511 return status; 496 return status;
512} 497}
513 498
514/* Write string into transbuf and send it to modem. 499/* Send command to device. */
515 */
516static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf, 500static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
517 int len, struct tasklet_struct *wake_tasklet) 501 int len, struct tasklet_struct *wake_tasklet)
518{ 502{
@@ -604,7 +588,6 @@ static int gigaset_initbcshw(struct bc_state *bcs)
604 if (!bcs->hw.usb) 588 if (!bcs->hw.usb)
605 return 0; 589 return 0;
606 590
607 //bcs->hw.usb->trans_flg = READY_TO_TRNSMIT; /* B-Channel ready to transmit */
608 return 1; 591 return 1;
609} 592}
610 593
@@ -614,7 +597,6 @@ static void gigaset_reinitbcshw(struct bc_state *bcs)
614 597
615static void gigaset_freecshw(struct cardstate *cs) 598static void gigaset_freecshw(struct cardstate *cs)
616{ 599{
617 //FIXME
618 tasklet_kill(&cs->write_tasklet); 600 tasklet_kill(&cs->write_tasklet);
619 kfree(cs->hw.usb); 601 kfree(cs->hw.usb);
620} 602}
@@ -644,19 +626,13 @@ static int gigaset_initcshw(struct cardstate *cs)
644 return 1; 626 return 1;
645} 627}
646 628
647/* Writes the data of the current open skb into the modem. 629/* Send data from current skb to the device. */
648 * We have to protect against multiple calls until the
649 * callback handler () is called , due to the fact that we
650 * are just allowed to send data once to an endpoint. Therefore
651 * we using "trans_flg" to synchonize ...
652 */
653static int write_modem(struct cardstate *cs) 630static int write_modem(struct cardstate *cs)
654{ 631{
655 int ret; 632 int ret;
656 int count; 633 int count;
657 struct bc_state *bcs = &cs->bcs[0]; /* only one channel */ 634 struct bc_state *bcs = &cs->bcs[0]; /* only one channel */
658 struct usb_cardstate *ucs = cs->hw.usb; 635 struct usb_cardstate *ucs = cs->hw.usb;
659 //unsigned long flags;
660 636
661 IFNULLRETVAL(bcs->tx_skb, -EINVAL); 637 IFNULLRETVAL(bcs->tx_skb, -EINVAL);
662 638
@@ -720,12 +696,9 @@ static int gigaset_probe(struct usb_interface *interface,
720 struct usb_host_interface *hostif; 696 struct usb_host_interface *hostif;
721 struct cardstate *cs = NULL; 697 struct cardstate *cs = NULL;
722 struct usb_cardstate *ucs = NULL; 698 struct usb_cardstate *ucs = NULL;
723 //struct usb_interface_descriptor *iface_desc;
724 struct usb_endpoint_descriptor *endpoint; 699 struct usb_endpoint_descriptor *endpoint;
725 //isdn_ctrl command;
726 int buffer_size; 700 int buffer_size;
727 int alt; 701 int alt;
728 //unsigned long flags;
729 702
730 info("%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", 703 info("%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)",
731 __func__, le16_to_cpu(udev->descriptor.idVendor), 704 __func__, le16_to_cpu(udev->descriptor.idVendor),
@@ -766,29 +739,6 @@ static int gigaset_probe(struct usb_interface *interface,
766 } 739 }
767 ucs = cs->hw.usb; 740 ucs = cs->hw.usb;
768 741
769#if 0
770 if (usb_set_configuration(udev, udev->config[0].desc.bConfigurationValue) < 0) {
771 warn("set_configuration failed");
772 goto error;
773 }
774
775
776 if (usb_set_interface(udev, ifnum/*==0*/, alt/*==0*/) < 0) {
777 warn("usb_set_interface failed, device %d interface %d altsetting %d",
778 udev->devnum, ifnum, alt);
779 goto error;
780 }
781#endif
782
783 /* set up the endpoint information */
784 /* check out the endpoints */
785 /* We will get 2 endpoints: One for sending commands to the device (bulk out) and one to
786 * poll messages from the device(int in).
787 * Therefore we will have an almost similiar situation as with our serial port handler.
788 * If an connection will be established, we will have to create data in/out pipes
789 * dynamically...
790 */
791
792 endpoint = &hostif->endpoint[0].desc; 742 endpoint = &hostif->endpoint[0].desc;
793 743
794 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); 744 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
@@ -896,18 +846,15 @@ static void gigaset_disconnect(struct usb_interface *interface)
896 846
897 tasklet_kill(&cs->write_tasklet); 847 tasklet_kill(&cs->write_tasklet);
898 848
899 usb_kill_urb(ucs->bulk_out_urb); /* FIXME: nur, wenn noetig */ 849 usb_kill_urb(ucs->bulk_out_urb); /* FIXME: only if active? */
900 //usb_kill_urb(ucs->urb_cmd_out); /* FIXME: nur, wenn noetig */
901 850
902 kfree(ucs->bulk_out_buffer); 851 kfree(ucs->bulk_out_buffer);
903 if (ucs->bulk_out_urb != NULL) 852 if (ucs->bulk_out_urb != NULL)
904 usb_free_urb(ucs->bulk_out_urb); 853 usb_free_urb(ucs->bulk_out_urb);
905 //if(ucs->urb_cmd_out != NULL)
906 // usb_free_urb(ucs->urb_cmd_out);
907 kfree(cs->inbuf[0].rcvbuf); 854 kfree(cs->inbuf[0].rcvbuf);
908 if (ucs->read_urb != NULL) 855 if (ucs->read_urb != NULL)
909 usb_free_urb(ucs->read_urb); 856 usb_free_urb(ucs->read_urb);
910 ucs->read_urb = ucs->bulk_out_urb/*=ucs->urb_cmd_out*/=NULL; 857 ucs->read_urb = ucs->bulk_out_urb = NULL;
911 cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL; 858 cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL;
912 859
913 gigaset_unassign(cs); 860 gigaset_unassign(cs);