diff options
author | Joe Perches <joe@perches.com> | 2012-02-19 19:52:38 -0800 |
---|---|---|
committer | Joe Perches <joe@perches.com> | 2012-02-21 09:04:01 -0800 |
commit | 475be4d85a274d0961593db41cf85689db1d583c (patch) | |
tree | b2b8931eb747794730522c3cf1898e46948527b9 /drivers/isdn/pcbit | |
parent | 0b0a635f79f91f3755b6518627ea06dd0dbfd523 (diff) |
isdn: whitespace coding style cleanup
isdn source code uses a not-current coding style.
Update the coding style used on a per-line basis
so that git diff -w shows only elided blank lines
at EOF.
Done with emacs and some scripts and some typing.
Built x86 allyesconfig.
No detected change in objdump -d or size.
Signed-off-by: Joe Perches <joe@perches.com>
Diffstat (limited to 'drivers/isdn/pcbit')
-rw-r--r-- | drivers/isdn/pcbit/callbacks.c | 303 | ||||
-rw-r--r-- | drivers/isdn/pcbit/callbacks.h | 28 | ||||
-rw-r--r-- | drivers/isdn/pcbit/capi.c | 585 | ||||
-rw-r--r-- | drivers/isdn/pcbit/capi.h | 46 | ||||
-rw-r--r-- | drivers/isdn/pcbit/drv.c | 248 | ||||
-rw-r--r-- | drivers/isdn/pcbit/edss1.c | 414 | ||||
-rw-r--r-- | drivers/isdn/pcbit/edss1.h | 13 | ||||
-rw-r--r-- | drivers/isdn/pcbit/layer2.c | 36 | ||||
-rw-r--r-- | drivers/isdn/pcbit/layer2.h | 265 | ||||
-rw-r--r-- | drivers/isdn/pcbit/module.c | 35 | ||||
-rw-r--r-- | drivers/isdn/pcbit/pcbit.h | 32 |
11 files changed, 987 insertions, 1018 deletions
diff --git a/drivers/isdn/pcbit/callbacks.c b/drivers/isdn/pcbit/callbacks.c index 976143b2346..efb6d6a3639 100644 --- a/drivers/isdn/pcbit/callbacks.c +++ b/drivers/isdn/pcbit/callbacks.c @@ -2,16 +2,16 @@ * Callbacks for the FSM * * Copyright (C) 1996 Universidade de Lisboa - * + * * Written by Pedro Roque Marques (roque@di.fc.ul.pt) * - * This software may be used and distributed according to the terms of + * This software may be used and distributed according to the terms of * the GNU General Public License, incorporated herein by reference. */ /* * Fix: 19981230 - Carlos Morgado <chbm@techie.com> - * Port of Nelson Escravana's <nelson.escravana@usa.net> fix to CalledPN + * Port of Nelson Escravana's <nelson.escravana@usa.net> fix to CalledPN * NULL pointer dereference in cb_in_1 (originally fixed in 2.0) */ @@ -39,86 +39,86 @@ ushort last_ref_num = 1; * */ -void cb_out_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *cbdata) +void cb_out_1(struct pcbit_dev *dev, struct pcbit_chan *chan, + struct callb_data *cbdata) { struct sk_buff *skb; int len; - ushort refnum; + ushort refnum; #ifdef DEBUG - printk(KERN_DEBUG "Called Party Number: %s\n", - cbdata->data.setup.CalledPN); + printk(KERN_DEBUG "Called Party Number: %s\n", + cbdata->data.setup.CalledPN); #endif - /* - * hdr - kmalloc in capi_conn_req - * - kfree when msg has been sent - */ + /* + * hdr - kmalloc in capi_conn_req + * - kfree when msg has been sent + */ - if ((len = capi_conn_req(cbdata->data.setup.CalledPN, &skb, + if ((len = capi_conn_req(cbdata->data.setup.CalledPN, &skb, chan->proto)) < 0) - { - printk("capi_conn_req failed\n"); - return; - } + { + printk("capi_conn_req failed\n"); + return; + } - refnum = last_ref_num++ & 0x7fffU; + refnum = last_ref_num++ & 0x7fffU; - chan->callref = 0; - chan->layer2link = 0; - chan->snum = 0; - chan->s_refnum = refnum; + chan->callref = 0; + chan->layer2link = 0; + chan->snum = 0; + chan->s_refnum = refnum; - pcbit_l2_write(dev, MSG_CONN_REQ, refnum, skb, len); + pcbit_l2_write(dev, MSG_CONN_REQ, refnum, skb, len); } /* * rcv CONNECT * will go into ACTIVE state * send CONN_ACTIVE_RESP - * send Select protocol request + * send Select protocol request */ -void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) +void cb_out_2(struct pcbit_dev *dev, struct pcbit_chan *chan, + struct callb_data *data) { - isdn_ctrl ictl; - struct sk_buff *skb; + isdn_ctrl ictl; + struct sk_buff *skb; int len; - ushort refnum; + ushort refnum; - if ((len=capi_conn_active_resp(chan, &skb)) < 0) - { - printk("capi_conn_active_req failed\n"); - return; - } + if ((len = capi_conn_active_resp(chan, &skb)) < 0) + { + printk("capi_conn_active_req failed\n"); + return; + } - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; + refnum = last_ref_num++ & 0x7fffU; + chan->s_refnum = refnum; - pcbit_l2_write(dev, MSG_CONN_ACTV_RESP, refnum, skb, len); + pcbit_l2_write(dev, MSG_CONN_ACTV_RESP, refnum, skb, len); - ictl.command = ISDN_STAT_DCONN; - ictl.driver=dev->id; - ictl.arg=chan->id; - dev->dev_if->statcallb(&ictl); + ictl.command = ISDN_STAT_DCONN; + ictl.driver = dev->id; + ictl.arg = chan->id; + dev->dev_if->statcallb(&ictl); - /* ACTIVE D-channel */ + /* ACTIVE D-channel */ - /* Select protocol */ + /* Select protocol */ - if ((len=capi_select_proto_req(chan, &skb, 1 /*outgoing*/)) < 0) { - printk("capi_select_proto_req failed\n"); - return; - } + if ((len = capi_select_proto_req(chan, &skb, 1 /*outgoing*/)) < 0) { + printk("capi_select_proto_req failed\n"); + return; + } - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; + refnum = last_ref_num++ & 0x7fffU; + chan->s_refnum = refnum; - pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); + pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); } @@ -127,22 +127,22 @@ void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan, * inform user */ -void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *cbdata) +void cb_in_1(struct pcbit_dev *dev, struct pcbit_chan *chan, + struct callb_data *cbdata) { - isdn_ctrl ictl; - unsigned short refnum; - struct sk_buff *skb; + isdn_ctrl ictl; + unsigned short refnum; + struct sk_buff *skb; int len; - ictl.command = ISDN_STAT_ICALL; - ictl.driver=dev->id; - ictl.arg=chan->id; - - /* - * ictl.num >= strlen() + strlen() + 5 - */ + ictl.command = ISDN_STAT_ICALL; + ictl.driver = dev->id; + ictl.arg = chan->id; + + /* + * ictl.num >= strlen() + strlen() + 5 + */ if (cbdata->data.setup.CallingPN == NULL) { printk(KERN_DEBUG "NULL CallingPN to phone; using 0\n"); @@ -167,18 +167,18 @@ void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, printk(KERN_DEBUG "statstr: %s\n", ictl.num); #endif - dev->dev_if->statcallb(&ictl); + dev->dev_if->statcallb(&ictl); + - - if ((len=capi_conn_resp(chan, &skb)) < 0) { - printk(KERN_DEBUG "capi_conn_resp failed\n"); - return; + if ((len = capi_conn_resp(chan, &skb)) < 0) { + printk(KERN_DEBUG "capi_conn_resp failed\n"); + return; } - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; + refnum = last_ref_num++ & 0x7fffU; + chan->s_refnum = refnum; - pcbit_l2_write(dev, MSG_CONN_RESP, refnum, skb, len); + pcbit_l2_write(dev, MSG_CONN_RESP, refnum, skb, len); } /* @@ -187,24 +187,24 @@ void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, * send CONNECT message CONNECT_ACTIVE_REQ in CAPI */ -void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan, +void cb_in_2(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data) { - unsigned short refnum; + unsigned short refnum; struct sk_buff *skb; - int len; - - if ((len = capi_conn_active_req(chan, &skb)) < 0) { - printk(KERN_DEBUG "capi_conn_active_req failed\n"); - return; - } + int len; + + if ((len = capi_conn_active_req(chan, &skb)) < 0) { + printk(KERN_DEBUG "capi_conn_active_req failed\n"); + return; + } - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; + refnum = last_ref_num++ & 0x7fffU; + chan->s_refnum = refnum; printk(KERN_DEBUG "sending MSG_CONN_ACTV_REQ\n"); - pcbit_l2_write(dev, MSG_CONN_ACTV_REQ, refnum, skb, len); + pcbit_l2_write(dev, MSG_CONN_ACTV_REQ, refnum, skb, len); } /* @@ -213,23 +213,23 @@ void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan, * */ -void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan, +void cb_in_3(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data) { - unsigned short refnum; - struct sk_buff *skb; + unsigned short refnum; + struct sk_buff *skb; int len; - - if ((len = capi_select_proto_req(chan, &skb, 0 /*incoming*/)) < 0) - { - printk("capi_select_proto_req failed\n"); - return; - } - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; + if ((len = capi_select_proto_req(chan, &skb, 0 /*incoming*/)) < 0) + { + printk("capi_select_proto_req failed\n"); + return; + } + + refnum = last_ref_num++ & 0x7fffU; + chan->s_refnum = refnum; - pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); + pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); } @@ -239,52 +239,52 @@ void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan, * send disconnect resp * send msg to user */ -void cb_disc_1(struct pcbit_dev * dev, struct pcbit_chan* chan, +void cb_disc_1(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data) { - struct sk_buff *skb; + struct sk_buff *skb; int len; - ushort refnum; - isdn_ctrl ictl; - - if ((len = capi_disc_resp(chan, &skb)) < 0) { - printk("capi_disc_resp failed\n"); - return; - } - - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; - - pcbit_l2_write(dev, MSG_DISC_RESP, refnum, skb, len); - - ictl.command = ISDN_STAT_BHUP; - ictl.driver=dev->id; - ictl.arg=chan->id; - dev->dev_if->statcallb(&ictl); + ushort refnum; + isdn_ctrl ictl; + + if ((len = capi_disc_resp(chan, &skb)) < 0) { + printk("capi_disc_resp failed\n"); + return; + } + + refnum = last_ref_num++ & 0x7fffU; + chan->s_refnum = refnum; + + pcbit_l2_write(dev, MSG_DISC_RESP, refnum, skb, len); + + ictl.command = ISDN_STAT_BHUP; + ictl.driver = dev->id; + ictl.arg = chan->id; + dev->dev_if->statcallb(&ictl); } - + /* * User HANGUP on active/call proceeding state * send disc.req */ -void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan, +void cb_disc_2(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data) { - struct sk_buff *skb; + struct sk_buff *skb; int len; - ushort refnum; + ushort refnum; - if ((len = capi_disc_req(chan->callref, &skb, CAUSE_NORMAL)) < 0) - { - printk("capi_disc_req failed\n"); - return; - } + if ((len = capi_disc_req(chan->callref, &skb, CAUSE_NORMAL)) < 0) + { + printk("capi_disc_req failed\n"); + return; + } - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; + refnum = last_ref_num++ & 0x7fffU; + chan->s_refnum = refnum; - pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb, len); + pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb, len); } /* @@ -292,18 +292,18 @@ void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan, * Problem: when the HL driver sends the disc req itself * LL receives BHUP */ -void cb_disc_3(struct pcbit_dev * dev, struct pcbit_chan* chan, +void cb_disc_3(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data) { - isdn_ctrl ictl; + isdn_ctrl ictl; - ictl.command = ISDN_STAT_BHUP; - ictl.driver=dev->id; - ictl.arg=chan->id; - dev->dev_if->statcallb(&ictl); + ictl.command = ISDN_STAT_BHUP; + ictl.driver = dev->id; + ictl.arg = chan->id; + dev->dev_if->statcallb(&ictl); } -void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan, +void cb_notdone(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data) { } @@ -311,38 +311,35 @@ void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan, /* * send activate b-chan protocol */ -void cb_selp_1(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) +void cb_selp_1(struct pcbit_dev *dev, struct pcbit_chan *chan, + struct callb_data *data) { - struct sk_buff *skb; + struct sk_buff *skb; int len; - ushort refnum; + ushort refnum; - if ((len = capi_activate_transp_req(chan, &skb)) < 0) - { - printk("capi_conn_activate_transp_req failed\n"); - return; - } + if ((len = capi_activate_transp_req(chan, &skb)) < 0) + { + printk("capi_conn_activate_transp_req failed\n"); + return; + } - refnum = last_ref_num++ & 0x7fffU; - chan->s_refnum = refnum; + refnum = last_ref_num++ & 0x7fffU; + chan->s_refnum = refnum; - pcbit_l2_write(dev, MSG_ACT_TRANSP_REQ, refnum, skb, len); + pcbit_l2_write(dev, MSG_ACT_TRANSP_REQ, refnum, skb, len); } /* * Inform User that the B-channel is available */ -void cb_open(struct pcbit_dev * dev, struct pcbit_chan* chan, - struct callb_data *data) +void cb_open(struct pcbit_dev *dev, struct pcbit_chan *chan, + struct callb_data *data) { - isdn_ctrl ictl; + isdn_ctrl ictl; - ictl.command = ISDN_STAT_BCONN; - ictl.driver=dev->id; - ictl.arg=chan->id; - dev->dev_if->statcallb(&ictl); + ictl.command = ISDN_STAT_BCONN; + ictl.driver = dev->id; + ictl.arg = chan->id; + dev->dev_if->statcallb(&ictl); } - - - diff --git a/drivers/isdn/pcbit/callbacks.h b/drivers/isdn/pcbit/callbacks.h index 17aa0f54bfc..a036b4a7ffa 100644 --- a/drivers/isdn/pcbit/callbacks.h +++ b/drivers/isdn/pcbit/callbacks.h @@ -2,10 +2,10 @@ * Callbacks prototypes for FSM * * Copyright (C) 1996 Universidade de Lisboa - * + * * Written by Pedro Roque Marques (roque@di.fc.ul.pt) * - * This software may be used and distributed according to the terms of + * This software may be used and distributed according to the terms of * the GNU General Public License, incorporated herein by reference. */ @@ -13,34 +13,32 @@ #define CALLBACKS_H -extern void cb_out_1(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_out_1(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); -extern void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_out_2(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); -extern void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_in_1(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); -extern void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_in_2(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); -extern void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_in_3(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); -extern void cb_disc_1(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_disc_1(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); -extern void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_disc_2(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); -extern void cb_disc_3(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_disc_3(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); -extern void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_notdone(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); -extern void cb_selp_1(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_selp_1(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); -extern void cb_open(struct pcbit_dev * dev, struct pcbit_chan* chan, +extern void cb_open(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data); #endif - - diff --git a/drivers/isdn/pcbit/capi.c b/drivers/isdn/pcbit/capi.c index ac5a91ccde8..4e3cbf857d6 100644 --- a/drivers/isdn/pcbit/capi.c +++ b/drivers/isdn/pcbit/capi.c @@ -3,10 +3,10 @@ * Portugal Telecom CAPI 2.0 * * Copyright (C) 1996 Universidade de Lisboa - * + * * Written by Pedro Roque Marques (roque@di.fc.ul.pt) * - * This software may be used and distributed according to the terms of + * This software may be used and distributed according to the terms of * the GNU General Public License, incorporated herein by reference. * * Not compatible with the AVM Gmbh. CAPI 2.0 @@ -51,39 +51,39 @@ * */ -int capi_conn_req(const char * calledPN, struct sk_buff **skb, int proto) +int capi_conn_req(const char *calledPN, struct sk_buff **skb, int proto) { - ushort len; - - /* - * length - * AppInfoMask - 2 - * BC0 - 3 - * BC1 - 1 - * Chan - 2 - * Keypad - 1 - * CPN - 1 - * CPSA - 1 - * CalledPN - 2 + strlen - * CalledPSA - 1 - * rest... - 4 - * ---------------- - * Total 18 + strlen - */ - - len = 18 + strlen(calledPN); + ushort len; + + /* + * length + * AppInfoMask - 2 + * BC0 - 3 + * BC1 - 1 + * Chan - 2 + * Keypad - 1 + * CPN - 1 + * CPSA - 1 + * CalledPN - 2 + strlen + * CalledPSA - 1 + * rest... - 4 + * ---------------- + * Total 18 + strlen + */ + + len = 18 + strlen(calledPN); if (proto == ISDN_PROTO_L2_TRANS) len++; if ((*skb = dev_alloc_skb(len)) == NULL) { - - printk(KERN_WARNING "capi_conn_req: alloc_skb failed\n"); + + printk(KERN_WARNING "capi_conn_req: alloc_skb failed\n"); return -1; } - /* InfoElmMask */ - *((ushort*) skb_put(*skb, 2)) = AppInfoMask; + /* InfoElmMask */ + *((ushort *)skb_put(*skb, 2)) = AppInfoMask; if (proto == ISDN_PROTO_L2_TRANS) { @@ -101,162 +101,162 @@ int capi_conn_req(const char * calledPN, struct sk_buff **skb, int proto) *(skb_put(*skb, 1)) = 0x90; /* BC0.Octect4 */ } - /* Bearer Capability - Optional*/ - *(skb_put(*skb, 1)) = 0; /* BC1.Length = 0 */ + /* Bearer Capability - Optional*/ + *(skb_put(*skb, 1)) = 0; /* BC1.Length = 0 */ - *(skb_put(*skb, 1)) = 1; /* ChannelID.Length = 1 */ - *(skb_put(*skb, 1)) = 0x83; /* Basic Interface - Any Channel */ + *(skb_put(*skb, 1)) = 1; /* ChannelID.Length = 1 */ + *(skb_put(*skb, 1)) = 0x83; /* Basic Interface - Any Channel */ - *(skb_put(*skb, 1)) = 0; /* Keypad.Length = 0 */ - + *(skb_put(*skb, 1)) = 0; /* Keypad.Length = 0 */ - *(skb_put(*skb, 1)) = 0; /* CallingPN.Length = 0 */ - *(skb_put(*skb, 1)) = 0; /* CallingPSA.Length = 0 */ - /* Called Party Number */ - *(skb_put(*skb, 1)) = strlen(calledPN) + 1; - *(skb_put(*skb, 1)) = 0x81; - memcpy(skb_put(*skb, strlen(calledPN)), calledPN, strlen(calledPN)); + *(skb_put(*skb, 1)) = 0; /* CallingPN.Length = 0 */ + *(skb_put(*skb, 1)) = 0; /* CallingPSA.Length = 0 */ - /* '#' */ + /* Called Party Number */ + *(skb_put(*skb, 1)) = strlen(calledPN) + 1; + *(skb_put(*skb, 1)) = 0x81; + memcpy(skb_put(*skb, strlen(calledPN)), calledPN, strlen(calledPN)); - *(skb_put(*skb, 1)) = 0; /* CalledPSA.Length = 0 */ + /* '#' */ - /* LLC.Length = 0; */ - /* HLC0.Length = 0; */ - /* HLC1.Length = 0; */ - /* UTUS.Length = 0; */ - memset(skb_put(*skb, 4), 0, 4); + *(skb_put(*skb, 1)) = 0; /* CalledPSA.Length = 0 */ - return len; + /* LLC.Length = 0; */ + /* HLC0.Length = 0; */ + /* HLC1.Length = 0; */ + /* UTUS.Length = 0; */ + memset(skb_put(*skb, 4), 0, 4); + + return len; } -int capi_conn_resp(struct pcbit_chan* chan, struct sk_buff **skb) +int capi_conn_resp(struct pcbit_chan *chan, struct sk_buff **skb) { - + if ((*skb = dev_alloc_skb(5)) == NULL) { - + printk(KERN_WARNING "capi_conn_resp: alloc_skb failed\n"); return -1; } - *((ushort*) skb_put(*skb, 2) ) = chan->callref; - *(skb_put(*skb, 1)) = 0x01; /* ACCEPT_CALL */ - *(skb_put(*skb, 1)) = 0; - *(skb_put(*skb, 1)) = 0; + *((ushort *)skb_put(*skb, 2)) = chan->callref; + *(skb_put(*skb, 1)) = 0x01; /* ACCEPT_CALL */ + *(skb_put(*skb, 1)) = 0; + *(skb_put(*skb, 1)) = 0; - return 5; + return 5; } -int capi_conn_active_req(struct pcbit_chan* chan, struct sk_buff **skb) +int capi_conn_active_req(struct pcbit_chan *chan, struct sk_buff **skb) { - /* - * 8 bytes - */ - + /* + * 8 bytes + */ + if ((*skb = dev_alloc_skb(8)) == NULL) { - + printk(KERN_WARNING "capi_conn_active_req: alloc_skb failed\n"); return -1; } - *((ushort*) skb_put(*skb, 2) ) = chan->callref; + *((ushort *)skb_put(*skb, 2)) = chan->callref; #ifdef DEBUG - printk(KERN_DEBUG "Call Reference: %04x\n", chan->callref); + printk(KERN_DEBUG "Call Reference: %04x\n", chan->callref); #endif - *(skb_put(*skb, 1)) = 0; /* BC.Length = 0; */ - *(skb_put(*skb, 1)) = 0; /* ConnectedPN.Length = 0 */ - *(skb_put(*skb, 1)) = 0; /* PSA.Length */ - *(skb_put(*skb, 1)) = 0; /* LLC.Length = 0; */ - *(skb_put(*skb, 1)) = 0; /* HLC.Length = 0; */ - *(skb_put(*skb, 1)) = 0; /* UTUS.Length = 0; */ + *(skb_put(*skb, 1)) = 0; /* BC.Length = 0; */ + *(skb_put(*skb, 1)) = 0; /* ConnectedPN.Length = 0 */ + *(skb_put(*skb, 1)) = 0; /* PSA.Length */ + *(skb_put(*skb, 1)) = 0; /* LLC.Length = 0; */ + *(skb_put(*skb, 1)) = 0; /* HLC.Length = 0; */ + *(skb_put(*skb, 1)) = 0; /* UTUS.Length = 0; */ return 8; } -int capi_conn_active_resp(struct pcbit_chan* chan, struct sk_buff **skb) +int capi_conn_active_resp(struct pcbit_chan *chan, struct sk_buff **skb) { - /* - * 2 bytes - */ - + /* + * 2 bytes + */ + if ((*skb = dev_alloc_skb(2)) == NULL) { - + printk(KERN_WARNING "capi_conn_active_resp: alloc_skb failed\n"); return -1; } - *((ushort*) skb_put(*skb, 2) ) = chan->callref; + *((ushort *)skb_put(*skb, 2)) = chan->callref; - return 2; + return 2; } -int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb, - int outgoing) +int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb, + int outgoing) { - /* - * 18 bytes - */ + /* + * 18 bytes + */ if ((*skb = dev_alloc_skb(18)) == NULL) { - + printk(KERN_WARNING "capi_select_proto_req: alloc_skb failed\n"); return -1; } - *((ushort*) skb_put(*skb, 2) ) = chan->callref; + *((ushort *)skb_put(*skb, 2)) = chan->callref; - /* Layer2 protocol */ + /* Layer2 protocol */ - switch (chan->proto) { - case ISDN_PROTO_L2_X75I: - *(skb_put(*skb, 1)) = 0x05; /* LAPB */ - break; - case ISDN_PROTO_L2_HDLC: - *(skb_put(*skb, 1)) = 0x02; - break; + switch (chan->proto) { + case ISDN_PROTO_L2_X75I: + *(skb_put(*skb, 1)) = 0x05; /* LAPB */ + break; + case ISDN_PROTO_L2_HDLC: + *(skb_put(*skb, 1)) = 0x02; + break; case ISDN_PROTO_L2_TRANS: - /* + /* * Voice (a-law) */ *(skb_put(*skb, 1)) = 0x06; break; - default: -#ifdef DEBUG - printk(KERN_DEBUG "Transparent\n"); + default: +#ifdef DEBUG + printk(KERN_DEBUG "Transparent\n"); #endif - *(skb_put(*skb, 1)) = 0x03; - break; - } - - *(skb_put(*skb, 1)) = (outgoing ? 0x02 : 0x42); /* Don't ask */ - *(skb_put(*skb, 1)) = 0x00; - - *((ushort *) skb_put(*skb, 2)) = MRU; - - - *(skb_put(*skb, 1)) = 0x08; /* Modulo */ - *(skb_put(*skb, 1)) = 0x07; /* Max Window */ - - *(skb_put(*skb, 1)) = 0x01; /* No Layer3 Protocol */ - - /* - * 2 - layer3 MTU [10] - * - Modulo [12] - * - Window - * - layer1 proto [14] - * - bitrate - * - sub-channel [16] - * - layer1dataformat [17] - */ - - memset(skb_put(*skb, 8), 0, 8); - - return 18; + *(skb_put(*skb, 1)) = 0x03; + break; + } + + *(skb_put(*skb, 1)) = (outgoing ? 0x02 : 0x42); /* Don't ask */ + *(skb_put(*skb, 1)) = 0x00; + + *((ushort *) skb_put(*skb, 2)) = MRU; + + + *(skb_put(*skb, 1)) = 0x08; /* Modulo */ + *(skb_put(*skb, 1)) = 0x07; /* Max Window */ + + *(skb_put(*skb, 1)) = 0x01; /* No Layer3 Protocol */ + + /* + * 2 - layer3 MTU [10] + * - Modulo [12] + * - Window + * - layer1 proto [14] + * - bitrate + * - sub-channel [16] + * - layer1dataformat [17] + */ + + memset(skb_put(*skb, 8), 0, 8); + + return 18; } @@ -264,45 +264,45 @@ int capi_activate_transp_req(struct pcbit_chan *chan, struct sk_buff **skb) { if ((*skb = dev_alloc_skb(7)) == NULL) { - + printk(KERN_WARNING "capi_activate_transp_req: alloc_skb failed\n"); return -1; } - *((ushort*) skb_put(*skb, 2) ) = chan->callref; + *((ushort *)skb_put(*skb, 2)) = chan->callref; - - *(skb_put(*skb, 1)) = chan->layer2link; /* Layer2 id */ - *(skb_put(*skb, 1)) = 0x00; /* Transmit by default */ - *((ushort *) skb_put(*skb, 2)) = MRU; + *(skb_put(*skb, 1)) = chan->layer2link; /* Layer2 id */ + *(skb_put(*skb, 1)) = 0x00; /* Transmit by default */ - *(skb_put(*skb, 1)) = 0x01; /* Enables reception*/ + *((ushort *) skb_put(*skb, 2)) = MRU; - return 7; + *(skb_put(*skb, 1)) = 0x01; /* Enables reception*/ + + return 7; } -int capi_tdata_req(struct pcbit_chan* chan, struct sk_buff *skb) +int capi_tdata_req(struct pcbit_chan *chan, struct sk_buff *skb) { ushort data_len; - - /* - * callref - 2 + + /* + * callref - 2 * layer2link - 1 - * wBlockLength - 2 + * wBlockLength - 2 * data - 4 * sernum - 1 */ - + data_len = skb->len; - if(skb_headroom(skb) < 10) + if (skb_headroom(skb) < 10) { printk(KERN_CRIT "No headspace (%u) on headroom %p for capi header\n", skb_headroom(skb), skb); } else - { + { skb_push(skb, 10); } @@ -318,58 +318,58 @@ int capi_tdata_req(struct pcbit_chan* chan, struct sk_buff *skb) return 10; } -int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff ** skb) - +int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff **skb) + { if ((*skb = dev_alloc_skb(4)) == NULL) { - + printk(KERN_WARNING "capi_tdata_resp: alloc_skb failed\n"); return -1; } - *((ushort*) skb_put(*skb, 2) ) = chan->callref; + *((ushort *)skb_put(*skb, 2)) = chan->callref; - *(skb_put(*skb, 1)) = chan->layer2link; - *(skb_put(*skb, 1)) = chan->r_refnum; + *(skb_put(*skb, 1)) = chan->layer2link; + *(skb_put(*skb, 1)) = chan->r_refnum; - return (*skb)->len; + return (*skb)->len; } int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause) { if ((*skb = dev_alloc_skb(6)) == NULL) { - + printk(KERN_WARNING "capi_disc_req: alloc_skb failed\n"); return -1; } - *((ushort*) skb_put(*skb, 2) ) = callref; + *((ushort *)skb_put(*skb, 2)) = callref; - *(skb_put(*skb, 1)) = 2; /* Cause.Length = 2; */ - *(skb_put(*skb, 1)) = 0x80; - *(skb_put(*skb, 1)) = 0x80 | cause; + *(skb_put(*skb, 1)) = 2; /* Cause.Length = 2; */ + *(skb_put(*skb, 1)) = 0x80; + *(skb_put(*skb, 1)) = 0x80 | cause; - /* - * Change it: we should send 'Sic transit gloria Mundi' here ;-) - */ + /* + * Change it: we should send 'Sic transit gloria Mundi' here ;-) + */ - *(skb_put(*skb, 1)) = 0; /* UTUS.Length = 0; */ + *(skb_put(*skb, 1)) = 0; /* UTUS.Length = 0; */ - return 6; + return 6; } int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb) { if ((*skb = dev_alloc_skb(2)) == NULL) { - + printk(KERN_WARNING "capi_disc_resp: alloc_skb failed\n"); return -1; } - *((ushort*) skb_put(*skb, 2)) = chan->callref; + *((ushort *)skb_put(*skb, 2)) = chan->callref; - return 2; + return 2; } @@ -378,57 +378,57 @@ int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb) * */ -int capi_decode_conn_ind(struct pcbit_chan * chan, - struct sk_buff *skb, - struct callb_data *info) +int capi_decode_conn_ind(struct pcbit_chan *chan, + struct sk_buff *skb, + struct callb_data *info) { - int CIlen, len; + int CIlen, len; - /* Call Reference [CAPI] */ - chan->callref = *((ushort*) skb->data); - skb_pull(skb, 2); + /* Call Reference [CAPI] */ + chan->callref = *((ushort *)skb->data); + skb_pull(skb, 2); #ifdef DEBUG - printk(KERN_DEBUG "Call Reference: %04x\n", chan->callref); + printk(KERN_DEBUG "Call Reference: %04x\n", chan->callref); #endif - /* Channel Identification */ + /* Channel Identification */ - /* Expect - Len = 1 - Octect 3 = 0100 10CC - [ 7 Basic, 4 , 2-1 chan ] - */ + /* Expect + Len = 1 + Octect 3 = 0100 10CC - [ 7 Basic, 4 , 2-1 chan ] + */ - CIlen = skb->data[0]; + CIlen = skb->data[0]; #ifdef DEBUG - if (CIlen == 1) { + if (CIlen == 1) { - if ( ((skb->data[1]) & 0xFC) == 0x48 ) - printk(KERN_DEBUG "decode_conn_ind: chan ok\n"); - printk(KERN_DEBUG "phyChan = %d\n", skb->data[1] & 0x03); - } + if (((skb->data[1]) & 0xFC) == 0x48) + printk(KERN_DEBUG "decode_conn_ind: chan ok\n"); + printk(KERN_DEBUG "phyChan = %d\n", skb->data[1] & 0x03); + } else printk(KERN_DEBUG "conn_ind: CIlen = %d\n", CIlen); #endif - skb_pull(skb, CIlen + 1); + skb_pull(skb, CIlen + 1); |