aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/isdnl2.c
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2005-06-25 17:59:18 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:25:07 -0400
commit672c3fd9069e5a138f9d4afc9aeb5aa34aacce32 (patch)
treeeed95f7e577680c4a92e7f22b22b221b53934fd1 /drivers/isdn/hisax/isdnl2.c
parent8b3d4a2a3ef9488d4477e8823106abfd6039eb66 (diff)
[PATCH] drivers/isdn/hisax/: possible cleanups
This patch contains the following possible cleanups: - make needlessly global code static - remove the compiled but unused st5481_hdlc.{c,h} - kill enternow.h - enternow_pci.c: kill InByte/OutByte/BYTE - isdnl2.c: kill FreeSkb - remove or #if 0 the following unused functions: - config.c: IsdnCardState - ipacx.c: ipacx_new_ph - ipacx.c: dch_bh - ipacx.c: setup_ipacx - isdnl2.c: IsRR Signed-off-by: Adrian Bunk <bunk@stusta.de> Acked-by: Kai Germaschewski <kai@germaschewski.name> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/hisax/isdnl2.c')
-rw-r--r--drivers/isdn/hisax/isdnl2.c100
1 files changed, 42 insertions, 58 deletions
diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c
index d311b5fbf895..9022583fd6a0 100644
--- a/drivers/isdn/hisax/isdnl2.c
+++ b/drivers/isdn/hisax/isdnl2.c
@@ -142,7 +142,7 @@ freewin1(struct Layer2 *l2)
142 return cnt; 142 return cnt;
143} 143}
144 144
145inline void 145static inline void
146freewin(struct PStack *st) 146freewin(struct PStack *st)
147{ 147{
148 freewin1(&st->l2); 148 freewin1(&st->l2);
@@ -157,7 +157,7 @@ ReleaseWin(struct Layer2 *l2)
157 printk(KERN_WARNING "isdl2 freed %d skbuffs in release\n", cnt); 157 printk(KERN_WARNING "isdl2 freed %d skbuffs in release\n", cnt);
158} 158}
159 159
160inline unsigned int 160static inline unsigned int
161cansend(struct PStack *st) 161cansend(struct PStack *st)
162{ 162{
163 unsigned int p1; 163 unsigned int p1;
@@ -169,7 +169,7 @@ cansend(struct PStack *st)
169 return ((p1 < st->l2.window) && !test_bit(FLG_PEER_BUSY, &st->l2.flag)); 169 return ((p1 < st->l2.window) && !test_bit(FLG_PEER_BUSY, &st->l2.flag));
170} 170}
171 171
172inline void 172static inline void
173clear_exception(struct Layer2 *l2) 173clear_exception(struct Layer2 *l2)
174{ 174{
175 test_and_clear_bit(FLG_ACK_PEND, &l2->flag); 175 test_and_clear_bit(FLG_ACK_PEND, &l2->flag);
@@ -178,7 +178,7 @@ clear_exception(struct Layer2 *l2)
178 clear_peer_busy(l2); 178 clear_peer_busy(l2);
179} 179}
180 180
181inline int 181static inline int
182l2headersize(struct Layer2 *l2, int ui) 182l2headersize(struct Layer2 *l2, int ui)
183{ 183{
184 return (((test_bit(FLG_MOD128, &l2->flag) && (!ui)) ? 2 : 1) + 184 return (((test_bit(FLG_MOD128, &l2->flag) && (!ui)) ? 2 : 1) +
@@ -223,40 +223,31 @@ enqueue_super(struct PStack *st,
223 223
224#define enqueue_ui(a, b) enqueue_super(a, b) 224#define enqueue_ui(a, b) enqueue_super(a, b)
225 225
226inline int 226static inline int
227IsUI(u_char * data) 227IsUI(u_char * data)
228{ 228{
229 return ((data[0] & 0xef) == UI); 229 return ((data[0] & 0xef) == UI);
230} 230}
231 231
232inline int 232static inline int
233IsUA(u_char * data) 233IsUA(u_char * data)
234{ 234{
235 return ((data[0] & 0xef) == UA); 235 return ((data[0] & 0xef) == UA);
236} 236}
237 237
238inline int 238static inline int
239IsDM(u_char * data) 239IsDM(u_char * data)
240{ 240{
241 return ((data[0] & 0xef) == DM); 241 return ((data[0] & 0xef) == DM);
242} 242}
243 243
244inline int 244static inline int
245IsDISC(u_char * data) 245IsDISC(u_char * data)
246{ 246{
247 return ((data[0] & 0xef) == DISC); 247 return ((data[0] & 0xef) == DISC);
248} 248}
249 249
250inline int 250static inline int
251IsRR(u_char * data, struct PStack *st)
252{
253 if (test_bit(FLG_MOD128, &st->l2.flag))
254 return (data[0] == RR);
255 else
256 return ((data[0] & 0xf) == 1);
257}
258
259inline int
260IsSFrame(u_char * data, struct PStack *st) 251IsSFrame(u_char * data, struct PStack *st)
261{ 252{
262 register u_char d = *data; 253 register u_char d = *data;
@@ -266,7 +257,7 @@ IsSFrame(u_char * data, struct PStack *st)
266 return(((d & 0xf3) == 1) && ((d & 0x0c) != 0x0c)); 257 return(((d & 0xf3) == 1) && ((d & 0x0c) != 0x0c));
267} 258}
268 259
269inline int 260static inline int
270IsSABME(u_char * data, struct PStack *st) 261IsSABME(u_char * data, struct PStack *st)
271{ 262{
272 u_char d = data[0] & ~0x10; 263 u_char d = data[0] & ~0x10;
@@ -274,25 +265,25 @@ IsSABME(u_char * data, struct PStack *st)
274 return (test_bit(FLG_MOD128, &st->l2.flag) ? d == SABME : d == SABM); 265 return (test_bit(FLG_MOD128, &st->l2.flag) ? d == SABME : d == SABM);
275} 266}
276 267
277inline int 268static inline int
278IsREJ(u_char * data, struct PStack *st) 269IsREJ(u_char * data, struct PStack *st)
279{ 270{
280 return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == REJ : (data[0] & 0xf) == REJ); 271 return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == REJ : (data[0] & 0xf) == REJ);
281} 272}
282 273
283inline int 274static inline int
284IsFRMR(u_char * data) 275IsFRMR(u_char * data)
285{ 276{
286 return ((data[0] & 0xef) == FRMR); 277 return ((data[0] & 0xef) == FRMR);
287} 278}
288 279
289inline int 280static inline int
290IsRNR(u_char * data, struct PStack *st) 281IsRNR(u_char * data, struct PStack *st)
291{ 282{
292 return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == RNR : (data[0] & 0xf) == RNR); 283 return (test_bit(FLG_MOD128, &st->l2.flag) ? data[0] == RNR : (data[0] & 0xf) == RNR);
293} 284}
294 285
295int 286static int
296iframe_error(struct PStack *st, struct sk_buff *skb) 287iframe_error(struct PStack *st, struct sk_buff *skb)
297{ 288{
298 int i = l2addrsize(&st->l2) + (test_bit(FLG_MOD128, &st->l2.flag) ? 2 : 1); 289 int i = l2addrsize(&st->l2) + (test_bit(FLG_MOD128, &st->l2.flag) ? 2 : 1);
@@ -315,7 +306,7 @@ iframe_error(struct PStack *st, struct sk_buff *skb)
315 return 0; 306 return 0;
316} 307}
317 308
318int 309static int
319super_error(struct PStack *st, struct sk_buff *skb) 310super_error(struct PStack *st, struct sk_buff *skb)
320{ 311{
321 if (skb->len != l2addrsize(&st->l2) + 312 if (skb->len != l2addrsize(&st->l2) +
@@ -325,7 +316,7 @@ super_error(struct PStack *st, struct sk_buff *skb)
325 return 0; 316 return 0;
326} 317}
327 318
328int 319static int
329unnum_error(struct PStack *st, struct sk_buff *skb, int wantrsp) 320unnum_error(struct PStack *st, struct sk_buff *skb, int wantrsp)
330{ 321{
331 int rsp = (*skb->data & 0x2) >> 1; 322 int rsp = (*skb->data & 0x2) >> 1;
@@ -341,7 +332,7 @@ unnum_error(struct PStack *st, struct sk_buff *skb, int wantrsp)
341 return 0; 332 return 0;
342} 333}
343 334
344int 335static int
345UI_error(struct PStack *st, struct sk_buff *skb) 336UI_error(struct PStack *st, struct sk_buff *skb)
346{ 337{
347 int rsp = *skb->data & 0x2; 338 int rsp = *skb->data & 0x2;
@@ -357,7 +348,7 @@ UI_error(struct PStack *st, struct sk_buff *skb)
357 return 0; 348 return 0;
358} 349}
359 350
360int 351static int
361FRMR_error(struct PStack *st, struct sk_buff *skb) 352FRMR_error(struct PStack *st, struct sk_buff *skb)
362{ 353{
363 int headers = l2addrsize(&st->l2) + 1; 354 int headers = l2addrsize(&st->l2) + 1;
@@ -444,51 +435,44 @@ send_uframe(struct PStack *st, u_char cmd, u_char cr)
444 enqueue_super(st, skb); 435 enqueue_super(st, skb);
445} 436}
446 437
447inline u_char 438static inline u_char
448get_PollFlag(struct PStack * st, struct sk_buff * skb) 439get_PollFlag(struct PStack * st, struct sk_buff * skb)
449{ 440{
450 return (skb->data[l2addrsize(&(st->l2))] & 0x10); 441 return (skb->data[l2addrsize(&(st->l2))] & 0x10);
451} 442}
452 443
453inline void 444static inline u_char
454FreeSkb(struct sk_buff *skb)
455{
456 dev_kfree_skb(skb);
457}
458
459
460inline u_char
461get_PollFlagFree(struct PStack *st, struct sk_buff *skb) 445get_PollFlagFree(struct PStack *st, struct sk_buff *skb)
462{ 446{
463 u_char PF; 447 u_char PF;
464 448
465 PF = get_PollFlag(st, skb); 449 PF = get_PollFlag(st, skb);
466 FreeSkb(skb); 450 dev_kfree_skb(skb);
467 return (PF); 451 return (PF);
468} 452}
469 453
470inline void 454static inline void
471start_t200(struct PStack *st, int i) 455start_t200(struct PStack *st, int i)
472{ 456{
473 FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, i); 457 FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, i);
474 test_and_set_bit(FLG_T200_RUN, &st->l2.flag); 458 test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
475} 459}
476 460
477inline void 461static inline void
478restart_t200(struct PStack *st, int i) 462restart_t200(struct PStack *st, int i)
479{ 463{
480 FsmRestartTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, i); 464 FsmRestartTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, i);
481 test_and_set_bit(FLG_T200_RUN, &st->l2.flag); 465 test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
482} 466}
483 467
484inline void 468static inline void
485stop_t200(struct PStack *st, int i) 469stop_t200(struct PStack *st, int i)
486{ 470{
487 if(test_and_clear_bit(FLG_T200_RUN, &st->l2.flag)) 471 if(test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
488 FsmDelTimer(&st->l2.t200, i); 472 FsmDelTimer(&st->l2.t200, i);
489} 473}
490 474
491inline void 475static inline void
492st5_dl_release_l2l3(struct PStack *st) 476st5_dl_release_l2l3(struct PStack *st)
493{ 477{
494 int pr; 478 int pr;
@@ -501,7 +485,7 @@ st5_dl_release_l2l3(struct PStack *st)
501 st->l2.l2l3(st, pr, NULL); 485 st->l2.l2l3(st, pr, NULL);
502} 486}
503 487
504inline void 488static inline void
505lapb_dl_release_l2l3(struct PStack *st, int f) 489lapb_dl_release_l2l3(struct PStack *st, int f)
506{ 490{
507 if (test_bit(FLG_LAPB, &st->l2.flag)) 491 if (test_bit(FLG_LAPB, &st->l2.flag))
@@ -802,7 +786,7 @@ l2_connected(struct FsmInst *fi, int event, void *arg)
802 l2_mdl_error_ua(fi, event, arg); 786 l2_mdl_error_ua(fi, event, arg);
803 return; 787 return;
804 } 788 }
805 FreeSkb(skb); 789 dev_kfree_skb(skb);
806 790
807 if (test_and_clear_bit(FLG_PEND_REL, &st->l2.flag)) 791 if (test_and_clear_bit(FLG_PEND_REL, &st->l2.flag))
808 l2_disconnect(fi, event, arg); 792 l2_disconnect(fi, event, arg);
@@ -840,7 +824,7 @@ l2_released(struct FsmInst *fi, int event, void *arg)
840 l2_mdl_error_ua(fi, event, arg); 824 l2_mdl_error_ua(fi, event, arg);
841 return; 825 return;
842 } 826 }
843 FreeSkb(skb); 827 dev_kfree_skb(skb);
844 828
845 stop_t200(st, 6); 829 stop_t200(st, 6);
846 lapb_dl_release_l2l3(st, CONFIRM); 830 lapb_dl_release_l2l3(st, CONFIRM);
@@ -889,7 +873,7 @@ l2_st6_dm_release(struct FsmInst *fi, int event, void *arg)
889 } 873 }
890} 874}
891 875
892inline void 876static inline void
893enquiry_cr(struct PStack *st, u_char typ, u_char cr, u_char pf) 877enquiry_cr(struct PStack *st, u_char typ, u_char cr, u_char pf)
894{ 878{
895 struct sk_buff *skb; 879 struct sk_buff *skb;
@@ -912,7 +896,7 @@ enquiry_cr(struct PStack *st, u_char typ, u_char cr, u_char pf)
912 enqueue_super(st, skb); 896 enqueue_super(st, skb);
913} 897}
914 898
915inline void 899static inline void
916enquiry_response(struct PStack *st) 900enquiry_response(struct PStack *st)
917{ 901{
918 if (test_bit(FLG_OWN_BUSY, &st->l2.flag)) 902 if (test_bit(FLG_OWN_BUSY, &st->l2.flag))
@@ -922,7 +906,7 @@ enquiry_response(struct PStack *st)
922 test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); 906 test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag);
923} 907}
924 908
925inline void 909static inline void
926transmit_enquiry(struct PStack *st) 910transmit_enquiry(struct PStack *st)
927{ 911{
928 if (test_bit(FLG_OWN_BUSY, &st->l2.flag)) 912 if (test_bit(FLG_OWN_BUSY, &st->l2.flag))
@@ -1004,7 +988,7 @@ l2_st7_got_super(struct FsmInst *fi, int event, void *arg)
1004 PollFlag = (skb->data[0] & 0x10); 988 PollFlag = (skb->data[0] & 0x10);
1005 nr = (skb->data[0] >> 5) & 0x7; 989 nr = (skb->data[0] >> 5) & 0x7;
1006 } 990 }
1007 FreeSkb(skb); 991 dev_kfree_skb(skb);
1008 992
1009 if (PollFlag) { 993 if (PollFlag) {
1010 if (rsp) 994 if (rsp)
@@ -1047,7 +1031,7 @@ l2_feed_i_if_reest(struct FsmInst *fi, int event, void *arg)
1047 if (!test_bit(FLG_L3_INIT, &st->l2.flag)) 1031 if (!test_bit(FLG_L3_INIT, &st->l2.flag))
1048 skb_queue_tail(&st->l2.i_queue, skb); 1032 skb_queue_tail(&st->l2.i_queue, skb);
1049 else 1033 else
1050 FreeSkb(skb); 1034 dev_kfree_skb(skb);
1051} 1035}
1052 1036
1053static void 1037static void
@@ -1093,7 +1077,7 @@ l2_got_iframe(struct FsmInst *fi, int event, void *arg)
1093 nr = (skb->data[i] >> 5) & 0x7; 1077 nr = (skb->data[i] >> 5) & 0x7;
1094 } 1078 }
1095 if (test_bit(FLG_OWN_BUSY, &l2->flag)) { 1079 if (test_bit(FLG_OWN_BUSY, &l2->flag)) {
1096 FreeSkb(skb); 1080 dev_kfree_skb(skb);
1097 if(PollFlag) enquiry_response(st); 1081 if(PollFlag) enquiry_response(st);
1098 } else if (l2->vr == ns) { 1082 } else if (l2->vr == ns) {
1099 (l2->vr)++; 1083 (l2->vr)++;
@@ -1111,7 +1095,7 @@ l2_got_iframe(struct FsmInst *fi, int event, void *arg)
1111 st->l2.l2l3(st, DL_DATA | INDICATION, skb); 1095 st->l2.l2l3(st, DL_DATA | INDICATION, skb);
1112 } else { 1096 } else {
1113 /* n(s)!=v(r) */ 1097 /* n(s)!=v(r) */
1114 FreeSkb(skb); 1098 dev_kfree_skb(skb);
1115 if (test_and_set_bit(FLG_REJEXC, &l2->flag)) { 1099 if (test_and_set_bit(FLG_REJEXC, &l2->flag)) {
1116 if (PollFlag) 1100 if (PollFlag)
1117 enquiry_response(st); 1101 enquiry_response(st);
@@ -1309,7 +1293,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
1309 skb = alloc_skb(oskb->len + i, GFP_ATOMIC); 1293 skb = alloc_skb(oskb->len + i, GFP_ATOMIC);
1310 memcpy(skb_put(skb, i), header, i); 1294 memcpy(skb_put(skb, i), header, i);
1311 memcpy(skb_put(skb, oskb->len), oskb->data, oskb->len); 1295 memcpy(skb_put(skb, oskb->len), oskb->data, oskb->len);
1312 FreeSkb(oskb); 1296 dev_kfree_skb(oskb);
1313 } 1297 }
1314 st->l2.l2l1(st, PH_PULL | INDICATION, skb); 1298 st->l2.l2l1(st, PH_PULL | INDICATION, skb);
1315 test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag); 1299 test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag);
@@ -1349,7 +1333,7 @@ l2_st8_got_super(struct FsmInst *fi, int event, void *arg)
1349 PollFlag = (skb->data[0] & 0x10); 1333 PollFlag = (skb->data[0] & 0x10);
1350 nr = (skb->data[0] >> 5) & 0x7; 1334 nr = (skb->data[0] >> 5) & 0x7;
1351 } 1335 }
1352 FreeSkb(skb); 1336 dev_kfree_skb(skb);
1353 1337
1354 if (rsp && PollFlag) { 1338 if (rsp && PollFlag) {
1355 if (legalnr(st, nr)) { 1339 if (legalnr(st, nr)) {
@@ -1391,7 +1375,7 @@ l2_got_FRMR(struct FsmInst *fi, int event, void *arg)
1391 establishlink(fi); 1375 establishlink(fi);
1392 test_and_clear_bit(FLG_L3_INIT, &st->l2.flag); 1376 test_and_clear_bit(FLG_L3_INIT, &st->l2.flag);
1393 } 1377 }
1394 FreeSkb(skb); 1378 dev_kfree_skb(skb);
1395} 1379}
1396 1380
1397static void 1381static void
@@ -1655,7 +1639,7 @@ isdnl2_l1l2(struct PStack *st, int pr, void *arg)
1655 datap += len; 1639 datap += len;
1656 else { 1640 else {
1657 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'N'); 1641 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'N');
1658 FreeSkb(skb); 1642 dev_kfree_skb(skb);
1659 return; 1643 return;
1660 } 1644 }
1661 if (!(*datap & 1)) { /* I-Frame */ 1645 if (!(*datap & 1)) { /* I-Frame */
@@ -1684,16 +1668,16 @@ isdnl2_l1l2(struct PStack *st, int pr, void *arg)
1684 ret = FsmEvent(&st->l2.l2m, EV_L2_FRMR, skb); 1668 ret = FsmEvent(&st->l2.l2m, EV_L2_FRMR, skb);
1685 } else { 1669 } else {
1686 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'L'); 1670 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *) 'L');
1687 FreeSkb(skb); 1671 dev_kfree_skb(skb);
1688 ret = 0; 1672 ret = 0;
1689 } 1673 }
1690 if(c) { 1674 if(c) {
1691 FreeSkb(skb); 1675 dev_kfree_skb(skb);
1692 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *)(long)c); 1676 FsmEvent(&st->l2.l2m, EV_L2_FRAME_ERROR, (void *)(long)c);
1693 ret = 0; 1677 ret = 0;
1694 } 1678 }
1695 if (ret) 1679 if (ret)
1696 FreeSkb(skb); 1680 dev_kfree_skb(skb);
1697 break; 1681 break;
1698 case (PH_PULL | CONFIRM): 1682 case (PH_PULL | CONFIRM):
1699 FsmEvent(&st->l2.l2m, EV_L2_ACK_PULL, arg); 1683 FsmEvent(&st->l2.l2m, EV_L2_ACK_PULL, arg);