USB: ftdi_sio: fix status line change handling for TIOCMIWAIT and TIOCGICOUNT
authorSimon Arlott <simon@fire.lp0.eu>
Mon, 26 Mar 2012 20:19:40 +0000 (21:19 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 30 Apr 2012 18:15:08 +0000 (19:15 +0100)
commitc88d5a08adf82b4cb976cf054398d16c34a62ede
treee86a79eea4d1c26312380f9f1bab8c543ce4b4e0
parentc7377b8132387045495b60a5e8257092f40f36c1
USB: ftdi_sio: fix status line change handling for TIOCMIWAIT and TIOCGICOUNT

BugLink: http://bugs.launchpad.net/bugs/987337

commit fca5430d48d53eaf103498c33fd0d1984b9f448b upstream.

Handling of TIOCMIWAIT was changed by commit 1d749f9afa657f6ee9336b2bc1fcd750a647d157
 USB: ftdi_sio.c: Use ftdi async_icount structure for TIOCMIWAIT, as in other drivers

FTDI_STATUS_B0_MASK does not indicate the changed modem status lines,
it indicates the value of the current modem status lines. An xor is
still required to determine which lines have changed.

The count was only being incremented if the line was high. The only
reason TIOCMIWAIT still worked was because the status packet is
repeated every 1ms, so the count was always changing. The wakeup
itself still ran based on the status lines changing.

This change fixes handling of updates to the modem status lines and
allows multiple processes to use TIOCMIWAIT concurrently.

Tested with two processes waiting on different status lines being
toggled independently.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Cc: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/usb/serial/ftdi_sio.c