+#else /* BREAK_BY_BAUD */
+
+int sllin_send_break(struct sllin *sl)
+{
+ struct tty_struct *tty = sl->tty;
+ int retval;
+ unsigned long break_baud;
+ unsigned long usleep_range_min;
+ unsigned long usleep_range_max;
+
+ break_baud = ((sl->lin_baud * 2) / 3);
+ sl->rx_cnt = SLLIN_BUFF_BREAK;
+ sl->rx_expect = SLLIN_BUFF_BREAK + 1;
+ sl->lin_state = SLSTATE_BREAK_SENT;
+
+ /* Do the break ourselves; Inspired by
+ http://lxr.linux.no/#linux+v3.1.2/drivers/tty/tty_io.c#L2452 */
+ retval = tty->ops->break_ctl(tty, -1);
+ if (retval)
+ return retval;
+
+ /* udelay(712); */
+ usleep_range_min = (1000000l * SLLIN_SAMPLES_PER_CHAR) / break_baud;
+ usleep_range_max = usleep_range_min + 50;
+ usleep_range(usleep_range_min, usleep_range_max);
+
+ retval = tty->ops->break_ctl(tty, 0);
+ usleep_range_min = (1000000l * 1 /* 1 bit */) / break_baud;
+ usleep_range_max = usleep_range_min + 30;
+ usleep_range(usleep_range_min, usleep_range_max);
+
+ tty->ops->flush_buffer(tty);
+
+ sl->tx_cnt = SLLIN_BUFF_SYNC;
+
+ pr_debug("sllin: Break sent.\n");
+ set_bit(SLF_RXEVENT, &sl->flags);
+ wake_up(&sl->kwt_wq);
+
+ return 0;
+}
+#endif /* BREAK_BY_BAUD */
+
+
+static enum hrtimer_restart sllin_rx_timeout_handler(struct hrtimer *hrtimer)
+{
+ struct sllin *sl = container_of(hrtimer, struct sllin, rx_timer);
+
+ sllin_report_error(sl, LIN_ERR_RX_TIMEOUT);
+ set_bit(SLF_TMOUTEVENT, &sl->flags);
+ wake_up(&sl->kwt_wq);
+
+ return HRTIMER_NORESTART;
+}
+
+/**
+ * sllin_rx_validate() -- Validate received frame, i,e. check checksum
+ *
+ * @sl:
+ */
+static int sllin_rx_validate(struct sllin *sl)
+{
+ int actual_id;
+ int ext_chcks_fl;
+ int lin_dlc;
+ unsigned char rec_chcksm = sl->rx_buff[sl->rx_cnt - 1];
+ struct sllin_conf_entry *scf;
+
+ actual_id = sl->rx_buff[SLLIN_BUFF_ID] & LIN_ID_MASK;
+ scf = &sl->linfr_cache[actual_id];
+ lin_dlc = scf->dlc;
+ ext_chcks_fl = scf->frame_fl & LIN_CHECKSUM_EXTENDED;
+
+ if (sllin_checksum(sl->rx_buff, sl->rx_cnt - 1, ext_chcks_fl) !=
+ rec_chcksm) {
+
+ /* Type of checksum is configured for particular frame */
+ if (lin_dlc > 0) {
+ return -1;
+ } else {
+ if (sllin_checksum(sl->rx_buff, sl->rx_cnt - 1,
+ !ext_chcks_fl) != rec_chcksm) {
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}