Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 94089
b: refs/heads/master
c: eb424fd
h: refs/heads/master
i:
  94087: d0ed07a
v: v3
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Apr 28, 2008
1 parent d0fac35 commit de5fd36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e991a2bd4fa0b2f475b67dfe8f33e8ecbdcbb40b
refs/heads/master: eb424fd21c0931e998156225f2a0910167c3e16c
15 changes: 11 additions & 4 deletions trunk/drivers/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,15 @@ EXPORT_SYMBOL(uart_update_timeout);
* If it's still invalid, we try 9600 baud.
*
* Update the @termios structure to reflect the baud rate
* we're actually going to be using.
* we're actually going to be using. Don't do this for the case
* where B0 is requested ("hang up").
*/
unsigned int
uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
struct ktermios *old, unsigned int min, unsigned int max)
{
unsigned int try, baud, altbaud = 38400;
int hung_up = 0;
upf_t flags = port->flags & UPF_SPD_MASK;

if (flags == UPF_SPD_HI)
Expand All @@ -360,8 +362,10 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
/*
* Special case: B0 rate.
*/
if (baud == 0)
if (baud == 0) {
hung_up = 1;
baud = 9600;
}

if (baud >= min && baud <= max)
return baud;
Expand All @@ -373,7 +377,9 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
termios->c_cflag &= ~CBAUD;
if (old) {
baud = tty_termios_baud_rate(old);
tty_termios_encode_baud_rate(termios, baud, baud);
if (!hung_up)
tty_termios_encode_baud_rate(termios,
baud, baud);
old = NULL;
continue;
}
Expand All @@ -382,7 +388,8 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
* As a last resort, if the quotient is zero,
* default to 9600 bps
*/
tty_termios_encode_baud_rate(termios, 9600, 9600);
if (!hung_up)
tty_termios_encode_baud_rate(termios, 9600, 9600);
}

return 0;
Expand Down

0 comments on commit de5fd36

Please sign in to comment.