Commit 6263368c authored by Ed Blake's avatar Ed Blake Committed by Greg Kroah-Hartman

serial: Add define for max baud rate divisor

Add a define for the maximum baud rate divisor, to improve code
readability.
Signed-off-by: default avatarEd Blake <ed.blake@sondrel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7464779f
...@@ -61,7 +61,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -61,7 +61,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
* registers to their default values. * registers to their default values.
*/ */
baud = uart_get_baud_rate(port, termios, old, baud = uart_get_baud_rate(port, termios, old,
port->uartclk / 16 / 0xffff, port->uartclk / 16 / UART_DIV_MAX,
port->uartclk); port->uartclk);
if (baud <= 115200) { if (baud <= 115200) {
......
...@@ -199,7 +199,7 @@ static void omap_8250_get_divisor(struct uart_port *port, unsigned int baud, ...@@ -199,7 +199,7 @@ static void omap_8250_get_divisor(struct uart_port *port, unsigned int baud,
* Old custom speed handling. * Old custom speed handling.
*/ */
if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) { if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) {
priv->quot = port->custom_divisor & 0xffff; priv->quot = port->custom_divisor & UART_DIV_MAX;
/* /*
* I assume that nobody is using this. But hey, if somebody * I assume that nobody is using this. But hey, if somebody
* would like to specify the divisor _and_ the mode then the * would like to specify the divisor _and_ the mode then the
...@@ -358,7 +358,7 @@ static void omap_8250_set_termios(struct uart_port *port, ...@@ -358,7 +358,7 @@ static void omap_8250_set_termios(struct uart_port *port,
* Ask the core to calculate the divisor for us. * Ask the core to calculate the divisor for us.
*/ */
baud = uart_get_baud_rate(port, termios, old, baud = uart_get_baud_rate(port, termios, old,
port->uartclk / 16 / 0xffff, port->uartclk / 16 / UART_DIV_MAX,
port->uartclk / 13); port->uartclk / 13);
omap_8250_get_divisor(port, baud, priv); omap_8250_get_divisor(port, baud, priv);
......
...@@ -2601,7 +2601,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, ...@@ -2601,7 +2601,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
* causing transmission errors. * causing transmission errors.
*/ */
return uart_get_baud_rate(port, termios, old, return uart_get_baud_rate(port, termios, old,
port->uartclk / 16 / 0xffff, port->uartclk / 16 / UART_DIV_MAX,
port->uartclk); port->uartclk);
} }
......
...@@ -157,6 +157,7 @@ ...@@ -157,6 +157,7 @@
*/ */
#define UART_DLL 0 /* Out: Divisor Latch Low */ #define UART_DLL 0 /* Out: Divisor Latch Low */
#define UART_DLM 1 /* Out: Divisor Latch High */ #define UART_DLM 1 /* Out: Divisor Latch High */
#define UART_DIV_MAX 0xFFFF /* Max divisor value */
/* /*
* LCR=0xBF (or DLAB=1 for 16C660) * LCR=0xBF (or DLAB=1 for 16C660)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment