diff options
author | Alan Cox <alan@linux.intel.com> | 2009-09-19 16:13:21 -0400 |
---|---|---|
committer | Live-CD User <linux@linux.site> | 2009-09-19 16:13:21 -0400 |
commit | 1e2b025453d45d35b07d8105bea7fc9d339ff562 (patch) | |
tree | 8d8e8f042983450d7f5f48c34e404f4e650d2a7c /drivers/char | |
parent | c146942573c84b16ccb480a9cfa885a7581585a8 (diff) |
mxser: Split close ready for a standard tty_port_close method
Prepare for the tty_port_close function by splitting out methods
Signed-off-by: Alan Cox <alan@linux.intel.com>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/mxser.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index dbf8d52f31d0..30544ca5e956 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -1073,34 +1073,17 @@ static void mxser_flush_buffer(struct tty_struct *tty) | |||
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | 1075 | ||
1076 | /* | 1076 | static void mxser_close_port(struct tty_struct *tty, struct tty_port *port) |
1077 | * This routine is called when the serial port gets closed. First, we | ||
1078 | * wait for the last remaining data to be sent. Then, we unlink its | ||
1079 | * async structure from the interrupt chain if necessary, and we free | ||
1080 | * that IRQ if nothing is left in the chain. | ||
1081 | */ | ||
1082 | static void mxser_close(struct tty_struct *tty, struct file *filp) | ||
1083 | { | 1077 | { |
1084 | struct mxser_port *info = tty->driver_data; | 1078 | struct mxser_port *info = container_of(port, struct mxser_port, port); |
1085 | struct tty_port *port = &info->port; | ||
1086 | |||
1087 | unsigned long timeout; | 1079 | unsigned long timeout; |
1088 | |||
1089 | if (tty->index == MXSER_PORTS) | ||
1090 | return; | ||
1091 | if (!info) | ||
1092 | return; | ||
1093 | |||
1094 | if (tty_port_close_start(port, tty, filp) == 0) | ||
1095 | return; | ||
1096 | |||
1097 | /* | 1080 | /* |
1098 | * Save the termios structure, since this port may have | 1081 | * Save the termios structure, since this port may have |
1099 | * separate termios for callout and dialin. | 1082 | * separate termios for callout and dialin. |
1100 | * | 1083 | * |
1101 | * FIXME: Can this go ? | 1084 | * FIXME: Can this go ? |
1102 | */ | 1085 | */ |
1103 | if (info->port.flags & ASYNC_NORMAL_ACTIVE) | 1086 | if (port->flags & ASYNC_NORMAL_ACTIVE) |
1104 | info->normal_termios = *tty->termios; | 1087 | info->normal_termios = *tty->termios; |
1105 | /* | 1088 | /* |
1106 | * At this point we stop accepting input. To do this, we | 1089 | * At this point we stop accepting input. To do this, we |
@@ -1112,7 +1095,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
1112 | if (info->board->chip_flag) | 1095 | if (info->board->chip_flag) |
1113 | info->IER &= ~MOXA_MUST_RECV_ISR; | 1096 | info->IER &= ~MOXA_MUST_RECV_ISR; |
1114 | 1097 | ||
1115 | if (info->port.flags & ASYNC_INITIALIZED) { | 1098 | if (port->flags & ASYNC_INITIALIZED) { |
1116 | outb(info->IER, info->ioaddr + UART_IER); | 1099 | outb(info->IER, info->ioaddr + UART_IER); |
1117 | /* | 1100 | /* |
1118 | * Before we drop DTR, make sure the UART transmitter | 1101 | * Before we drop DTR, make sure the UART transmitter |
@@ -1127,8 +1110,26 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
1127 | } | 1110 | } |
1128 | } | 1111 | } |
1129 | mxser_shutdown(tty); | 1112 | mxser_shutdown(tty); |
1130 | mxser_flush_buffer(tty); | ||
1131 | 1113 | ||
1114 | } | ||
1115 | |||
1116 | /* | ||
1117 | * This routine is called when the serial port gets closed. First, we | ||
1118 | * wait for the last remaining data to be sent. Then, we unlink its | ||
1119 | * async structure from the interrupt chain if necessary, and we free | ||
1120 | * that IRQ if nothing is left in the chain. | ||
1121 | */ | ||
1122 | static void mxser_close(struct tty_struct *tty, struct file *filp) | ||
1123 | { | ||
1124 | struct mxser_port *info = tty->driver_data; | ||
1125 | struct tty_port *port = &info->port; | ||
1126 | |||
1127 | if (tty->index == MXSER_PORTS) | ||
1128 | return; | ||
1129 | if (tty_port_close_start(port, tty, filp) == 0) | ||
1130 | return; | ||
1131 | mxser_close_port(tty, port); | ||
1132 | mxser_flush_buffer(tty); | ||
1132 | /* Right now the tty_port set is done outside of the close_end helper | 1133 | /* Right now the tty_port set is done outside of the close_end helper |
1133 | as we don't yet have everyone using refcounts */ | 1134 | as we don't yet have everyone using refcounts */ |
1134 | tty_port_close_end(port, tty); | 1135 | tty_port_close_end(port, tty); |