diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-03-05 08:52:35 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 15:48:27 -0500 |
commit | 78e74d778a9b3ed80bb73b65ab16f842f48aa287 (patch) | |
tree | 1909da05d98ba3358f9406573af81d33e0b0439b | |
parent | 37343030458c0eea3f1093b09fc604d4f300eac7 (diff) |
TTY: simserial, use tty_port_close_start
I.e. remove more copied bloat.
The only change is that we wait_until_sent now. Which is what we
really should do.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | arch/ia64/hp/sim/simserial.c | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 53db99af43a2..2cd6d23dfdee 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c | |||
@@ -430,45 +430,12 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
430 | { | 430 | { |
431 | struct serial_state *info = tty->driver_data; | 431 | struct serial_state *info = tty->driver_data; |
432 | struct tty_port *port = &info->port; | 432 | struct tty_port *port = &info->port; |
433 | unsigned long flags; | ||
434 | 433 | ||
435 | if (!info) | 434 | if (!info) |
436 | return; | 435 | return; |
437 | 436 | ||
438 | local_irq_save(flags); | 437 | if (tty_port_close_start(port, tty, filp) == 0) |
439 | if (tty_hung_up_p(filp)) { | ||
440 | #ifdef SIMSERIAL_DEBUG | ||
441 | printk("rs_close: hung_up\n"); | ||
442 | #endif | ||
443 | local_irq_restore(flags); | ||
444 | return; | ||
445 | } | ||
446 | #ifdef SIMSERIAL_DEBUG | ||
447 | printk("rs_close ttys%d, count = %d\n", info->line, port->count); | ||
448 | #endif | ||
449 | if ((tty->count == 1) && (port->count != 1)) { | ||
450 | /* | ||
451 | * Uh, oh. tty->count is 1, which means that the tty | ||
452 | * structure will be freed. port->count should always | ||
453 | * be one in these conditions. If it's greater than | ||
454 | * one, we've got real problems, since it means the | ||
455 | * serial port won't be shutdown. | ||
456 | */ | ||
457 | printk(KERN_ERR "rs_close: bad serial port count; tty->count is 1, " | ||
458 | "port->count is %d\n", port->count); | ||
459 | port->count = 1; | ||
460 | } | ||
461 | if (--port->count < 0) { | ||
462 | printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n", | ||
463 | tty->index, port->count); | ||
464 | port->count = 0; | ||
465 | } | ||
466 | if (port->count) { | ||
467 | local_irq_restore(flags); | ||
468 | return; | 438 | return; |
469 | } | ||
470 | port->flags |= ASYNC_CLOSING; | ||
471 | local_irq_restore(flags); | ||
472 | 439 | ||
473 | /* | 440 | /* |
474 | * Now we wait for the transmit buffer to clear; and we notify | 441 | * Now we wait for the transmit buffer to clear; and we notify |
@@ -476,7 +443,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
476 | */ | 443 | */ |
477 | shutdown(tty, info); | 444 | shutdown(tty, info); |
478 | rs_flush_buffer(tty); | 445 | rs_flush_buffer(tty); |
479 | tty_ldisc_flush(tty); | ||
480 | port->tty = NULL; | 446 | port->tty = NULL; |
481 | 447 | ||
482 | tty_port_close_end(port, tty); | 448 | tty_port_close_end(port, tty); |