diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-03-05 08:52:49 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 15:50:02 -0500 |
commit | 9b937421e852cfa9992d6e1a1d814dcec8eb1ce3 (patch) | |
tree | c5dae1ce3a2e61335145ae3b66508b5d0524b749 /drivers/tty | |
parent | b8edebe4b8b4ad5bd436cf9080b77b29e219029a (diff) |
TTY: amiserial, use tty_port_close_start
Again, no need to duplicate the code. Let's use the helper.
Amiserial changes are only free of compilation errors. I have no
access to the hardware.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/amiserial.c | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 9c8b199bad35..afadcd43d14e 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
@@ -1389,53 +1389,13 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1389 | { | 1389 | { |
1390 | struct serial_state *state = tty->driver_data; | 1390 | struct serial_state *state = tty->driver_data; |
1391 | struct tty_port *port = &state->tport; | 1391 | struct tty_port *port = &state->tport; |
1392 | unsigned long flags; | ||
1393 | 1392 | ||
1394 | if (!state || serial_paranoia_check(state, tty->name, "rs_close")) | 1393 | if (serial_paranoia_check(state, tty->name, "rs_close")) |
1395 | return; | 1394 | return; |
1396 | 1395 | ||
1397 | local_irq_save(flags); | 1396 | if (tty_port_close_start(port, tty, filp) == 0) |
1398 | |||
1399 | if (tty_hung_up_p(filp)) { | ||
1400 | DBG_CNT("before DEC-hung"); | ||
1401 | local_irq_restore(flags); | ||
1402 | return; | 1397 | return; |
1403 | } | ||
1404 | 1398 | ||
1405 | #ifdef SERIAL_DEBUG_OPEN | ||
1406 | printk("rs_close ttys%d, count = %d\n", state->line, port->count); | ||
1407 | #endif | ||
1408 | if ((tty->count == 1) && (port->count != 1)) { | ||
1409 | /* | ||
1410 | * Uh, oh. tty->count is 1, which means that the tty | ||
1411 | * structure will be freed. port->count should always | ||
1412 | * be one in these conditions. If it's greater than | ||
1413 | * one, we've got real problems, since it means the | ||
1414 | * serial port won't be shutdown. | ||
1415 | */ | ||
1416 | printk("rs_close: bad serial port count; tty->count is 1, " | ||
1417 | "port->count is %d\n", state->tport.count); | ||
1418 | port->count = 1; | ||
1419 | } | ||
1420 | if (--port->count < 0) { | ||
1421 | printk("rs_close: bad serial port count for ttys%d: %d\n", | ||
1422 | tty->index, port->count); | ||
1423 | port->count = 0; | ||
1424 | } | ||
1425 | if (port->count) { | ||
1426 | DBG_CNT("before DEC-2"); | ||
1427 | local_irq_restore(flags); | ||
1428 | return; | ||
1429 | } | ||
1430 | port->flags |= ASYNC_CLOSING; | ||
1431 | /* | ||
1432 | * Now we wait for the transmit buffer to clear; and we notify | ||
1433 | * the line discipline to only process XON/XOFF characters. | ||
1434 | */ | ||
1435 | tty->closing = 1; | ||
1436 | local_irq_restore(flags); | ||
1437 | if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) | ||
1438 | tty_wait_until_sent(tty, port->closing_wait); | ||
1439 | /* | 1399 | /* |
1440 | * At this point we stop accepting input. To do this, we | 1400 | * At this point we stop accepting input. To do this, we |
1441 | * disable the receive line status interrupts, and tell the | 1401 | * disable the receive line status interrupts, and tell the |