- spin_lock_irqsave(&sl->linfr_lock, flags);
- /* Is the length of data set in frame cache? */
- if (sce->frame_fl & LIN_LOC_SLAVE_CACHE) {
- sl->rx_expect += sce->dlc;
- sl->rx_len_unknown = false;
- } else {
- sl->rx_expect += SLLIN_DATA_MAX + 1; /* + checksum */
- sl->rx_len_unknown = true;
+ /* Read the characters out of the buffer */
+ while (count--) {
+ if (fp && *fp++) {
+ netdev_dbg(sl->dev, "sllin_slave_receive_buf char 0x%02x ignored "
+ "due marker 0x%02x, flags 0x%lx\n",
+ *cp, *(fp-1), sl->flags);
+
+ /* Received Break */
+ sl->rx_cnt = 0;
+ sl->rx_expect = SLLIN_BUFF_ID + 1;
+ sl->rx_len_unknown = false; /* We do know exact length of the header */
+ sl->header_received = false;
+ }
+
+ if (sl->rx_cnt < SLLIN_BUFF_LEN) {
+ netdev_dbg(sl->dev, "LIN_RX[%d]: 0x%02x\n", sl->rx_cnt, *cp);
+
+ /* We did not receive break (0x00) character */
+ if ((sl->rx_cnt == SLLIN_BUFF_BREAK) && (*cp == 0x55)) {
+ sl->rx_buff[sl->rx_cnt++] = 0x00;
+ }
+
+ if (sl->rx_cnt == SLLIN_BUFF_SYNC) {
+ /* 'Duplicated' break character -- ignore */
+ if (*cp == 0x00) {
+ cp++;
+ continue;