Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 267288
b: refs/heads/master
c: 1f33a51
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Aug 23, 2011
1 parent 4e747bb commit 5d7ddd7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae8dbd3eb97aad3929a981d3ab8c3cd2caee4ab1
refs/heads/master: 1f33a51d9771b34be3cb6f7fb96a325e17bbac7b
30 changes: 7 additions & 23 deletions trunk/drivers/tty/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static struct lock_class_key port_lock_key;

static void uart_change_speed(struct tty_struct *tty, struct uart_state *state,
struct ktermios *old_termios);
static void __uart_wait_until_sent(struct uart_port *port, int timeout);
static void uart_wait_until_sent(struct tty_struct *tty, int timeout);
static void uart_change_pm(struct uart_state *state, int pm_state);

/*
Expand Down Expand Up @@ -1304,16 +1304,8 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
tty->closing = 1;
spin_unlock_irqrestore(&port->lock, flags);

if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) {
/*
* hack: open-coded tty_wait_until_sent to avoid
* recursive tty_lock
*/
long timeout = msecs_to_jiffies(port->closing_wait);
if (wait_event_interruptible_timeout(tty->write_wait,
!tty_chars_in_buffer(tty), timeout) >= 0)
__uart_wait_until_sent(uport, timeout);
}
if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
tty_wait_until_sent(tty, msecs_to_jiffies(port->closing_wait));

/*
* At this point, we stop accepting input. To do this, we
Expand All @@ -1329,7 +1321,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
* has completely drained; this is especially
* important if there is a transmit FIFO!
*/
__uart_wait_until_sent(uport, uport->timeout);
uart_wait_until_sent(tty, uport->timeout);
}

uart_shutdown(tty, state);
Expand Down Expand Up @@ -1363,8 +1355,10 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
mutex_unlock(&port->mutex);
}

static void __uart_wait_until_sent(struct uart_port *port, int timeout)
static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
{
struct uart_state *state = tty->driver_data;
struct uart_port *port = state->uart_port;
unsigned long char_time, expire;

if (port->type == PORT_UNKNOWN || port->fifosize == 0)
Expand Down Expand Up @@ -1416,16 +1410,6 @@ static void __uart_wait_until_sent(struct uart_port *port, int timeout)
}
}

static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
{
struct uart_state *state = tty->driver_data;
struct uart_port *port = state->uart_port;

tty_lock();
__uart_wait_until_sent(port, timeout);
tty_unlock();
}

/*
* This is called with the BKL held in
* linux/drivers/char/tty_io.c:do_tty_hangup()
Expand Down

0 comments on commit 5d7ddd7

Please sign in to comment.