Skip to content

Commit

Permalink
serial: Fix send_xchar() handlers
Browse files Browse the repository at this point in the history
START_CHAR() & STOP_CHAR() can be disabled if set to '\0'
(__DISABLED_CHAR).  UART drivers which define a send_xchar()
handler must not transmit __DISABLED_CHAR.

Document requirement.

Affected drivers:
sunsab
sunhv

cc: David S. Miller <[email protected]>
cc: <[email protected]>
Signed-off-by: Peter Hurley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
peterhurley authored and gregkh committed Sep 8, 2014
1 parent fba594a commit db106df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Documentation/serial/driver
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ hardware.
will append the character to the circular buffer and then call
start_tx() / stop_tx() to flush the data out.

Do not transmit if ch == '\0' (__DISABLED_CHAR).

Locking: none.
Interrupts: caller dependent.

Expand Down
3 changes: 3 additions & 0 deletions drivers/tty/serial/sunhv.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ static void sunhv_send_xchar(struct uart_port *port, char ch)
unsigned long flags;
int limit = 10000;

if (ch == __DISABLED_CHAR)
return;

spin_lock_irqsave(&port->lock, flags);

while (limit-- > 0) {
Expand Down
3 changes: 3 additions & 0 deletions drivers/tty/serial/sunsab.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ static void sunsab_send_xchar(struct uart_port *port, char ch)
struct uart_sunsab_port *up = (struct uart_sunsab_port *) port;
unsigned long flags;

if (ch == __DISABLED_CHAR)
return;

spin_lock_irqsave(&up->port.lock, flags);

sunsab_tec_wait(up);
Expand Down

0 comments on commit db106df

Please sign in to comment.