termios: Notify driver about inactive transmit

Returning this state in the return value leads to race conditions on
SMP.  The inactive state notification must be inside the critical
section.
This commit is contained in:
Sebastian Huber
2013-06-10 14:36:44 +02:00
parent 7338299c96
commit fed92f5f67
2 changed files with 9 additions and 0 deletions

View File

@@ -1332,6 +1332,7 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
wakeUpWriterTask = true;
}
(*tty->device.write) (tty->minor, NULL, 0);
nToSend = 0;
} else {
len = tty->t_dqlen;
@@ -1351,6 +1352,7 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
* Buffer has become empty
*/
tty->rawOutBufState = rob_idle;
(*tty->device.write) (tty->minor, NULL, 0);
nToSend = 0;
/*
@@ -1367,6 +1369,7 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
/* set flag, that output has been stopped */
tty->flow_ctrl |= FL_OSTOP;
tty->rawOutBufState = rob_busy; /*apm*/
(*tty->device.write) (tty->minor, NULL, 0);
nToSend = 0;
} else {
/*

View File

@@ -408,6 +408,12 @@ static ssize_t my_driver_interrupt_write(int minor, const char *buf, size_t n)
* characters in the device data structure.
*/
/*
* Termios will set n to zero to indicate that the transmitter is
* now inactive. The output buffer is empty in this case. The
* driver may disable the transmit interrupts now.
*/
return 0;
@}
@end group