Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163828
b: refs/heads/master
c: c146942
h: refs/heads/master
v: v3
  • Loading branch information
Alan Cox authored and Live-CD User committed Sep 19, 2009
1 parent 97182bd commit f277b1b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 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: 7ca0ff9ab3218ec443a7a9ad247e4650373ed41e
refs/heads/master: c146942573c84b16ccb480a9cfa885a7581585a8
47 changes: 26 additions & 21 deletions trunk/drivers/char/riscom8.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,20 +921,12 @@ static void rc_flush_buffer(struct tty_struct *tty)
tty_wakeup(tty);
}

static void rc_close(struct tty_struct *tty, struct file *filp)
static void rc_close_port(struct tty_struct *tty, struct tty_port *port)
{
struct riscom_port *port = tty->driver_data;
struct riscom_board *bp;
unsigned long flags;
struct riscom_port *rp = container_of(port, struct riscom_port, port);
struct riscom_board *bp = port_Board(rp);
unsigned long timeout;

if (!port || rc_paranoia_check(port, tty->name, "close"))
return;

bp = port_Board(port);

if (tty_port_close_start(&port->port, tty, filp) == 0)
return;

/*
* At this point we stop accepting input. To do this, we
Expand All @@ -944,29 +936,42 @@ static void rc_close(struct tty_struct *tty, struct file *filp)
*/

spin_lock_irqsave(&riscom_lock, flags);
port->IER &= ~IER_RXD;
if (port->port.flags & ASYNC_INITIALIZED) {
port->IER &= ~IER_TXRDY;
port->IER |= IER_TXEMPTY;
rc_out(bp, CD180_CAR, port_No(port));
rc_out(bp, CD180_IER, port->IER);
rp->IER &= ~IER_RXD;
if (port->flags & ASYNC_INITIALIZED) {
rp->IER &= ~IER_TXRDY;
rp->IER |= IER_TXEMPTY;
rc_out(bp, CD180_CAR, port_No(rp));
rc_out(bp, CD180_IER, rp->IER);
/*
* Before we drop DTR, make sure the UART transmitter
* has completely drained; this is especially
* important if there is a transmit FIFO!
*/
timeout = jiffies + HZ;
while (port->IER & IER_TXEMPTY) {
while (rp->IER & IER_TXEMPTY) {
spin_unlock_irqrestore(&riscom_lock, flags);
msleep_interruptible(jiffies_to_msecs(port->timeout));
msleep_interruptible(jiffies_to_msecs(rp->timeout));
spin_lock_irqsave(&riscom_lock, flags);
if (time_after(jiffies, timeout))
break;
}
}
rc_shutdown_port(tty, bp, port);
rc_flush_buffer(tty);
rc_shutdown_port(tty, bp, rp);
spin_unlock_irqrestore(&riscom_lock, flags);
}

static void rc_close(struct tty_struct *tty, struct file *filp)
{
struct riscom_port *port = tty->driver_data;

if (!port || rc_paranoia_check(port, tty->name, "close"))
return;

if (tty_port_close_start(&port->port, tty, filp) == 0)
return;

rc_close_port(tty, &port->port);
rc_flush_buffer(tty);

tty_port_close_end(&port->port, tty);
}
Expand Down

0 comments on commit f277b1b

Please sign in to comment.