diff options
Diffstat (limited to 'drivers/isdn/i4l/isdnhdlc.c')
-rw-r--r-- | drivers/isdn/i4l/isdnhdlc.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/isdn/i4l/isdnhdlc.c b/drivers/isdn/i4l/isdnhdlc.c index c989aa3..027d1c5 100644 --- a/drivers/isdn/i4l/isdnhdlc.c +++ b/drivers/isdn/i4l/isdnhdlc.c @@ -88,7 +88,7 @@ check_frame(struct isdnhdlc_vars *hdlc) { int status; - if (hdlc->dstpos < 2) /* too small - framing error */ + if (hdlc->dstpos < 2) /* too small - framing error */ status = -HDLC_FRAMING_ERROR; else if (hdlc->crc != 0xf0b8) /* crc error */ status = -HDLC_CRC_ERROR; @@ -127,9 +127,9 @@ check_frame(struct isdnhdlc_vars *hdlc) dsize - destination buffer size returns - number of decoded bytes in the destination buffer and status flag. - */ +*/ int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src, int slen, - int *count, u8 *dst, int dsize) + int *count, u8 *dst, int dsize) { int status = 0; @@ -145,28 +145,28 @@ int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src, int slen, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff }; -#define handle_fast_flag(h) \ - do {\ - if (h->cbin == fast_flag[h->bit_shift]) {\ - h->ffvalue = fast_flag_value[h->bit_shift];\ - h->state = HDLC_FAST_FLAG;\ - h->ffbit_shift = h->bit_shift;\ - h->bit_shift = 1;\ - } else {\ - h->state = HDLC_GET_DATA;\ - h->data_received = 0;\ - } \ +#define handle_fast_flag(h) \ + do { \ + if (h->cbin == fast_flag[h->bit_shift]) { \ + h->ffvalue = fast_flag_value[h->bit_shift]; \ + h->state = HDLC_FAST_FLAG; \ + h->ffbit_shift = h->bit_shift; \ + h->bit_shift = 1; \ + } else { \ + h->state = HDLC_GET_DATA; \ + h->data_received = 0; \ + } \ } while (0) -#define handle_abort(h) \ - do {\ - h->shift_reg = fast_abort[h->ffbit_shift - 1];\ - h->hdlc_bits1 = h->ffbit_shift - 2;\ - if (h->hdlc_bits1 < 0)\ - h->hdlc_bits1 = 0;\ - h->data_bits = h->ffbit_shift - 1;\ - h->state = HDLC_GET_DATA;\ - h->data_received = 0;\ +#define handle_abort(h) \ + do { \ + h->shift_reg = fast_abort[h->ffbit_shift - 1]; \ + h->hdlc_bits1 = h->ffbit_shift - 2; \ + if (h->hdlc_bits1 < 0) \ + h->hdlc_bits1 = 0; \ + h->data_bits = h->ffbit_shift - 1; \ + h->state = HDLC_GET_DATA; \ + h->data_received = 0; \ } while (0) *count = slen; @@ -204,7 +204,7 @@ int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src, int slen, if ((!hdlc->do_adapt56) && (++hdlc->hdlc_bits1 >= 8) && (hdlc->bit_shift == 1)) - hdlc->state = HDLC_FAST_IDLE; + hdlc->state = HDLC_FAST_IDLE; } hdlc->cbin <<= 1; hdlc->bit_shift--; @@ -295,7 +295,7 @@ int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src, int slen, hdlc->data_bits = 0; hdlc->data_received = 1; hdlc->crc = crc_ccitt_byte(hdlc->crc, - hdlc->shift_reg); + hdlc->shift_reg); /* good byte received */ if (hdlc->dstpos < dsize) @@ -352,7 +352,7 @@ EXPORT_SYMBOL(isdnhdlc_decode); returns - number of encoded bytes in the destination buffer */ int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src, u16 slen, - int *count, u8 *dst, int dsize) + int *count, u8 *dst, int dsize) { static const unsigned char xfast_flag_value[] = { 0x7e, 0x3f, 0x9f, 0xcf, 0xe7, 0xf3, 0xf9, 0xfc, 0x7e @@ -478,7 +478,7 @@ int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src, u16 slen, } if (hdlc->bit_shift == 8) hdlc->crc = crc_ccitt_byte(hdlc->crc, - hdlc->shift_reg); + hdlc->shift_reg); if (hdlc->shift_reg & 0x01) { hdlc->hdlc_bits1++; hdlc->cbin++; |