Skip to content

Commit

Permalink
tty_port: Move hupcl handling
Browse files Browse the repository at this point in the history
Move the HUCPL handling from the end of close_port_start to the beginning
of close_port_end. What this actually does is change the ordering from

	port shutdown
	port->dtr_rts

to

	port->dtr_rts
	port shutdown

Some hardware drops the physical connection on shutdown so we must perform
the port operations before the shutdown.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Dec 11, 2009
1 parent edfacdd commit e707c35
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/char/tty_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,14 @@ int tty_port_close_start(struct tty_port *port,
timeout = 2 * HZ;
schedule_timeout_interruptible(timeout);
}
/* Flush the ldisc buffering */
tty_ldisc_flush(tty);

/* Drop DTR/RTS if HUPCL is set. This causes any attached modem to
hang up the line */
if (tty->termios->c_cflag & HUPCL)
tty_port_lower_dtr_rts(port);

/* Don't call port->drop for the last reference. Callers will want
to drop the last active reference in ->shutdown() or the tty
shutdown path */
Expand All @@ -350,11 +358,6 @@ void tty_port_close_end(struct tty_port *port, struct tty_struct *tty)
{
unsigned long flags;

tty_ldisc_flush(tty);

if (tty->termios->c_cflag & HUPCL)
tty_port_lower_dtr_rts(port);

spin_lock_irqsave(&port->lock, flags);
tty->closing = 0;

Expand Down

0 comments on commit e707c35

Please sign in to comment.