aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-01-21 18:03:28 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-01-21 18:03:28 -0500
commit0077d45e46fe2af3aaee5813c99268afcd0e7c0e (patch)
tree3de13b52930e350f93523fb3c84c0b8fb4a7e7fb /drivers/serial
parent27ae7a7435634820e7f7e2b922d8119f79cfc6e4 (diff)
[SERIAL] Make uart_port flags a bitwise type
Same reasoning as commit 747c8a55946ed037bf7d62454c3c599c02af2262 but this time we're making uart_port flags a bitwise type - not all of these flags correspond with the old ASYNC_ flags, so there is the possibility for bugs if the wrong ASYNC_* constants are used. Always use UPF_* constants for uart_port->flags. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_core.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 74142b731527..0717abfdae06 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -332,7 +332,7 @@ uart_get_baud_rate(struct uart_port *port, struct termios *termios,
332 struct termios *old, unsigned int min, unsigned int max) 332 struct termios *old, unsigned int min, unsigned int max)
333{ 333{
334 unsigned int try, baud, altbaud = 38400; 334 unsigned int try, baud, altbaud = 38400;
335 unsigned int flags = port->flags & UPF_SPD_MASK; 335 upf_t flags = port->flags & UPF_SPD_MASK;
336 336
337 if (flags == UPF_SPD_HI) 337 if (flags == UPF_SPD_HI)
338 altbaud = 57600; 338 altbaud = 57600;
@@ -615,8 +615,9 @@ static int uart_set_info(struct uart_state *state,
615 struct serial_struct new_serial; 615 struct serial_struct new_serial;
616 struct uart_port *port = state->port; 616 struct uart_port *port = state->port;
617 unsigned long new_port; 617 unsigned long new_port;
618 unsigned int change_irq, change_port, old_flags, closing_wait; 618 unsigned int change_irq, change_port, closing_wait;
619 unsigned int old_custom_divisor, close_delay; 619 unsigned int old_custom_divisor, close_delay;
620 upf_t old_flags, new_flags;
620 int retval = 0; 621 int retval = 0;
621 622
622 if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) 623 if (copy_from_user(&new_serial, newinfo, sizeof(new_serial)))
@@ -655,6 +656,7 @@ static int uart_set_info(struct uart_state *state,
655 new_serial.type != port->type; 656 new_serial.type != port->type;
656 657
657 old_flags = port->flags; 658 old_flags = port->flags;
659 new_flags = new_serial.flags;
658 old_custom_divisor = port->custom_divisor; 660 old_custom_divisor = port->custom_divisor;
659 661
660 if (!capable(CAP_SYS_ADMIN)) { 662 if (!capable(CAP_SYS_ADMIN)) {
@@ -664,10 +666,10 @@ static int uart_set_info(struct uart_state *state,
664 (close_delay != state->close_delay) || 666 (close_delay != state->close_delay) ||
665 (closing_wait != state->closing_wait) || 667 (closing_wait != state->closing_wait) ||
666 (new_serial.xmit_fifo_size != port->fifosize) || 668 (new_serial.xmit_fifo_size != port->fifosize) ||
667 (((new_serial.flags ^ old_flags) & ~UPF_USR_MASK) != 0)) 669 (((new_flags ^ old_flags) & ~UPF_USR_MASK) != 0))
668 goto exit; 670 goto exit;
669 port->flags = ((port->flags & ~UPF_USR_MASK) | 671 port->flags = ((port->flags & ~UPF_USR_MASK) |
670 (new_serial.flags & UPF_USR_MASK)); 672 (new_flags & UPF_USR_MASK));
671 port->custom_divisor = new_serial.custom_divisor; 673 port->custom_divisor = new_serial.custom_divisor;
672 goto check_and_exit; 674 goto check_and_exit;
673 } 675 }
@@ -764,7 +766,7 @@ static int uart_set_info(struct uart_state *state,
764 port->irq = new_serial.irq; 766 port->irq = new_serial.irq;
765 port->uartclk = new_serial.baud_base * 16; 767 port->uartclk = new_serial.baud_base * 16;
766 port->flags = (port->flags & ~UPF_CHANGE_MASK) | 768 port->flags = (port->flags & ~UPF_CHANGE_MASK) |
767 (new_serial.flags & UPF_CHANGE_MASK); 769 (new_flags & UPF_CHANGE_MASK);
768 port->custom_divisor = new_serial.custom_divisor; 770 port->custom_divisor = new_serial.custom_divisor;
769 state->close_delay = close_delay; 771 state->close_delay = close_delay;
770 state->closing_wait = closing_wait; 772 state->closing_wait = closing_wait;