diff options
author | Tilman Schmidt <tilman@imap.cc> | 2009-10-25 05:30:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-29 04:37:14 -0400 |
commit | 7891adf18ad9658950e532b840f1d84d8ac6cce2 (patch) | |
tree | b26fca6cf86a0af2e29fa24ad816f7bd144c5bbd /drivers/isdn/gigaset/isocdata.c | |
parent | ae67d7d81436c7e85104d586562b1a220d3cd94b (diff) |
bas_gigaset: checkpatch cleanup
On the quest for the holy grail of checkpatch.pl silence.
Impact: cosmetic
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/gigaset/isocdata.c')
-rw-r--r-- | drivers/isdn/gigaset/isocdata.c | 107 |
1 files changed, 52 insertions, 55 deletions
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index bc41611e541d..85394a6ebae8 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
@@ -41,7 +41,8 @@ static inline int isowbuf_freebytes(struct isowbuf_t *iwb) | |||
41 | 41 | ||
42 | read = iwb->read; | 42 | read = iwb->read; |
43 | write = iwb->write; | 43 | write = iwb->write; |
44 | if ((freebytes = read - write) > 0) { | 44 | freebytes = read - write; |
45 | if (freebytes > 0) { | ||
45 | /* no wraparound: need padding space within regular area */ | 46 | /* no wraparound: need padding space within regular area */ |
46 | return freebytes - BAS_OUTBUFPAD; | 47 | return freebytes - BAS_OUTBUFPAD; |
47 | } else if (read < BAS_OUTBUFPAD) { | 48 | } else if (read < BAS_OUTBUFPAD) { |
@@ -53,29 +54,6 @@ static inline int isowbuf_freebytes(struct isowbuf_t *iwb) | |||
53 | } | 54 | } |
54 | } | 55 | } |
55 | 56 | ||
56 | /* compare two offsets within the buffer | ||
57 | * The buffer is seen as circular, with the read position as start | ||
58 | * returns -1/0/1 if position a </=/> position b without crossing 'read' | ||
59 | */ | ||
60 | static inline int isowbuf_poscmp(struct isowbuf_t *iwb, int a, int b) | ||
61 | { | ||
62 | int read; | ||
63 | if (a == b) | ||
64 | return 0; | ||
65 | read = iwb->read; | ||
66 | if (a < b) { | ||
67 | if (a < read && read <= b) | ||
68 | return +1; | ||
69 | else | ||
70 | return -1; | ||
71 | } else { | ||
72 | if (b < read && read <= a) | ||
73 | return -1; | ||
74 | else | ||
75 | return +1; | ||
76 | } | ||
77 | } | ||
78 | |||
79 | /* start writing | 57 | /* start writing |
80 | * acquire the write semaphore | 58 | * acquire the write semaphore |
81 | * return true if acquired, false if busy | 59 | * return true if acquired, false if busy |
@@ -271,7 +249,7 @@ static inline void dump_bytes(enum debuglevel level, const char *tag, | |||
271 | * bit 14..13 = number of bits added by stuffing | 249 | * bit 14..13 = number of bits added by stuffing |
272 | */ | 250 | */ |
273 | static const u16 stufftab[5 * 256] = { | 251 | static const u16 stufftab[5 * 256] = { |
274 | // previous 1s = 0: | 252 | /* previous 1s = 0: */ |
275 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, | 253 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, |
276 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f, | 254 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f, |
277 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, | 255 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, |
@@ -289,7 +267,7 @@ static const u16 stufftab[5 * 256] = { | |||
289 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x0cef, | 267 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x0cef, |
290 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x2ddf, | 268 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x2ddf, |
291 | 269 | ||
292 | // previous 1s = 1: | 270 | /* previous 1s = 1: */ |
293 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x200f, | 271 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x200f, |
294 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x202f, | 272 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x202f, |
295 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x204f, | 273 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x204f, |
@@ -307,7 +285,7 @@ static const u16 stufftab[5 * 256] = { | |||
307 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dcf, | 285 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dcf, |
308 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x31ef, | 286 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x31ef, |
309 | 287 | ||
310 | // previous 1s = 2: | 288 | /* previous 1s = 2: */ |
311 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x2007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x2017, | 289 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x2007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x2017, |
312 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x2027, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x2037, | 290 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x2027, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x2037, |
313 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x2047, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x2057, | 291 | 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x2047, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x2057, |
@@ -325,7 +303,7 @@ static const u16 stufftab[5 * 256] = { | |||
325 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dc7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dd7, | 303 | 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dc7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dd7, |
326 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x31e7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x41f7, | 304 | 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x31e7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x41f7, |
327 | 305 | ||
328 | // previous 1s = 3: | 306 | /* previous 1s = 3: */ |
329 | 0x0000, 0x0001, 0x0002, 0x2003, 0x0004, 0x0005, 0x0006, 0x200b, 0x0008, 0x0009, 0x000a, 0x2013, 0x000c, 0x000d, 0x000e, 0x201b, | 307 | 0x0000, 0x0001, 0x0002, 0x2003, 0x0004, 0x0005, 0x0006, 0x200b, 0x0008, 0x0009, 0x000a, 0x2013, 0x000c, 0x000d, 0x000e, 0x201b, |
330 | 0x0010, 0x0011, 0x0012, 0x2023, 0x0014, 0x0015, 0x0016, 0x202b, 0x0018, 0x0019, 0x001a, 0x2033, 0x001c, 0x001d, 0x001e, 0x203b, | 308 | 0x0010, 0x0011, 0x0012, 0x2023, 0x0014, 0x0015, 0x0016, 0x202b, 0x0018, 0x0019, 0x001a, 0x2033, 0x001c, 0x001d, 0x001e, 0x203b, |
331 | 0x0020, 0x0021, 0x0022, 0x2043, 0x0024, 0x0025, 0x0026, 0x204b, 0x0028, 0x0029, 0x002a, 0x2053, 0x002c, 0x002d, 0x002e, 0x205b, | 309 | 0x0020, 0x0021, 0x0022, 0x2043, 0x0024, 0x0025, 0x0026, 0x204b, 0x0028, 0x0029, 0x002a, 0x2053, 0x002c, 0x002d, 0x002e, 0x205b, |
@@ -343,7 +321,7 @@ static const u16 stufftab[5 * 256] = { | |||
343 | 0x0ce0, 0x0ce1, 0x0ce2, 0x2dc3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dcb, 0x0ce8, 0x0ce9, 0x0cea, 0x2dd3, 0x0cec, 0x0ced, 0x0cee, 0x2ddb, | 321 | 0x0ce0, 0x0ce1, 0x0ce2, 0x2dc3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dcb, 0x0ce8, 0x0ce9, 0x0cea, 0x2dd3, 0x0cec, 0x0ced, 0x0cee, 0x2ddb, |
344 | 0x10f0, 0x10f1, 0x10f2, 0x31e3, 0x10f4, 0x10f5, 0x10f6, 0x31eb, 0x20f8, 0x20f9, 0x20fa, 0x41f3, 0x257c, 0x257d, 0x29be, 0x46fb, | 322 | 0x10f0, 0x10f1, 0x10f2, 0x31e3, 0x10f4, 0x10f5, 0x10f6, 0x31eb, 0x20f8, 0x20f9, 0x20fa, 0x41f3, 0x257c, 0x257d, 0x29be, 0x46fb, |
345 | 323 | ||
346 | // previous 1s = 4: | 324 | /* previous 1s = 4: */ |
347 | 0x0000, 0x2001, 0x0002, 0x2005, 0x0004, 0x2009, 0x0006, 0x200d, 0x0008, 0x2011, 0x000a, 0x2015, 0x000c, 0x2019, 0x000e, 0x201d, | 325 | 0x0000, 0x2001, 0x0002, 0x2005, 0x0004, 0x2009, 0x0006, 0x200d, 0x0008, 0x2011, 0x000a, 0x2015, 0x000c, 0x2019, 0x000e, 0x201d, |
348 | 0x0010, 0x2021, 0x0012, 0x2025, 0x0014, 0x2029, 0x0016, 0x202d, 0x0018, 0x2031, 0x001a, 0x2035, 0x001c, 0x2039, 0x001e, 0x203d, | 326 | 0x0010, 0x2021, 0x0012, 0x2025, 0x0014, 0x2029, 0x0016, 0x202d, 0x0018, 0x2031, 0x001a, 0x2035, 0x001c, 0x2039, 0x001e, 0x203d, |
349 | 0x0020, 0x2041, 0x0022, 0x2045, 0x0024, 0x2049, 0x0026, 0x204d, 0x0028, 0x2051, 0x002a, 0x2055, 0x002c, 0x2059, 0x002e, 0x205d, | 327 | 0x0020, 0x2041, 0x0022, 0x2045, 0x0024, 0x2049, 0x0026, 0x204d, 0x0028, 0x2051, 0x002a, 0x2055, 0x002c, 0x2059, 0x002e, 0x205d, |
@@ -367,7 +345,8 @@ static const u16 stufftab[5 * 256] = { | |||
367 | * parameters: | 345 | * parameters: |
368 | * cin input byte | 346 | * cin input byte |
369 | * ones number of trailing '1' bits in result before this step | 347 | * ones number of trailing '1' bits in result before this step |
370 | * iwb pointer to output buffer structure (write semaphore must be held) | 348 | * iwb pointer to output buffer structure |
349 | * (write semaphore must be held) | ||
371 | * return value: | 350 | * return value: |
372 | * number of trailing '1' bits in result after this step | 351 | * number of trailing '1' bits in result after this step |
373 | */ | 352 | */ |
@@ -408,7 +387,8 @@ static inline int hdlc_bitstuff_byte(struct isowbuf_t *iwb, unsigned char cin, | |||
408 | * parameters: | 387 | * parameters: |
409 | * in input buffer | 388 | * in input buffer |
410 | * count number of bytes in input buffer | 389 | * count number of bytes in input buffer |
411 | * iwb pointer to output buffer structure (write semaphore must be held) | 390 | * iwb pointer to output buffer structure |
391 | * (write semaphore must be held) | ||
412 | * return value: | 392 | * return value: |
413 | * position of end of packet in output buffer on success, | 393 | * position of end of packet in output buffer on success, |
414 | * -EAGAIN if write semaphore busy or buffer full | 394 | * -EAGAIN if write semaphore busy or buffer full |
@@ -440,7 +420,8 @@ static inline int hdlc_buildframe(struct isowbuf_t *iwb, | |||
440 | fcs = crc_ccitt_byte(fcs, c); | 420 | fcs = crc_ccitt_byte(fcs, c); |
441 | } | 421 | } |
442 | 422 | ||
443 | /* bitstuff and append FCS (complemented, least significant byte first) */ | 423 | /* bitstuff and append FCS |
424 | * (complemented, least significant byte first) */ | ||
444 | fcs ^= 0xffff; | 425 | fcs ^= 0xffff; |
445 | ones = hdlc_bitstuff_byte(iwb, fcs & 0x00ff, ones); | 426 | ones = hdlc_bitstuff_byte(iwb, fcs & 0x00ff, ones); |
446 | ones = hdlc_bitstuff_byte(iwb, (fcs >> 8) & 0x00ff, ones); | 427 | ones = hdlc_bitstuff_byte(iwb, (fcs >> 8) & 0x00ff, ones); |
@@ -459,7 +440,8 @@ static inline int hdlc_buildframe(struct isowbuf_t *iwb, | |||
459 | * parameters: | 440 | * parameters: |
460 | * in input buffer | 441 | * in input buffer |
461 | * count number of bytes in input buffer | 442 | * count number of bytes in input buffer |
462 | * iwb pointer to output buffer structure (write semaphore must be held) | 443 | * iwb pointer to output buffer structure |
444 | * (write semaphore must be held) | ||
463 | * return value: | 445 | * return value: |
464 | * position of end of packet in output buffer on success, | 446 | * position of end of packet in output buffer on success, |
465 | * -EAGAIN if write semaphore busy or buffer full | 447 | * -EAGAIN if write semaphore busy or buffer full |
@@ -567,8 +549,8 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
567 | hdlc_flush(bcs); | 549 | hdlc_flush(bcs); |
568 | return; | 550 | return; |
569 | } | 551 | } |
570 | 552 | procskb = bcs->skb; | |
571 | if ((procskb = bcs->skb) == NULL) { | 553 | if (procskb == NULL) { |
572 | /* previous error */ | 554 | /* previous error */ |
573 | gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__); | 555 | gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__); |
574 | gigaset_isdn_rcv_err(bcs); | 556 | gigaset_isdn_rcv_err(bcs); |
@@ -646,8 +628,8 @@ static const unsigned char bitcounts[256] = { | |||
646 | }; | 628 | }; |
647 | 629 | ||
648 | /* hdlc_unpack | 630 | /* hdlc_unpack |
649 | * perform HDLC frame processing (bit unstuffing, flag detection, FCS calculation) | 631 | * perform HDLC frame processing (bit unstuffing, flag detection, FCS |
650 | * on a sequence of received data bytes (8 bits each, LSB first) | 632 | * calculation) on a sequence of received data bytes (8 bits each, LSB first) |
651 | * pass on successfully received, complete frames as SKBs via gigaset_skb_rcvd | 633 | * pass on successfully received, complete frames as SKBs via gigaset_skb_rcvd |
652 | * notify of errors via gigaset_isdn_rcv_err | 634 | * notify of errors via gigaset_isdn_rcv_err |
653 | * tally frames, errors etc. in BC structure counters | 635 | * tally frames, errors etc. in BC structure counters |
@@ -665,9 +647,12 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
665 | 647 | ||
666 | /* load previous state: | 648 | /* load previous state: |
667 | * inputstate = set of flag bits: | 649 | * inputstate = set of flag bits: |
668 | * - INS_flag_hunt: no complete opening flag received since connection setup or last abort | 650 | * - INS_flag_hunt: no complete opening flag received since connection |
669 | * - INS_have_data: at least one complete data byte received since last flag | 651 | * setup or last abort |
670 | * seqlen = number of consecutive '1' bits in last 7 input stream bits (0..7) | 652 | * - INS_have_data: at least one complete data byte received since last |
653 | * flag | ||
654 | * seqlen = number of consecutive '1' bits in last 7 input stream bits | ||
655 | * (0..7) | ||
671 | * inbyte = accumulated partial data byte (if !INS_flag_hunt) | 656 | * inbyte = accumulated partial data byte (if !INS_flag_hunt) |
672 | * inbits = number of valid bits in inbyte, starting at LSB (0..6) | 657 | * inbits = number of valid bits in inbyte, starting at LSB (0..6) |
673 | */ | 658 | */ |
@@ -701,9 +686,11 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
701 | inbyte = c >> (lead1 + 1); | 686 | inbyte = c >> (lead1 + 1); |
702 | inbits = 7 - lead1; | 687 | inbits = 7 - lead1; |
703 | if (trail1 >= 8) { | 688 | if (trail1 >= 8) { |
704 | /* interior stuffing: omitting the MSB handles most cases */ | 689 | /* interior stuffing: |
690 | * omitting the MSB handles most cases, | ||
691 | * correct the incorrectly handled | ||
692 | * cases individually */ | ||
705 | inbits--; | 693 | inbits--; |
706 | /* correct the incorrectly handled cases individually */ | ||
707 | switch (c) { | 694 | switch (c) { |
708 | case 0xbe: | 695 | case 0xbe: |
709 | inbyte = 0x3f; | 696 | inbyte = 0x3f; |
@@ -729,13 +716,14 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
729 | hdlc_flush(bcs); | 716 | hdlc_flush(bcs); |
730 | inputstate |= INS_flag_hunt; | 717 | inputstate |= INS_flag_hunt; |
731 | } else if (seqlen == 6) { | 718 | } else if (seqlen == 6) { |
732 | /* closing flag, including (6 - lead1) '1's and one '0' from inbits */ | 719 | /* closing flag, including (6 - lead1) '1's |
720 | * and one '0' from inbits */ | ||
733 | if (inbits > 7 - lead1) { | 721 | if (inbits > 7 - lead1) { |
734 | hdlc_frag(bcs, inbits + lead1 - 7); | 722 | hdlc_frag(bcs, inbits + lead1 - 7); |
735 | inputstate &= ~INS_have_data; | 723 | inputstate &= ~INS_have_data; |
736 | } else { | 724 | } else { |
737 | if (inbits < 7 - lead1) | 725 | if (inbits < 7 - lead1) |
738 | ubc->stolen0s ++; | 726 | ubc->stolen0s++; |
739 | if (inputstate & INS_have_data) { | 727 | if (inputstate & INS_have_data) { |
740 | hdlc_done(bcs); | 728 | hdlc_done(bcs); |
741 | inputstate &= ~INS_have_data; | 729 | inputstate &= ~INS_have_data; |
@@ -744,7 +732,7 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
744 | 732 | ||
745 | if (c == PPP_FLAG) { | 733 | if (c == PPP_FLAG) { |
746 | /* complete flag, LSB overlaps preceding flag */ | 734 | /* complete flag, LSB overlaps preceding flag */ |
747 | ubc->shared0s ++; | 735 | ubc->shared0s++; |
748 | inbits = 0; | 736 | inbits = 0; |
749 | inbyte = 0; | 737 | inbyte = 0; |
750 | } else if (trail1 != 7) { | 738 | } else if (trail1 != 7) { |
@@ -752,9 +740,11 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
752 | inbyte = c >> (lead1 + 1); | 740 | inbyte = c >> (lead1 + 1); |
753 | inbits = 7 - lead1; | 741 | inbits = 7 - lead1; |
754 | if (trail1 >= 8) { | 742 | if (trail1 >= 8) { |
755 | /* interior stuffing: omitting the MSB handles most cases */ | 743 | /* interior stuffing: |
744 | * omitting the MSB handles most cases, | ||
745 | * correct the incorrectly handled | ||
746 | * cases individually */ | ||
756 | inbits--; | 747 | inbits--; |
757 | /* correct the incorrectly handled cases individually */ | ||
758 | switch (c) { | 748 | switch (c) { |
759 | case 0xbe: | 749 | case 0xbe: |
760 | inbyte = 0x3f; | 750 | inbyte = 0x3f; |
@@ -762,7 +752,8 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
762 | } | 752 | } |
763 | } | 753 | } |
764 | } else { | 754 | } else { |
765 | /* abort sequence follows, skb already empty anyway */ | 755 | /* abort sequence follows, |
756 | * skb already empty anyway */ | ||
766 | ubc->aborts++; | 757 | ubc->aborts++; |
767 | inputstate |= INS_flag_hunt; | 758 | inputstate |= INS_flag_hunt; |
768 | } | 759 | } |
@@ -787,14 +778,17 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
787 | } else { | 778 | } else { |
788 | /* stuffed data */ | 779 | /* stuffed data */ |
789 | if (trail1 < 7) { /* => seqlen == 5 */ | 780 | if (trail1 < 7) { /* => seqlen == 5 */ |
790 | /* stuff bit at position lead1, no interior stuffing */ | 781 | /* stuff bit at position lead1, |
782 | * no interior stuffing */ | ||
791 | unsigned char mask = (1 << lead1) - 1; | 783 | unsigned char mask = (1 << lead1) - 1; |
792 | c = (c & mask) | ((c & ~mask) >> 1); | 784 | c = (c & mask) | ((c & ~mask) >> 1); |
793 | inbyte |= c << inbits; | 785 | inbyte |= c << inbits; |
794 | inbits += 7; | 786 | inbits += 7; |
795 | } else if (seqlen < 5) { /* trail1 >= 8 */ | 787 | } else if (seqlen < 5) { /* trail1 >= 8 */ |
796 | /* interior stuffing: omitting the MSB handles most cases */ | 788 | /* interior stuffing: |
797 | /* correct the incorrectly handled cases individually */ | 789 | * omitting the MSB handles most cases, |
790 | * correct the incorrectly handled | ||
791 | * cases individually */ | ||
798 | switch (c) { | 792 | switch (c) { |
799 | case 0xbe: | 793 | case 0xbe: |
800 | c = 0x7e; | 794 | c = 0x7e; |
@@ -804,8 +798,9 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
804 | inbits += 7; | 798 | inbits += 7; |
805 | } else { /* seqlen == 5 && trail1 >= 8 */ | 799 | } else { /* seqlen == 5 && trail1 >= 8 */ |
806 | 800 | ||
807 | /* stuff bit at lead1 *and* interior stuffing */ | 801 | /* stuff bit at lead1 *and* interior |
808 | switch (c) { /* unstuff individually */ | 802 | * stuffing -- unstuff individually */ |
803 | switch (c) { | ||
809 | case 0x7d: | 804 | case 0x7d: |
810 | c = 0x3f; | 805 | c = 0x3f; |
811 | break; | 806 | break; |
@@ -862,7 +857,8 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
862 | hdlc_flush(bcs); | 857 | hdlc_flush(bcs); |
863 | return; | 858 | return; |
864 | } | 859 | } |
865 | if (unlikely((skb = bcs->skb) == NULL)) { | 860 | skb = bcs->skb; |
861 | if (unlikely(skb == NULL)) { | ||
866 | bcs->skb = skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | 862 | bcs->skb = skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); |
867 | if (!skb) { | 863 | if (!skb) { |
868 | dev_err(cs->dev, "could not allocate skb\n"); | 864 | dev_err(cs->dev, "could not allocate skb\n"); |
@@ -895,7 +891,8 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
895 | } | 891 | } |
896 | } | 892 | } |
897 | 893 | ||
898 | void gigaset_isoc_receive(unsigned char *src, unsigned count, struct bc_state *bcs) | 894 | void gigaset_isoc_receive(unsigned char *src, unsigned count, |
895 | struct bc_state *bcs) | ||
899 | { | 896 | { |
900 | switch (bcs->proto2) { | 897 | switch (bcs->proto2) { |
901 | case L2_HDLC: | 898 | case L2_HDLC: |