diff options
author | Joe Perches <joe@perches.com> | 2012-02-19 22:52:38 -0500 |
---|---|---|
committer | Joe Perches <joe@perches.com> | 2012-02-21 12:04:01 -0500 |
commit | 475be4d85a274d0961593db41cf85689db1d583c (patch) | |
tree | b2b8931eb747794730522c3cf1898e46948527b9 /drivers/isdn/hisax/isdnl2.c | |
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/hisax/isdnl2.c')
-rw-r--r-- | drivers/isdn/hisax/isdnl2.c | 342 |
1 files changed, 171 insertions, 171 deletions
diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c index cfff0c41d298..18accb0a79cc 100644 --- a/drivers/isdn/hisax/isdnl2.c +++ b/drivers/isdn/hisax/isdnl2.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Author Karsten Keil | 3 | * Author Karsten Keil |
4 | * based on the teles driver from Jan den Ouden | 4 | * based on the teles driver from Jan den Ouden |
5 | * Copyright by Karsten Keil <keil@isdn4linux.de> | 5 | * Copyright by Karsten Keil <keil@isdn4linux.de> |
6 | * | 6 | * |
7 | * This software may be used and distributed according to the terms | 7 | * This software may be used and distributed according to the terms |
8 | * of the GNU General Public License, incorporated herein by reference. | 8 | * of the GNU General Public License, incorporated herein by reference. |
9 | * | 9 | * |
@@ -37,7 +37,7 @@ enum { | |||
37 | ST_L2_8, | 37 | ST_L2_8, |
38 | }; | 38 | }; |
39 | 39 | ||
40 | #define L2_STATE_COUNT (ST_L2_8+1) | 40 | #define L2_STATE_COUNT (ST_L2_8 + 1) |
41 | 41 | ||
42 | static char *strL2State[] = | 42 | static char *strL2State[] = |
43 | { | 43 | { |
@@ -76,7 +76,7 @@ enum { | |||
76 | EV_L2_FRAME_ERROR, | 76 | EV_L2_FRAME_ERROR, |
77 | }; | 77 | }; |
78 | 78 | ||
79 | #define L2_EVENT_COUNT (EV_L2_FRAME_ERROR+1) | 79 | #define L2_EVENT_COUNT (EV_L2_FRAME_ERROR + 1) |
80 | 80 | ||
81 | static char *strL2Event[] = | 81 | static char *strL2Event[] = |
82 | { | 82 | { |
@@ -155,7 +155,7 @@ ReleaseWin(struct Layer2 *l2) | |||
155 | { | 155 | { |
156 | int cnt; | 156 | int cnt; |
157 | 157 | ||
158 | if((cnt = freewin1(l2))) | 158 | if ((cnt = freewin1(l2))) |
159 | printk(KERN_WARNING "isdl2 freed %d skbuffs in release\n", cnt); | 159 | printk(KERN_WARNING "isdl2 freed %d skbuffs in release\n", cnt); |
160 | } | 160 | } |
161 | 161 | ||
@@ -164,7 +164,7 @@ cansend(struct PStack *st) | |||
164 | { | 164 | { |
165 | unsigned int p1; | 165 | unsigned int p1; |
166 | 166 | ||
167 | if(test_bit(FLG_MOD128, &st->l2.flag)) | 167 | if (test_bit(FLG_MOD128, &st->l2.flag)) |
168 | p1 = (st->l2.vs - st->l2.va) % 128; | 168 | p1 = (st->l2.vs - st->l2.va) % 128; |
169 | else | 169 | else |
170 | p1 = (st->l2.vs - st->l2.va) % 8; | 170 | p1 = (st->l2.vs - st->l2.va) % 8; |
@@ -194,7 +194,7 @@ l2addrsize(struct Layer2 *l2) | |||
194 | } | 194 | } |
195 | 195 | ||
196 | static int | 196 | static int |
197 | sethdraddr(struct Layer2 *l2, u_char * header, int rsp) | 197 | sethdraddr(struct Layer2 *l2, u_char *header, int rsp) |
198 | { | 198 | { |
199 | u_char *ptr = header; | 199 | u_char *ptr = header; |
200 | int crbit = rsp; | 200 | int crbit = rsp; |
@@ -226,41 +226,41 @@ enqueue_super(struct PStack *st, | |||
226 | #define enqueue_ui(a, b) enqueue_super(a, b) | 226 | #define enqueue_ui(a, b) enqueue_super(a, b) |
227 | 227 | ||
228 | static inline int | 228 | static inline int |
229 | IsUI(u_char * data) | 229 | IsUI(u_char *data) |
230 | { | 230 | { |
231 | return ((data[0] & 0xef) == UI); | 231 | return ((data[0] & 0xef) == UI); |
232 | } | 232 | } |
233 | 233 | ||
234 | static inline int | 234 | static inline int |
235 | IsUA(u_char * data) | 235 | IsUA(u_char *data) |
236 | { | 236 | { |
237 | return ((data[0] & 0xef) == UA); | 237 | return ((data[0] & 0xef) == UA); |
238 | } | 238 | } |
239 | 239 | ||
240 | static inline int | 240 | static inline int |
241 | IsDM(u_char * data) | 241 | IsDM(u_char *data) |
242 | { | 242 | { |
243 | return ((data[0] & 0xef) == DM); | 243 | return ((data[0] & 0xef) == DM); |
244 | } | 244 | } |
245 | 245 | ||
246 | static inline int | 246 | static inline int |
247 | IsDISC(u_char * data) | 247 | IsDISC(u_char *data) |
248 | { | 248 | { |
249 | return ((data[0] & 0xef) == DISC); | 249 | return ((data[0] & 0xef) == DISC); |
250 | } | 250 | } |
251 | 251 | ||
252 | static inline int | 252 | static inline int |
253 | IsSFrame(u_char * data, struct PStack *st) | 253 | IsSFrame(u_char *data, struct PStack *st) |
254 | { | 254 | { |
255 | register u_char d = *data; | 255 | register u_char d = *data; |
256 | 256 | ||
257 | if (!test_bit(FLG_MOD128, &st->l2.flag)) | 257 | if (!test_bit(FLG_MOD128, &st->l2.flag)) |
258 | d &= 0xf; | 258 | d &= 0xf; |
259 | return(((d & 0xf3) == 1) && ((d & 0x0c) != 0x0c)); | 259 | return (((d & 0xf3) == 1) && ((d & 0x0c) != 0x0c)); |
260 | } | 260 | } |
261 | 261 | ||
262 | static inline int | 262 | static inline int |
263 | IsSABME(u_char * data, struct PStack *st) | 263 | IsSABME(u_char *data, struct PStack *st) |
264 | { | 264 | { |
265 | u_char d = data[0] & ~0x10; | 265 | u_char d = data[0] & ~0x10; |
266 | 266 | ||
@@ -268,19 +268,19 @@ IsSABME(u_char * data, struct PStack *st) | |||
268 | } | 268 | } |
269 | 269 | ||
270 | static inline int | 270 | static inline int |
271 | IsREJ(u_char * data, struct PStack *st) | 271 | IsREJ(u_char *data, struct PStack *st) |
272 | { | 272 | { |
273 | return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == REJ : (data[0] & 0xf) == REJ); | 273 | return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == REJ : (data[0] & 0xf) == REJ); |
274 | } | 274 | } |
275 | 275 | ||
276 | static inline int | 276 | static inline int |
277 | IsFRMR(u_char * data) | 277 | IsFRMR(u_char *data) |
278 | { | 278 | { |
279 | return ((data[0] & 0xef) == FRMR); | 279 | return ((data[0] & 0xef) == FRMR); |
280 | } | 280 | } |
281 | 281 | ||
282 | static inline int | 282 | static inline int |
283 | IsRNR(u_char * data, struct PStack *st) | 283 | IsRNR(u_char *data, struct PStack *st) |
284 | { | 284 | { |
285 | return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == RNR : (data[0] & 0xf) == RNR); | 285 | return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == RNR : (data[0] & 0xf) == RNR); |
286 | } | 286 | } |
@@ -368,14 +368,14 @@ FRMR_error(struct PStack *st, struct sk_buff *skb) | |||
368 | return 'N'; | 368 | return 'N'; |
369 | else | 369 | else |
370 | l2m_debug(&st->l2.l2m, "FRMR information %2x %2x %2x %2x %2x", | 370 | l2m_debug(&st->l2.l2m, "FRMR information %2x %2x %2x %2x %2x", |
371 | datap[0], datap[1], datap[2], | 371 | datap[0], datap[1], datap[2], |
372 | datap[3], datap[4]); | 372 | datap[3], datap[4]); |
373 | } else { | 373 | } else { |
374 | if (skb->len < headers + 3) | 374 | if (skb->len < headers + 3) |
375 | return 'N'; | 375 | return 'N'; |
376 | else | 376 | else |
377 | l2m_debug(&st->l2.l2m, "FRMR information %2x %2x %2x", | 377 | l2m_debug(&st->l2.l2m, "FRMR information %2x %2x %2x", |
378 | datap[0], datap[1], datap[2]); | 378 | datap[0], datap[1], datap[2]); |
379 | } | 379 | } |
380 | 380 | ||
381 | return 0; | 381 | return 0; |
@@ -384,9 +384,9 @@ FRMR_error(struct PStack *st, struct sk_buff *skb) | |||
384 | static unsigned int | 384 | static unsigned int |
385 | legalnr(struct PStack *st, unsigned int nr) | 385 | legalnr(struct PStack *st, unsigned int nr) |
386 | { | 386 | { |
387 | struct Layer2 *l2 = &st->l2; | 387 | struct Layer2 *l2 = &st->l2; |
388 | 388 | ||
389 | if(test_bit(FLG_MOD128, &l2->flag)) | 389 | if (test_bit(FLG_MOD128, &l2->flag)) |
390 | return ((nr - l2->va) % 128) <= ((l2->vs - l2->va) % 128); | 390 | return ((nr - l2->va) % 128) <= ((l2->vs - l2->va) % 128); |
391 | else | 391 | else |
392 | return ((nr - l2->va) % 8) <= ((l2->vs - l2->va) % 8); | 392 | return ((nr - l2->va) % 8) <= ((l2->vs - l2->va) % 8); |
@@ -402,7 +402,7 @@ setva(struct PStack *st, unsigned int nr) | |||
402 | spin_lock_irqsave(&l2->lock, flags); | 402 | spin_lock_irqsave(&l2->lock, flags); |
403 | while (l2->va != nr) { | 403 | while (l2->va != nr) { |
404 | (l2->va)++; | 404 | (l2->va)++; |
405 | if(test_bit(FLG_MOD128, &l2->flag)) | 405 | if (test_bit(FLG_MOD128, &l2->flag)) |
406 | l2->va %= 128; | 406 | l2->va %= 128; |
407 | else | 407 | else |
408 | l2->va %= 8; | 408 | l2->va %= 8; |
@@ -413,7 +413,7 @@ setva(struct PStack *st, unsigned int nr) | |||
413 | l2->windowar[l2->sow] = NULL; | 413 | l2->windowar[l2->sow] = NULL; |
414 | l2->sow = (l2->sow + 1) % l2->window; | 414 | l2->sow = (l2->sow + 1) % l2->window; |
415 | spin_unlock_irqrestore(&l2->lock, flags); | 415 | spin_unlock_irqrestore(&l2->lock, flags); |
416 | if (test_bit(FLG_LLI_L2WAKEUP, &st->lli.flag) && (len >=0)) | 416 | if (test_bit(FLG_LLI_L2WAKEUP, &st->lli.flag) && (len >= 0)) |
417 | lli_writewakeup(st, len); | 417 | lli_writewakeup(st, len); |
418 | spin_lock_irqsave(&l2->lock, flags); | 418 | spin_lock_irqsave(&l2->lock, flags); |
419 | } | 419 | } |
@@ -438,7 +438,7 @@ send_uframe(struct PStack *st, u_char cmd, u_char cr) | |||
438 | } | 438 | } |
439 | 439 | ||
440 | static inline u_char | 440 | static inline u_char |
441 | get_PollFlag(struct PStack * st, struct sk_buff * skb) | 441 | get_PollFlag(struct PStack *st, struct sk_buff *skb) |
442 | { | 442 | { |
443 | return (skb->data[l2addrsize(&(st->l2))] & 0x10); | 443 | return (skb->data[l2addrsize(&(st->l2))] & 0x10); |
444 | } | 444 | } |
@@ -470,29 +470,29 @@ restart_t200(struct PStack *st, int i) | |||
470 | static inline void | 470 | static inline void |
471 | stop_t200(struct PStack *st, int i) | 471 | stop_t200(struct PStack *st, int i) |
472 | { | 472 | { |
473 | if(test_and_clear_bit(FLG_T200_RUN, &st->l2.flag)) | 473 | if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag)) |
474 | FsmDelTimer(&st->l2.t200, i); | 474 | FsmDelTimer(&st->l2.t200, i); |
475 | } | 475 | } |
476 | 476 | ||
477 | static inline void | 477 | static inline void |
478 | st5_dl_release_l2l3(struct PStack *st) | 478 | st5_dl_release_l2l3(struct PStack *st) |
479 | { | 479 | { |
480 | int pr; | 480 | int pr; |
481 | 481 | ||
482 | if(test_and_clear_bit(FLG_PEND_REL, &st->l2.flag)) | 482 | if (test_and_clear_bit(FLG_PEND_REL, &st->l2.flag)) |
483 | pr = DL_RELEASE | CONFIRM; | 483 | pr = DL_RELEASE | CONFIRM; |
484 | else | 484 | else |
485 | pr = DL_RELEASE | INDICATION; | 485 | pr = DL_RELEASE | INDICATION; |
486 | 486 | ||
487 | st->l2.l2l3(st, pr, NULL); | 487 | st->l2.l2l3(st, pr, NULL); |
488 | } | 488 | } |
489 | 489 | ||
490 | static inline void | 490 | static inline void |
491 | lapb_dl_release_l2l3(struct PStack *st, int f) | 491 | lapb_dl_release_l2l3(struct PStack *st, int f) |
492 | { | 492 | { |
493 | if (test_bit(FLG_LAPB, &st->l2.flag)) | 493 | if (test_bit(FLG_LAPB, &st->l2.flag)) |
494 | st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL); | 494 | st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL); |
495 | st->l2.l2l3(st, DL_RELEASE | f, NULL); | 495 | st->l2.l2l3(st, DL_RELEASE | f, NULL); |
496 | } | 496 | } |
497 | 497 | ||
498 | static void | 498 | static void |
@@ -557,7 +557,7 @@ l2_st8_mdl_error_dm(struct FsmInst *fi, int event, void *arg) | |||
557 | static void | 557 | static void |
558 | l2_go_st3(struct FsmInst *fi, int event, void *arg) | 558 | l2_go_st3(struct FsmInst *fi, int event, void *arg) |
559 | { | 559 | { |
560 | FsmChangeState(fi, ST_L2_3); | 560 | FsmChangeState(fi, ST_L2_3); |
561 | } | 561 | } |
562 | 562 | ||
563 | static void | 563 | static void |
@@ -565,7 +565,7 @@ l2_mdl_assign(struct FsmInst *fi, int event, void *arg) | |||
565 | { | 565 | { |
566 | struct PStack *st = fi->userdata; | 566 | struct PStack *st = fi->userdata; |
567 | 567 | ||
568 | FsmChangeState(fi, ST_L2_3); | 568 | FsmChangeState(fi, ST_L2_3); |
569 | st->l2.l2tei(st, MDL_ASSIGN | INDICATION, NULL); | 569 | st->l2.l2tei(st, MDL_ASSIGN | INDICATION, NULL); |
570 | } | 570 | } |
571 | 571 | ||
@@ -755,7 +755,7 @@ l2_restart_multi(struct FsmInst *fi, int event, void *arg) | |||
755 | if (est) | 755 | if (est) |
756 | st->l2.l2l3(st, DL_ESTABLISH | INDICATION, NULL); | 756 | st->l2.l2l3(st, DL_ESTABLISH | INDICATION, NULL); |
757 | 757 | ||
758 | if ((ST_L2_7==state) || (ST_L2_8 == state)) | 758 | if ((ST_L2_7 == state) || (ST_L2_8 == state)) |
759 | if (!skb_queue_empty(&st->l2.i_queue) && cansend(st)) | 759 | if (!skb_queue_empty(&st->l2.i_queue) && cansend(st)) |
760 | st->l2.l2l1(st, PH_PULL | REQUEST, NULL); | 760 | st->l2.l2l1(st, PH_PULL | REQUEST, NULL); |
761 | } | 761 | } |
@@ -782,7 +782,7 @@ l2_connected(struct FsmInst *fi, int event, void *arg) | |||
782 | { | 782 | { |
783 | struct PStack *st = fi->userdata; | 783 | struct PStack *st = fi->userdata; |
784 | struct sk_buff *skb = arg; | 784 | struct sk_buff *skb = arg; |
785 | int pr=-1; | 785 | int pr = -1; |
786 | 786 | ||
787 | if (!get_PollFlag(st, skb)) { | 787 | if (!get_PollFlag(st, skb)) { |
788 | l2_mdl_error_ua(fi, event, arg); | 788 | l2_mdl_error_ua(fi, event, arg); |
@@ -853,7 +853,7 @@ l2_st5_dm_release(struct FsmInst *fi, int event, void *arg) | |||
853 | 853 | ||
854 | if (get_PollFlagFree(st, skb)) { | 854 | if (get_PollFlagFree(st, skb)) { |
855 | stop_t200(st, 7); | 855 | stop_t200(st, 7); |
856 | if (!test_bit(FLG_L3_INIT, &st->l2.flag)) | 856 | if (!test_bit(FLG_L3_INIT, &st->l2.flag)) |
857 | skb_queue_purge(&st->l2.i_queue); | 857 | skb_queue_purge(&st->l2.i_queue); |
858 | if (test_bit(FLG_LAPB, &st->l2.flag)) | 858 | if (test_bit(FLG_LAPB, &st->l2.flag)) |
859 | st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL); | 859 | st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL); |
@@ -941,7 +941,7 @@ invoke_retransmission(struct PStack *st, unsigned int nr) | |||
941 | if (l2->vs != nr) { | 941 | if (l2->vs != nr) { |
942 | while (l2->vs != nr) { | 942 | while (l2->vs != nr) { |
943 | (l2->vs)--; | 943 | (l2->vs)--; |
944 | if(test_bit(FLG_MOD128, &l2->flag)) { | 944 | if (test_bit(FLG_MOD128, &l2->flag)) { |
945 | l2->vs %= 128; | 945 | l2->vs %= 128; |
946 | p1 = (l2->vs - l2->va) % 128; | 946 | p1 = (l2->vs - l2->va) % 128; |
947 | } else { | 947 | } else { |
@@ -1013,7 +1013,7 @@ l2_st7_got_super(struct FsmInst *fi, int event, void *arg) | |||
1013 | EV_L2_T203, NULL, 7); | 1013 | EV_L2_T203, NULL, 7); |
1014 | } else if ((l2->va != nr) || (typ == RNR)) { | 1014 | } else if ((l2->va != nr) || (typ == RNR)) { |
1015 | setva(st, nr); | 1015 | setva(st, nr); |
1016 | if(typ != RR) FsmDelTimer(&st->l2.t203, 9); | 1016 | if (typ != RR) FsmDelTimer(&st->l2.t203, 9); |
1017 | restart_t200(st, 12); | 1017 | restart_t200(st, 12); |
1018 | } | 1018 | } |
1019 | if (!skb_queue_empty(&st->l2.i_queue) && (typ == RR)) | 1019 | if (!skb_queue_empty(&st->l2.i_queue) && (typ == RR)) |
@@ -1080,10 +1080,10 @@ l2_got_iframe(struct FsmInst *fi, int event, void *arg) | |||
1080 | } | 1080 | } |
1081 | if (test_bit(FLG_OWN_BUSY, &l2->flag)) { | 1081 | if (test_bit(FLG_OWN_BUSY, &l2->flag)) { |
1082 | dev_kfree_skb(skb); | 1082 | dev_kfree_skb(skb); |
1083 | if(PollFlag) enquiry_response(st); | 1083 | if (PollFlag) enquiry_response(st); |
1084 | } else if (l2->vr == ns) { | 1084 | } else if (l2->vr == ns) { |
1085 | (l2->vr)++; | 1085 | (l2->vr)++; |
1086 | if(test_bit(FLG_MOD128, &l2->flag)) | 1086 | if (test_bit(FLG_MOD128, &l2->flag)) |
1087 | l2->vr %= 128; | 1087 | l2->vr %= 128; |
1088 | else | 1088 | else |
1089 | l2->vr %= 8; | 1089 | l2->vr %= 8; |
@@ -1150,7 +1150,7 @@ l2_st5_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1150 | struct PStack *st = fi->userdata; | 1150 | struct PStack *st = fi->userdata; |
1151 | 1151 | ||
1152 | if (test_bit(FLG_LAPD, &st->l2.flag) && | 1152 | if (test_bit(FLG_LAPD, &st->l2.flag) && |
1153 | test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) { | 1153 | test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) { |
1154 | FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9); | 1154 | FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9); |
1155 | } else if (st->l2.rc == st->l2.N200) { | 1155 | } else if (st->l2.rc == st->l2.N200) { |
1156 | FsmChangeState(fi, ST_L2_4); | 1156 | FsmChangeState(fi, ST_L2_4); |
@@ -1174,7 +1174,7 @@ l2_st6_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1174 | struct PStack *st = fi->userdata; | 1174 | struct PStack *st = fi->userdata; |
1175 | 1175 | ||
1176 | if (test_bit(FLG_LAPD, &st->l2.flag) && | 1176 | if (test_bit(FLG_LAPD, &st->l2.flag) && |
1177 | test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) { | 1177 | test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) { |
1178 | FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9); | 1178 | FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9); |
1179 | } else if (st->l2.rc == st->l2.N200) { | 1179 | } else if (st->l2.rc == st->l2.N200) { |
1180 | FsmChangeState(fi, ST_L2_4); | 1180 | FsmChangeState(fi, ST_L2_4); |
@@ -1195,7 +1195,7 @@ l2_st7_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1195 | struct PStack *st = fi->userdata; | 1195 | struct PStack *st = fi->userdata; |
1196 | 1196 | ||
1197 | if (test_bit(FLG_LAPD, &st->l2.flag) && | 1197 | if (test_bit(FLG_LAPD, &st->l2.flag) && |
1198 | test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) { | 1198 | test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) { |
1199 | FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9); | 1199 | FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9); |
1200 | return; | 1200 | return; |
1201 | } | 1201 | } |
@@ -1213,7 +1213,7 @@ l2_st8_tout_200(struct FsmInst *fi, int event, void *arg) | |||
1213 | struct PStack *st = fi->userdata; | 1213 | struct PStack *st = fi->userdata; |
1214 | 1214 | ||
1215 | if (test_bit(FLG_LAPD, &st->l2.flag) && | 1215 | if (test_bit(FLG_LAPD, &st->l2.flag) && |
1216 | test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) { | 1216 | test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) { |
1217 | FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9); | 1217 | FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9); |
1218 | return; | 1218 | return; |
1219 | } | 1219 | } |
@@ -1234,7 +1234,7 @@ l2_st7_tout_203(struct FsmInst *fi, int event, void *arg) | |||
1234 | struct PStack *st = fi->userdata; | 1234 | struct PStack *st = fi->userdata; |
1235 | 1235 | ||
1236 | if (test_bit(FLG_LAPD, &st->l2.flag) && | 1236 | if (test_bit(FLG_LAPD, &st->l2.flag) && |
1237 | test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) { | 1237 | test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) { |
1238 | FsmAddTimer(&st->l2.t203, st->l2.T203, EV_L2_T203, NULL, 9); | 1238 | FsmAddTimer(&st->l2.t203, st->l2.T203, EV_L2_T203, NULL, 9); |
1239 | return; | 1239 | return; |
1240 | } | 1240 | } |
@@ -1272,7 +1272,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1272 | } | 1272 | } |
1273 | } | 1273 | } |
1274 | spin_lock_irqsave(&l2->lock, flags); | 1274 | spin_lock_irqsave(&l2->lock, flags); |
1275 | if(test_bit(FLG_MOD128, &l2->flag)) | 1275 | if (test_bit(FLG_MOD128, &l2->flag)) |
1276 | p1 = (l2->vs - l2->va) % 128; | 1276 | p1 = (l2->vs - l2->va) % 128; |
1277 | else | 1277 | else |
1278 | p1 = (l2->vs - l2->va) % 8; | 1278 | p1 = (l2->vs - l2->va) % 8; |
@@ -1445,7 +1445,7 @@ static void | |||
1445 | l2_st14_persistent_da(struct FsmInst *fi, int event, void *arg) | 1445 | l2_st14_persistent_da(struct FsmInst *fi, int event, void *arg) |
1446 | { | 1446 | { |
1447 | struct PStack *st = fi->userdata; | 1447 | struct PStack *st = fi->userdata; |
1448 | 1448 | ||
1449 | skb_queue_purge(&st->l2.i_queue); | 1449 | skb_queue_purge(&st->l2.i_queue); |
1450 | skb_queue_purge(&st->l2.ui_queue); | 1450 | skb_queue_purge(&st->l2.ui_queue); |
1451 | if (test_and_clear_bit(FLG_ESTAB_PEND, &st->l2.flag)) | 1451 | if (test_and_clear_bit(FLG_ESTAB_PEND, &st->l2.flag)) |
@@ -1495,7 +1495,7 @@ l2_set_own_busy(struct FsmInst *fi, int event, void *arg) | |||
1495 | { | 1495 | { |
1496 | struct PStack *st = fi->userdata; | 1496 | struct PStack *st = fi->userdata; |
1497 | 1497 | ||
1498 | if(!test_and_set_bit(FLG_OWN_BUSY, &st->l2.flag)) { | 1498 | if (!test_and_set_bit(FLG_OWN_BUSY, &st->l2.flag)) { |
1499 | enquiry_cr(st, RNR, RSP, 0); | 1499 | enquiry_cr(st, RNR, RSP, 0); |
1500 | test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); | 1500 | test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); |
1501 | } | 1501 | } |
@@ -1506,7 +1506,7 @@ l2_clear_own_busy(struct FsmInst *fi, int event, void *arg) | |||
1506 | { | 1506 | { |
1507 | struct PStack *st = fi->userdata; | 1507 | struct PStack *st = fi->userdata; |
1508 | 1508 | ||
1509 | if(!test_and_clear_bit(FLG_OWN_BUSY, &st->l2.flag)) { | 1509 | if (!test_and_clear_bit(FLG_OWN_BUSY, &st->l2.flag)) { |
1510 | enquiry_cr(st, RR, RSP, 0); | 1510 | enquiry_cr(st, RR, RSP, 0); |
1511 | test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); | 1511 | test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); |
1512 | } | 1512 | } |
@@ -1631,76 +1631,76 @@ isdnl2_l1l2(struct PStack *st, int pr, void *arg) | |||
1631 | int c = 0; | 1631 | int c = 0; |
1632 | 1632 | ||
1633 | switch (pr) { | 1633 | switch (pr) { |
1634 | case (PH_DATA | INDICATION): | 1634 | case (PH_DATA | INDICATION): |
1635 | datap = skb->data; | 1635 | datap = skb->data; |
1636 | len = l2addrsize(&st->l2); | 1636 | len = l2addrsize(&st->l2); |
1637 | if (skb->len > len) | 1637 | if (skb->len > len) |
1638 | datap += len; | 1638 | datap += len; |
1639 | else { | 1639 | else { |
1640 | FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'N'); | 1640 | FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'N'); |
1641 | dev_kfree_skb(skb); | 1641 | dev_kfree_skb(skb); |
1642 | return; | 1642 | return; |
1643 | } | 1643 | } |
1644 | if (!(*datap & 1)) { /* I-Frame */ | 1644 | if (!(*datap & 1)) { /* I-Frame */ |
1645 | if(!(c = iframe_error(st, skb))) | 1645 | if (!(c = iframe_error(st, skb))) |
1646 | ret = FsmEvent(&st->l2.l2m, EV_L2_I, skb); | 1646 | ret = FsmEvent(&st->l2.l2m, EV_L2_I, skb); |
1647 | } else if (IsSFrame(datap, st)) { /* S-Frame */ | 1647 | } else if (IsSFrame(datap, st)) { /* S-Frame */ |
1648 | if(!(c = super_error(st, skb))) | 1648 | if (!(c = super_error(st, skb))) |
1649 | ret = FsmEvent(&st->l2.l2m, EV_L2_SUPER, skb); | 1649 | ret = FsmEvent(&st->l2.l2m, EV_L2_SUPER, skb); |
1650 | } else if (IsUI(datap)) { | 1650 | } else if (IsUI(datap)) { |
1651 | if(!(c = UI_error(st, skb))) | 1651 | if (!(c = UI_error(st, skb))) |
1652 | ret = FsmEvent(&st->l2.l2m, EV_L2_UI, skb); | 1652 | ret = FsmEvent(&st->l2.l2m, EV_L2_UI, skb); |
1653 | } else if (IsSABME(datap, st)) { | 1653 | } else if (IsSABME(datap, st)) { |
1654 | if(!(c = unnum_error(st, skb, CMD))) | 1654 | if (!(c = unnum_error(st, skb, CMD))) |
1655 | ret = FsmEvent(&st->l2.l2m, EV_L2_SABME, skb); | 1655 | ret = FsmEvent(&st->l2.l2m, EV_L2_SABME, skb); |
1656 | } else if (IsUA(datap)) { | 1656 | } else if (IsUA(datap)) { |
1657 | if(!(c = unnum_error(st, skb, RSP))) | 1657 | if (!(c = unnum_error(st, skb, RSP))) |
1658 | ret = FsmEvent(&st->l2.l2m, EV_L2_UA, skb); | 1658 | ret = FsmEvent(&st->l2.l2m, EV_L2_UA, skb); |
1659 | } else if (IsDISC(datap)) { | 1659 | } else if (IsDISC(datap)) { |
1660 | if(!(c = unnum_error(st, skb, CMD))) | 1660 | if (!(c = unnum_error(st, skb, CMD))) |
1661 | ret = FsmEvent(&st->l2.l2m, EV_L2_DISC, skb); | 1661 | ret = FsmEvent(&st->l2.l2m, EV_L2_DISC, skb); |
1662 | } else if (IsDM(datap)) { | 1662 | } else if (IsDM(datap)) { |
1663 | if(!(c = unnum_error(st, skb, RSP))) | 1663 | if (!(c = unnum_error(st, skb, RSP))) |
1664 | ret = FsmEvent(&st->l2.l2m, EV_L2_DM, skb); | 1664 | ret = FsmEvent(&st->l2.l2m, EV_L2_DM, skb); |
1665 | } else if (IsFRMR(datap)) { | 1665 | } else if (IsFRMR(datap)) { |
1666 | if(!(c = FRMR_error(st,skb))) | 1666 | if (!(c = FRMR_error(st, skb))) |
1667 | ret = FsmEvent(&st->l2.l2m, EV_L2_FRMR, skb); | 1667 | ret = FsmEvent(&st->l2.l2m, EV_L2_FRMR, skb); |
1668 | } else { | 1668 | } else { |
1669 | FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'L'); | 1669 | FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'L'); |
1670 | dev_kfree_skb(skb); | 1670 | dev_kfree_skb(skb); |
1671 | ret = 0; | 1671 | ret = 0; |
1672 | } | 1672 | } |
1673 | if(c) { | 1673 | if (c) { |
1674 | dev_kfree_skb(skb); | 1674 | dev_kfree_skb(skb); |
1675 | FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *)(long)c); | 1675 | FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *)(long)c); |
1676 | ret = 0; | 1676 | ret = 0; |
1677 | } | 1677 | } |
1678 | if (ret) | 1678 | if (ret) |
1679 | dev_kfree_skb(skb); | 1679 | dev_kfree_skb(skb); |
1680 | break; | 1680 | break; |
1681 | case (PH_PULL | CONFIRM): | 1681 | case (PH_PULL | CONFIRM): |
1682 | FsmEvent(&st->l2.l2m, EV_L2_ACK_PULL, arg); | 1682 | FsmEvent(&st->l2.l2m, EV_L2_ACK_PULL, arg); |
1683 | break; | 1683 | break; |
1684 | case (PH_PAUSE | INDICATION): | 1684 | case (PH_PAUSE | INDICATION): |
1685 | test_and_set_bit(FLG_DCHAN_BUSY, &st->l2.flag); | 1685 | test_and_set_bit(FLG_DCHAN_BUSY, &st->l2.flag); |
1686 | break; | 1686 | break; |
1687 | case (PH_PAUSE | CONFIRM): | 1687 | case (PH_PAUSE | CONFIRM): |
1688 | test_and_clear_bit(FLG_DCHAN_BUSY, &st->l2.flag); | 1688 | test_and_clear_bit(FLG_DCHAN_BUSY, &st->l2.flag); |
1689 | break; | 1689 | break; |
1690 | case (PH_ACTIVATE | CONFIRM): | 1690 | case (PH_ACTIVATE | CONFIRM): |
1691 | case (PH_ACTIVATE | INDICATION): | 1691 | case (PH_ACTIVATE | INDICATION): |
1692 | test_and_set_bit(FLG_L1_ACTIV, &st->l2.flag); | 1692 | test_and_set_bit(FLG_L1_ACTIV, &st->l2.flag); |
1693 | if (test_and_clear_bit(FLG_ESTAB_PEND, &st->l2.flag)) | 1693 | if (test_and_clear_bit(FLG_ESTAB_PEND, &st->l2.flag)) |
1694 | FsmEvent(&st->l2.l2m, EV_L2_DL_ESTABLISH_REQ, arg); | 1694 | FsmEvent(&st->l2.l2m, EV_L2_DL_ESTABLISH_REQ, arg); |
1695 | break; | 1695 | break; |
1696 | case (PH_DEACTIVATE | INDICATION): | 1696 | case (PH_DEACTIVATE | INDICATION): |
1697 | case (PH_DEACTIVATE | CONFIRM): | 1697 | case (PH_DEACTIVATE | CONFIRM): |
1698 | test_and_clear_bit(FLG_L1_ACTIV, &st->l2.flag); | 1698 | test_and_clear_bit(FLG_L1_ACTIV, &st->l2.flag); |
1699 | FsmEvent(&st->l2.l2m, EV_L1_DEACTIVATE, arg); | 1699 | FsmEvent(&st->l2.l2m, EV_L1_DEACTIVATE, arg); |
1700 | break; | 1700 | break; |
1701 | default: | 1701 | default: |
1702 | l2m_debug(&st->l2.l2m, "l2 unknown pr %04x", pr); | 1702 | l2m_debug(&st->l2.l2m, "l2 unknown pr %04x", pr); |
1703 | break; | 1703 | break; |
1704 | } | 1704 | } |
1705 | } | 1705 | } |
1706 | 1706 | ||
@@ -1708,45 +1708,45 @@ static void | |||
1708 | isdnl2_l3l2(struct PStack *st, int pr, void *arg) | 1708 | isdnl2_l3l2(struct PStack *st, int pr, void *arg) |
1709 | { | 1709 | { |
1710 | switch (pr) { | 1710 | switch (pr) { |
1711 | case (DL_DATA | REQUEST): | 1711 | case (DL_DATA | REQUEST): |
1712 | if (FsmEvent(&st->l2.l2m, EV_L2_DL_DATA, arg)) { | 1712 | if (FsmEvent(&st->l2.l2m, EV_L2_DL_DATA, arg)) { |
1713 | dev_kfree_skb((struct sk_buff *) arg); | 1713 | dev_kfree_skb((struct sk_buff *) arg); |
1714 | } | 1714 | } |
1715 | break; | 1715 | break; |
1716 | case (DL_UNIT_DATA | REQUEST): | 1716 | case (DL_UNIT_DATA | REQUEST): |
1717 | if (FsmEvent(&st->l2.l2m, EV_L2_DL_UNIT_DATA, arg)) { | 1717 | if (FsmEvent(&st->l2.l2m, EV_L2_DL_UNIT_DATA, arg)) { |
1718 | dev_kfree_skb((struct sk_buff *) arg); | 1718 | dev_kfree_skb((struct sk_buff *) arg); |
1719 | } | 1719 | } |
1720 | break; | 1720 | break; |
1721 | case (DL_ESTABLISH | REQUEST): | 1721 | case (DL_ESTABLISH | REQUEST): |
1722 | if (test_bit(FLG_L1_ACTIV, &st->l2.flag)) { | 1722 | if (test_bit(FLG_L1_ACTIV, &st->l2.flag)) { |
1723 | if (test_bit(FLG_LAPD, &st->l2.flag) || | 1723 | if (test_bit(FLG_LAPD, &st->l2.flag) || |
1724 | test_bit(FLG_ORIG, &st->l2.flag)) { | 1724 | test_bit(FLG_ORIG, &st->l2.flag)) { |
1725 | FsmEvent(&st->l2.l2m, EV_L2_DL_ESTABLISH_REQ, arg); | 1725 | FsmEvent(&st->l2.l2m, EV_L2_DL_ESTABLISH_REQ, arg); |
1726 | } | ||
1727 | } else { | ||
1728 | if (test_bit(FLG_LAPD, &st->l2.flag) || | ||
1729 | test_bit(FLG_ORIG, &st->l2.flag)) { | ||
1730 | test_and_set_bit(FLG_ESTAB_PEND, &st->l2.flag); | ||
1731 | } | ||
1732 | st->l2.l2l1(st, PH_ACTIVATE, NULL); | ||
1733 | } | 1726 | } |
1734 | break; | 1727 | } else { |
1735 | case (DL_RELEASE | REQUEST): | 1728 | if (test_bit(FLG_LAPD, &st->l2.flag) || |
1736 | if (test_bit(FLG_LAPB, &st->l2.flag)) { | 1729 | test_bit(FLG_ORIG, &st->l2.flag)) { |
1737 | st->l2.l2l1(st, PH_DEACTIVATE, NULL); | 1730 | test_and_set_bit(FLG_ESTAB_PEND, &st->l2.flag); |
1738 | } | 1731 | } |
1739 | FsmEvent(&st->l2.l2m, EV_L2_DL_RELEASE_REQ, arg); | 1732 | st->l2.l2l1(st, PH_ACTIVATE, NULL); |
1740 | break; | 1733 | } |
1741 | case (MDL_ASSIGN | REQUEST): | 1734 | break; |
1742 | FsmEvent(&st->l2.l2m, EV_L2_MDL_ASSIGN, arg); | 1735 | case (DL_RELEASE | REQUEST): |
1743 | break; | 1736 | if (test_bit(FLG_LAPB, &st->l2.flag)) { |
1744 | case (MDL_REMOVE | REQUEST): | 1737 | st->l2.l2l1(st, PH_DEACTIVATE, NULL); |
1745 | FsmEvent(&st->l2.l2m, EV_L2_MDL_REMOVE, arg); | 1738 | } |
1746 | break; | 1739 | FsmEvent(&st->l2.l2m, EV_L2_DL_RELEASE_REQ, arg); |
1747 | case (MDL_ERROR | RESPONSE): | 1740 | break; |
1748 | FsmEvent(&st->l2.l2m, EV_L2_MDL_ERROR, arg); | 1741 | case (MDL_ASSIGN | REQUEST): |
1749 | break; | 1742 | FsmEvent(&st->l2.l2m, EV_L2_MDL_ASSIGN, arg); |
1743 | break; | ||
1744 | case (MDL_REMOVE | REQUEST): | ||
1745 | FsmEvent(&st->l2.l2m, EV_L2_MDL_REMOVE, arg); | ||
1746 | break; | ||
1747 | case (MDL_ERROR | RESPONSE): | ||
1748 | FsmEvent(&st->l2.l2m, EV_L2_MDL_ERROR, arg); | ||
1749 | break; | ||
1750 | } | 1750 | } |
1751 | } | 1751 | } |
1752 | 1752 | ||
@@ -1787,7 +1787,7 @@ setstack_isdnl2(struct PStack *st, char *debug_id) | |||
1787 | if (test_bit(FLG_LAPB, &st->l2.flag)) | 1787 | if (test_bit(FLG_LAPB, &st->l2.flag)) |
1788 | st->l2.l2m.state = ST_L2_4; | 1788 | st->l2.l2m.state = ST_L2_4; |
1789 | else | 1789 | else |
1790 | st->l2.l2m.state = ST_L2_1; | 1790 | st->l2.l2m.state = ST_L2_1; |
1791 | st->l2.l2m.debug = 0; | 1791 | st->l2.l2m.debug = 0; |
1792 | st->l2.l2m.userdata = st; | 1792 | st->l2.l2m.userdata = st; |
1793 | st->l2.l2m.userint = 0; | 1793 | st->l2.l2m.userint = 0; |
@@ -1802,16 +1802,16 @@ static void | |||
1802 | transl2_l3l2(struct PStack *st, int pr, void *arg) | 1802 | transl2_l3l2(struct PStack *st, int pr, void *arg) |
1803 | { | 1803 | { |
1804 | switch (pr) { | 1804 | switch (pr) { |
1805 | case (DL_DATA | REQUEST): | 1805 | case (DL_DATA | REQUEST): |
1806 | case (DL_UNIT_DATA | REQUEST): | 1806 | case (DL_UNIT_DATA | REQUEST): |
1807 | st->l2.l2l1(st, PH_DATA | REQUEST, arg); | 1807 | st->l2.l2l1(st, PH_DATA | REQUEST, arg); |
1808 | break; | 1808 | break; |
1809 | case (DL_ESTABLISH | REQUEST): | 1809 | case (DL_ESTABLISH | REQUEST): |
1810 | st->l2.l2l1(st, PH_ACTIVATE | REQUEST, NULL); | 1810 | st->l2.l2l1(st, PH_ACTIVATE | REQUEST, NULL); |
1811 | break; | 1811 | break; |
1812 | case (DL_RELEASE | REQUEST): | 1812 | case (DL_RELEASE | REQUEST): |
1813 | st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL); | 1813 | st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL); |
1814 | break; | 1814 | break; |
1815 | } | 1815 | } |
1816 | } | 1816 | } |
1817 | 1817 | ||