]> rtime.felk.cvut.cz Git - linux-lin.git/blobdiff - sllin/sllin.c
Workaround in case flush_buffer handler is not implemented in a tty driver e.g. usb...
[linux-lin.git] / sllin / sllin.c
index 5197b76cfb4d4192054ea8f5d5f7df7927c7db6d..91a18c7ffec1e5f6d8833913d6a51f09a354c1c1 100644 (file)
@@ -1087,7 +1087,11 @@ static int sllin_send_break(struct sllin *sl)
        break_baud = ((sl->lin_baud * 2) / 3);
        sltty_change_speed(tty, break_baud);
 
-       tty->ops->flush_buffer(tty);
+       if (tty != NULL && tty->ops != NULL && tty->ops->flush_buffer != NULL) {
+               tty->ops->flush_buffer(tty);
+       } else {
+               netdev_dbg(sl->dev, "flush_buffer is not implemented.\n");
+       }
        sl->rx_cnt = SLLIN_BUFF_BREAK;
 
        sl->rx_expect = SLLIN_BUFF_BREAK + 1;
@@ -1132,7 +1136,11 @@ static int sllin_send_break(struct sllin *sl)
        usleep_range_max = usleep_range_min + 30;
        usleep_range(usleep_range_min, usleep_range_max);
 
-       tty->ops->flush_buffer(tty);
+       if (tty != NULL && tty->ops != NULL && tty->ops->flush_buffer != NULL) {
+               tty->ops->flush_buffer(tty);
+       } else {
+               netdev_dbg(sl->dev, "flush_buffer is not implemented.\n");
+       }
 
        sl->tx_cnt = SLLIN_BUFF_SYNC;