aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/pcbit/callbacks.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-02-19 22:52:38 -0500
committerJoe Perches <joe@perches.com>2012-02-21 12:04:01 -0500
commit475be4d85a274d0961593db41cf85689db1d583c (patch)
treeb2b8931eb747794730522c3cf1898e46948527b9 /drivers/isdn/pcbit/callbacks.c
parent0b0a635f79f91f3755b6518627ea06dd0dbfd523 (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/callbacks.c')
-rw-r--r--drivers/isdn/pcbit/callbacks.c303
1 files changed, 150 insertions, 153 deletions
diff --git a/drivers/isdn/pcbit/callbacks.c b/drivers/isdn/pcbit/callbacks.c
index 976143b2346d..efb6d6a3639a 100644
--- a/drivers/isdn/pcbit/callbacks.c
+++ b/drivers/isdn/pcbit/callbacks.c
@@ -2,16 +2,16 @@
2 * Callbacks for the FSM 2 * Callbacks for the FSM
3 * 3 *
4 * Copyright (C) 1996 Universidade de Lisboa 4 * Copyright (C) 1996 Universidade de Lisboa
5 * 5 *
6 * Written by Pedro Roque Marques (roque@di.fc.ul.pt) 6 * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
7 * 7 *
8 * This software may be used and distributed according to the terms of 8 * This software may be used and distributed according to the terms of
9 * the GNU General Public License, incorporated herein by reference. 9 * the GNU General Public License, incorporated herein by reference.
10 */ 10 */
11 11
12/* 12/*
13 * Fix: 19981230 - Carlos Morgado <chbm@techie.com> 13 * Fix: 19981230 - Carlos Morgado <chbm@techie.com>
14 * Port of Nelson Escravana's <nelson.escravana@usa.net> fix to CalledPN 14 * Port of Nelson Escravana's <nelson.escravana@usa.net> fix to CalledPN
15 * NULL pointer dereference in cb_in_1 (originally fixed in 2.0) 15 * NULL pointer dereference in cb_in_1 (originally fixed in 2.0)
16 */ 16 */
17 17
@@ -39,86 +39,86 @@ ushort last_ref_num = 1;
39 * 39 *
40 */ 40 */
41 41
42void cb_out_1(struct pcbit_dev * dev, struct pcbit_chan* chan, 42void cb_out_1(struct pcbit_dev *dev, struct pcbit_chan *chan,
43 struct callb_data *cbdata) 43 struct callb_data *cbdata)
44{ 44{
45 struct sk_buff *skb; 45 struct sk_buff *skb;
46 int len; 46 int len;
47 ushort refnum; 47 ushort refnum;
48 48
49 49
50#ifdef DEBUG 50#ifdef DEBUG
51 printk(KERN_DEBUG "Called Party Number: %s\n", 51 printk(KERN_DEBUG "Called Party Number: %s\n",
52 cbdata->data.setup.CalledPN); 52 cbdata->data.setup.CalledPN);
53#endif 53#endif
54 /* 54 /*
55 * hdr - kmalloc in capi_conn_req 55 * hdr - kmalloc in capi_conn_req
56 * - kfree when msg has been sent 56 * - kfree when msg has been sent
57 */ 57 */
58 58
59 if ((len = capi_conn_req(cbdata->data.setup.CalledPN, &skb, 59 if ((len = capi_conn_req(cbdata->data.setup.CalledPN, &skb,
60 chan->proto)) < 0) 60 chan->proto)) < 0)
61 { 61 {
62 printk("capi_conn_req failed\n"); 62 printk("capi_conn_req failed\n");
63 return; 63 return;
64 } 64 }
65 65
66 66
67 refnum = last_ref_num++ & 0x7fffU; 67 refnum = last_ref_num++ & 0x7fffU;
68 68
69 chan->callref = 0; 69 chan->callref = 0;
70 chan->layer2link = 0; 70 chan->layer2link = 0;
71 chan->snum = 0; 71 chan->snum = 0;
72 chan->s_refnum = refnum; 72 chan->s_refnum = refnum;
73 73
74 pcbit_l2_write(dev, MSG_CONN_REQ, refnum, skb, len); 74 pcbit_l2_write(dev, MSG_CONN_REQ, refnum, skb, len);
75} 75}
76 76
77/* 77/*
78 * rcv CONNECT 78 * rcv CONNECT
79 * will go into ACTIVE state 79 * will go into ACTIVE state
80 * send CONN_ACTIVE_RESP 80 * send CONN_ACTIVE_RESP
81 * send Select protocol request 81 * send Select protocol request
82 */ 82 */
83 83
84void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan, 84void cb_out_2(struct pcbit_dev *dev, struct pcbit_chan *chan,
85 struct callb_data *data) 85 struct callb_data *data)
86{ 86{
87 isdn_ctrl ictl; 87 isdn_ctrl ictl;
88 struct sk_buff *skb; 88 struct sk_buff *skb;
89 int len; 89 int len;
90 ushort refnum; 90 ushort refnum;
91 91
92 if ((len=capi_conn_active_resp(chan, &skb)) < 0) 92 if ((len = capi_conn_active_resp(chan, &skb)) < 0)
93 { 93 {
94 printk("capi_conn_active_req failed\n"); 94 printk("capi_conn_active_req failed\n");
95 return; 95 return;
96 } 96 }
97 97
98 refnum = last_ref_num++ & 0x7fffU; 98 refnum = last_ref_num++ & 0x7fffU;
99 chan->s_refnum = refnum; 99 chan->s_refnum = refnum;
100 100
101 pcbit_l2_write(dev, MSG_CONN_ACTV_RESP, refnum, skb, len); 101 pcbit_l2_write(dev, MSG_CONN_ACTV_RESP, refnum, skb, len);
102 102
103 103
104 ictl.command = ISDN_STAT_DCONN; 104 ictl.command = ISDN_STAT_DCONN;
105 ictl.driver=dev->id; 105 ictl.driver = dev->id;
106 ictl.arg=chan->id; 106 ictl.arg = chan->id;
107 dev->dev_if->statcallb(&ictl); 107 dev->dev_if->statcallb(&ictl);
108 108
109 /* ACTIVE D-channel */ 109 /* ACTIVE D-channel */
110 110
111 /* Select protocol */ 111 /* Select protocol */
112 112
113 if ((len=capi_select_proto_req(chan, &skb, 1 /*outgoing*/)) < 0) { 113 if ((len = capi_select_proto_req(chan, &skb, 1 /*outgoing*/)) < 0) {
114 printk("capi_select_proto_req failed\n"); 114 printk("capi_select_proto_req failed\n");
115 return; 115 return;
116 } 116 }
117 117
118 refnum = last_ref_num++ & 0x7fffU; 118 refnum = last_ref_num++ & 0x7fffU;
119 chan->s_refnum = refnum; 119 chan->s_refnum = refnum;
120 120
121 pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); 121 pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len);
122} 122}
123 123
124 124
@@ -127,22 +127,22 @@ void cb_out_2(struct pcbit_dev * dev, struct pcbit_chan* chan,
127 * inform user 127 * inform user
128 */ 128 */
129 129
130void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan, 130void cb_in_1(struct pcbit_dev *dev, struct pcbit_chan *chan,
131 struct callb_data *cbdata) 131 struct callb_data *cbdata)
132{ 132{
133 isdn_ctrl ictl; 133 isdn_ctrl ictl;
134 unsigned short refnum; 134 unsigned short refnum;
135 struct sk_buff *skb; 135 struct sk_buff *skb;
136 int len; 136 int len;
137 137
138 138
139 ictl.command = ISDN_STAT_ICALL; 139 ictl.command = ISDN_STAT_ICALL;
140 ictl.driver=dev->id; 140 ictl.driver = dev->id;
141 ictl.arg=chan->id; 141 ictl.arg = chan->id;
142 142
143 /* 143 /*
144 * ictl.num >= strlen() + strlen() + 5 144 * ictl.num >= strlen() + strlen() + 5
145 */ 145 */
146 146
147 if (cbdata->data.setup.CallingPN == NULL) { 147 if (cbdata->data.setup.CallingPN == NULL) {
148 printk(KERN_DEBUG "NULL CallingPN to phone; using 0\n"); 148 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,
167 printk(KERN_DEBUG "statstr: %s\n", ictl.num); 167 printk(KERN_DEBUG "statstr: %s\n", ictl.num);
168#endif 168#endif
169 169
170 dev->dev_if->statcallb(&ictl); 170 dev->dev_if->statcallb(&ictl);
171
171 172
172 173 if ((len = capi_conn_resp(chan, &skb)) < 0) {
173 if ((len=capi_conn_resp(chan, &skb)) < 0) { 174 printk(KERN_DEBUG "capi_conn_resp failed\n");
174 printk(KERN_DEBUG "capi_conn_resp failed\n"); 175 return;
175 return;
176 } 176 }
177 177
178 refnum = last_ref_num++ & 0x7fffU; 178 refnum = last_ref_num++ & 0x7fffU;
179 chan->s_refnum = refnum; 179 chan->s_refnum = refnum;
180 180
181 pcbit_l2_write(dev, MSG_CONN_RESP, refnum, skb, len); 181 pcbit_l2_write(dev, MSG_CONN_RESP, refnum, skb, len);
182} 182}
183 183
184/* 184/*
@@ -187,24 +187,24 @@ void cb_in_1(struct pcbit_dev * dev, struct pcbit_chan* chan,
187 * send CONNECT message CONNECT_ACTIVE_REQ in CAPI 187 * send CONNECT message CONNECT_ACTIVE_REQ in CAPI
188 */ 188 */
189 189
190void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan, 190void cb_in_2(struct pcbit_dev *dev, struct pcbit_chan *chan,
191 struct callb_data *data) 191 struct callb_data *data)
192{ 192{
193 unsigned short refnum; 193 unsigned short refnum;
194 struct sk_buff *skb; 194 struct sk_buff *skb;
195 int len; 195 int len;
196 196
197 if ((len = capi_conn_active_req(chan, &skb)) < 0) { 197 if ((len = capi_conn_active_req(chan, &skb)) < 0) {
198 printk(KERN_DEBUG "capi_conn_active_req failed\n"); 198 printk(KERN_DEBUG "capi_conn_active_req failed\n");
199 return; 199 return;
200 } 200 }
201 201
202 202
203 refnum = last_ref_num++ & 0x7fffU; 203 refnum = last_ref_num++ & 0x7fffU;
204 chan->s_refnum = refnum; 204 chan->s_refnum = refnum;
205 205
206 printk(KERN_DEBUG "sending MSG_CONN_ACTV_REQ\n"); 206 printk(KERN_DEBUG "sending MSG_CONN_ACTV_REQ\n");
207 pcbit_l2_write(dev, MSG_CONN_ACTV_REQ, refnum, skb, len); 207 pcbit_l2_write(dev, MSG_CONN_ACTV_REQ, refnum, skb, len);
208} 208}
209 209
210/* 210/*
@@ -213,23 +213,23 @@ void cb_in_2(struct pcbit_dev * dev, struct pcbit_chan* chan,
213 * 213 *
214 */ 214 */
215 215
216void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan, 216void cb_in_3(struct pcbit_dev *dev, struct pcbit_chan *chan,
217 struct callb_data *data) 217 struct callb_data *data)
218{ 218{
219 unsigned short refnum; 219 unsigned short refnum;
220 struct sk_buff *skb; 220 struct sk_buff *skb;
221 int len; 221 int len;
222
223 if ((len = capi_select_proto_req(chan, &skb, 0 /*incoming*/)) < 0)
224 {
225 printk("capi_select_proto_req failed\n");
226 return;
227 }
228 222
229 refnum = last_ref_num++ & 0x7fffU; 223 if ((len = capi_select_proto_req(chan, &skb, 0 /*incoming*/)) < 0)
230 chan->s_refnum = refnum; 224 {
225 printk("capi_select_proto_req failed\n");
226 return;
227 }
228
229 refnum = last_ref_num++ & 0x7fffU;
230 chan->s_refnum = refnum;
231 231
232 pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); 232 pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len);
233 233
234} 234}
235 235
@@ -239,52 +239,52 @@ void cb_in_3(struct pcbit_dev * dev, struct pcbit_chan* chan,
239 * send disconnect resp 239 * send disconnect resp
240 * send msg to user 240 * send msg to user
241 */ 241 */
242void cb_disc_1(struct pcbit_dev * dev, struct pcbit_chan* chan, 242void cb_disc_1(struct pcbit_dev *dev, struct pcbit_chan *chan,
243 struct callb_data *data) 243 struct callb_data *data)
244{ 244{
245 struct sk_buff *skb; 245 struct sk_buff *skb;
246 int len; 246 int len;
247 ushort refnum; 247 ushort refnum;
248 isdn_ctrl ictl; 248 isdn_ctrl ictl;
249 249
250 if ((len = capi_disc_resp(chan, &skb)) < 0) { 250 if ((len = capi_disc_resp(chan, &skb)) < 0) {
251 printk("capi_disc_resp failed\n"); 251 printk("capi_disc_resp failed\n");
252 return; 252 return;
253 } 253 }
254 254
255 refnum = last_ref_num++ & 0x7fffU; 255 refnum = last_ref_num++ & 0x7fffU;
256 chan->s_refnum = refnum; 256 chan->s_refnum = refnum;
257 257
258 pcbit_l2_write(dev, MSG_DISC_RESP, refnum, skb, len); 258 pcbit_l2_write(dev, MSG_DISC_RESP, refnum, skb, len);
259 259
260 ictl.command = ISDN_STAT_BHUP; 260 ictl.command = ISDN_STAT_BHUP;
261 ictl.driver=dev->id; 261 ictl.driver = dev->id;
262 ictl.arg=chan->id; 262 ictl.arg = chan->id;
263 dev->dev_if->statcallb(&ictl); 263 dev->dev_if->statcallb(&ictl);
264} 264}
265 265
266 266
267/* 267/*
268 * User HANGUP on active/call proceeding state 268 * User HANGUP on active/call proceeding state
269 * send disc.req 269 * send disc.req
270 */ 270 */
271void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan, 271void cb_disc_2(struct pcbit_dev *dev, struct pcbit_chan *chan,
272 struct callb_data *data) 272 struct callb_data *data)
273{ 273{
274 struct sk_buff *skb; 274 struct sk_buff *skb;
275 int len; 275 int len;
276 ushort refnum; 276 ushort refnum;
277 277
278 if ((len = capi_disc_req(chan->callref, &skb, CAUSE_NORMAL)) < 0) 278 if ((len = capi_disc_req(chan->callref, &skb, CAUSE_NORMAL)) < 0)
279 { 279 {
280 printk("capi_disc_req failed\n"); 280 printk("capi_disc_req failed\n");
281 return; 281 return;
282 } 282 }
283 283
284 refnum = last_ref_num++ & 0x7fffU; 284 refnum = last_ref_num++ & 0x7fffU;
285 chan->s_refnum = refnum; 285 chan->s_refnum = refnum;
286 286
287 pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb, len); 287 pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb, len);
288} 288}
289 289
290/* 290/*
@@ -292,18 +292,18 @@ void cb_disc_2(struct pcbit_dev * dev, struct pcbit_chan* chan,
292 * Problem: when the HL driver sends the disc req itself 292 * Problem: when the HL driver sends the disc req itself
293 * LL receives BHUP 293 * LL receives BHUP
294 */ 294 */
295void cb_disc_3(struct pcbit_dev * dev, struct pcbit_chan* chan, 295void cb_disc_3(struct pcbit_dev *dev, struct pcbit_chan *chan,
296 struct callb_data *data) 296 struct callb_data *data)
297{ 297{
298 isdn_ctrl ictl; 298 isdn_ctrl ictl;
299 299
300 ictl.command = ISDN_STAT_BHUP; 300 ictl.command = ISDN_STAT_BHUP;
301 ictl.driver=dev->id; 301 ictl.driver = dev->id;
302 ictl.arg=chan->id; 302 ictl.arg = chan->id;
303 dev->dev_if->statcallb(&ictl); 303 dev->dev_if->statcallb(&ictl);
304} 304}
305 305
306void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan, 306void cb_notdone(struct pcbit_dev *dev, struct pcbit_chan *chan,
307 struct callb_data *data) 307 struct callb_data *data)
308{ 308{
309} 309}
@@ -311,38 +311,35 @@ void cb_notdone(struct pcbit_dev * dev, struct pcbit_chan* chan,
311/* 311/*
312 * send activate b-chan protocol 312 * send activate b-chan protocol
313 */ 313 */
314void cb_selp_1(struct pcbit_dev * dev, struct pcbit_chan* chan, 314void cb_selp_1(struct pcbit_dev *dev, struct pcbit_chan *chan,
315 struct callb_data *data) 315 struct callb_data *data)
316{ 316{
317 struct sk_buff *skb; 317 struct sk_buff *skb;
318 int len; 318 int len;
319 ushort refnum; 319 ushort refnum;
320 320
321 if ((len = capi_activate_transp_req(chan, &skb)) < 0) 321 if ((len = capi_activate_transp_req(chan, &skb)) < 0)
322 { 322 {
323 printk("capi_conn_activate_transp_req failed\n"); 323 printk("capi_conn_activate_transp_req failed\n");
324 return; 324 return;
325 } 325 }
326 326
327 refnum = last_ref_num++ & 0x7fffU; 327 refnum = last_ref_num++ & 0x7fffU;
328 chan->s_refnum = refnum; 328 chan->s_refnum = refnum;
329 329
330 pcbit_l2_write(dev, MSG_ACT_TRANSP_REQ, refnum, skb, len); 330 pcbit_l2_write(dev, MSG_ACT_TRANSP_REQ, refnum, skb, len);
331} 331}
332 332
333/* 333/*
334 * Inform User that the B-channel is available 334 * Inform User that the B-channel is available
335 */ 335 */
336void cb_open(struct pcbit_dev * dev, struct pcbit_chan* chan, 336void cb_open(struct pcbit_dev *dev, struct pcbit_chan *chan,
337 struct callb_data *data) 337 struct callb_data *data)
338{ 338{
339 isdn_ctrl ictl; 339 isdn_ctrl ictl;
340 340
341 ictl.command = ISDN_STAT_BCONN; 341 ictl.command = ISDN_STAT_BCONN;
342 ictl.driver=dev->id; 342 ictl.driver = dev->id;
343 ictl.arg=chan->id; 343 ictl.arg = chan->id;
344 dev->dev_if->statcallb(&ictl); 344 dev->dev_if->statcallb(&ictl);
345} 345}
346
347
348