X-Git-Url: http://rtime.felk.cvut.cz/gitweb/linux-lin.git/blobdiff_plain/ad928a5023e09d34b474f797137ddb2c3bb4881d..15febc596cdee62724c16fa7a8ed8dfcb9b667bb:/sllin/sllin.c diff --git a/sllin/sllin.c b/sllin/sllin.c index 4f4da0f..dc30884 100644 --- a/sllin/sllin.c +++ b/sllin/sllin.c @@ -524,13 +524,11 @@ static void sllin_slave_receive_buf(struct tty_struct *tty, /* We did not receive break (0x00) character */ if ((sl->rx_cnt == SLLIN_BUFF_BREAK) && (*cp == 0x55)) { sl->rx_buff[sl->rx_cnt++] = 0x00; - sl->rx_buff[sl->rx_cnt++] = 0x55; - cp++; } if (sl->rx_cnt == SLLIN_BUFF_SYNC) { /* 'Duplicated' break character -- ignore */ - if ((*cp == 0x00) && (*(cp + 1) == 0x55)) { + if (*cp == 0x00) { cp++; continue; } @@ -552,7 +550,7 @@ static void sllin_slave_receive_buf(struct tty_struct *tty, spin_lock_irqsave(&sl->linfr_lock, flags); /* Is the length of data set in frame cache? */ - if (sce->frame_fl & LIN_LOC_SLAVE_CACHE) { + if (sce->frame_fl & LIN_CACHE_RESPONSE) { sl->rx_expect += sce->dlc; sl->rx_len_unknown = false; } else { @@ -643,7 +641,7 @@ static int sllin_configure_frame_cache(struct sllin *sl, struct can_frame *cf) unsigned long flags; struct sllin_conf_entry *sce; - if (!(cf->can_id & LIN_ID_CONF)) + if (!(cf->can_id & LIN_CTRL_FRAME)) return -1; sce = &sl->linfr_cache[cf->can_id & LIN_ID_MASK]; @@ -717,8 +715,9 @@ int sllin_setup_msg(struct sllin *sl, int mode, int id, if ((data != NULL) && len) { sl->tx_lim += len; memcpy(sl->tx_buff + SLLIN_BUFF_DATA, data, len); - sl->tx_buff[sl->tx_lim++] = sllin_checksum(sl->tx_buff, + sl->tx_buff[sl->tx_lim] = sllin_checksum(sl->tx_buff, sl->tx_lim, mode & SLLIN_STPMSG_CHCKSUM_ENH); + sl->tx_lim++; } if (len != 0) sl->rx_lim = SLLIN_BUFF_DATA + len + 1; @@ -1005,7 +1004,7 @@ int sllin_kwthread(void *ptr) spin_lock_irqsave(&sl->linfr_lock, flags); /* Is there Slave response in linfr_cache to be sent? */ - if ((sce->frame_fl & LIN_LOC_SLAVE_CACHE) + if ((sce->frame_fl & LIN_CACHE_RESPONSE) && (sce->dlc > 0)) { pr_debug("sllin: Sending LIN response from linfr_cache\n");