Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 299141
b: refs/heads/master
c: 876ae50
h: refs/heads/master
i:
  299139: bf77007
v: v3
  • Loading branch information
Simon Arlott authored and Greg Kroah-Hartman committed Apr 9, 2012
1 parent 5a1c3b5 commit 6bbf965
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 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: fca5430d48d53eaf103498c33fd0d1984b9f448b
refs/heads/master: 876ae50d94b02f3f523aa451b45ec5fb9c25d221
12 changes: 7 additions & 5 deletions trunk/drivers/usb/serial/ftdi_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct ftdi_private {
struct async_icount icount;
wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
char prev_status; /* Used for TIOCMIWAIT */
bool dev_gone; /* Used to abort TIOCMIWAIT */
char transmit_empty; /* If transmitter is empty or not */
struct usb_serial_port *port;
__u16 interface; /* FT2232C, FT2232H or FT4232H port interface
Expand Down Expand Up @@ -1681,6 +1682,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
init_waitqueue_head(&priv->delta_msr_wait);

priv->flags = ASYNC_LOW_LATENCY;
priv->dev_gone = false;

if (quirk && quirk->port_probe)
quirk->port_probe(priv);
Expand Down Expand Up @@ -1839,6 +1841,9 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port)

dbg("%s", __func__);

priv->dev_gone = true;
wake_up_interruptible_all(&priv->delta_msr_wait);

remove_sysfs_attrs(port);

kref_put(&priv->kref, ftdi_sio_priv_release);
Expand Down Expand Up @@ -2397,15 +2402,12 @@ static int ftdi_ioctl(struct tty_struct *tty,
*/
case TIOCMIWAIT:
cprev = priv->icount;
while (1) {
while (!priv->dev_gone) {
interruptible_sleep_on(&priv->delta_msr_wait);
/* see if a signal did it */
if (signal_pending(current))
return -ERESTARTSYS;
cnow = priv->icount;
if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
return -EIO; /* no change => error */
if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
Expand All @@ -2414,7 +2416,7 @@ static int ftdi_ioctl(struct tty_struct *tty,
}
cprev = cnow;
}
/* not reached */
return -EIO;
break;
case TIOCSERGETLSR:
return get_lsr_info(port, (struct serial_struct __user *)arg);
Expand Down

0 comments on commit 6bbf965

Please sign in to comment.