memcpy(elm->txbuf, buf, len);
+ /* Order of next two lines is *very* important.
+ * When we are sending a little amount of data,
+ * the transfer may be completed inside the ops->write()
+ * routine, because it's running with interrupts enabled.
+ * In this case we *never* got WRITE_WAKEUP event,
+ * if we did not request it before write operation.
+ * 14 Oct 1994 Dmitry Gorodchanin.
+ */
+ set_bit(TTY_DO_WRITE_WAKEUP, &elm->tty->flags);
written = elm->tty->ops->write(elm->tty, elm->txbuf, len);
if (written < 0) {
netdev_err(elm->dev,
elm->txleft = len - written;
elm->txhead = elm->txbuf + written;
-
- if (elm->txleft)
- set_bit(TTY_DO_WRITE_WAKEUP, &elm->tty->flags);
}
/* Take the ELM327 out of almost any state and back into command mode.
elm->state = ELM327_STATE_RECEIVING;
/* We will be in the default state once this command is
- * send, so enable the TX packet queue.
+ * sent, so enable the TX packet queue.
*/
netif_wake_queue(elm->dev);
elm->state = ELM327_STATE_RECEIVING;
/* We will be in the default state once this command is
- * send, so enable the TX packet queue.
+ * sent, so enable the TX packet queue.
*/
netif_wake_queue(elm->dev);
}