Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354571
b: refs/heads/master
c: f40d781
h: refs/heads/master
i:
  354569: 44fb212
  354567: cc0e8fd
v: v3
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Jan 18, 2013
1 parent 96b8c19 commit 96e5ed4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 49 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: 263e1f9fbb999fb78df5bfed87ddbba1c12ee0f1
refs/heads/master: f40d781554ef5413d70254e422bc59d6538333d2
57 changes: 9 additions & 48 deletions trunk/drivers/usb/serial/io_ti.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,47 +521,6 @@ static int tx_active(struct edgeport_port *port)
return bytes_left;
}

static void chase_port(struct edgeport_port *port, unsigned long timeout)
{
struct tty_struct *tty = tty_port_tty_get(&port->port->port);
struct usb_serial *serial = port->port->serial;
wait_queue_t wait;
unsigned long flags;

if (!timeout)
timeout = (HZ * EDGE_CLOSING_WAIT)/100;

/* wait for data to drain from the buffer */
spin_lock_irqsave(&port->ep_lock, flags);
init_waitqueue_entry(&wait, current);
add_wait_queue(&tty->write_wait, &wait);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
if (kfifo_len(&port->write_fifo) == 0
|| timeout == 0 || signal_pending(current)
|| serial->disconnected)
/* disconnect */
break;
spin_unlock_irqrestore(&port->ep_lock, flags);
timeout = schedule_timeout(timeout);
spin_lock_irqsave(&port->ep_lock, flags);
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&tty->write_wait, &wait);
spin_unlock_irqrestore(&port->ep_lock, flags);
tty_kref_put(tty);

/* wait for data to drain from the device */
timeout += jiffies;
while ((long)(jiffies - timeout) < 0 && !signal_pending(current)
&& !serial->disconnected) {
/* not disconnected */
if (!tx_active(port))
break;
msleep(10);
}
}

static int choose_config(struct usb_device *dev)
{
/*
Expand Down Expand Up @@ -1955,8 +1914,6 @@ static void edge_close(struct usb_serial_port *port)
* this flag and dump add read data */
edge_port->close_pending = 1;

chase_port(edge_port, (HZ * closing_wait) / 100);

usb_kill_urb(port->read_urb);
usb_kill_urb(port->write_urb);
edge_port->ep_write_urb_in_use = 0;
Expand Down Expand Up @@ -2092,8 +2049,6 @@ static int edge_chars_in_buffer(struct tty_struct *tty)

if (edge_port == NULL)
return 0;
if (edge_port->close_pending == 1)
return 0;

spin_lock_irqsave(&edge_port->ep_lock, flags);
chars = kfifo_len(&edge_port->write_fifo);
Expand Down Expand Up @@ -2442,10 +2397,15 @@ static int get_serial_info(struct edgeport_port *edge_port,
struct serial_struct __user *retinfo)
{
struct serial_struct tmp;
unsigned cwait;

if (!retinfo)
return -EFAULT;

cwait = edge_port->port->port.closing_wait;
if (cwait != ASYNC_CLOSING_WAIT_NONE)
cwait = jiffies_to_msecs(closing_wait) / 10;

memset(&tmp, 0, sizeof(tmp));

tmp.type = PORT_16550A;
Expand All @@ -2456,7 +2416,7 @@ static int get_serial_info(struct edgeport_port *edge_port,
tmp.xmit_fifo_size = edge_port->port->bulk_out_size;
tmp.baud_base = 9600;
tmp.close_delay = 5*HZ;
tmp.closing_wait = closing_wait;
tmp.closing_wait = cwait;

if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
return -EFAULT;
Expand Down Expand Up @@ -2511,8 +2471,7 @@ static void edge_break(struct tty_struct *tty, int break_state)
int status;
int bv = 0; /* Off */

/* chase the port close */
chase_port(edge_port, 0);
tty_wait_until_sent(tty, 0);

if (break_state == -1)
bv = 1; /* On */
Expand Down Expand Up @@ -2585,6 +2544,8 @@ static int edge_port_probe(struct usb_serial_port *port)
return ret;
}

port->port.closing_wait = msecs_to_jiffies(closing_wait * 10);

return 0;
}

Expand Down

0 comments on commit 96e5ed4

Please sign in to comment.