• Simon Arlott's avatar
    USB: ftdi_sio: fix status line change handling for TIOCMIWAIT and TIOCGICOUNT · fca5430d
    Simon Arlott authored
    Handling of TIOCMIWAIT was changed by commit 1d749f9a
     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: default avatarSimon Arlott <simon@fire.lp0.eu>
    Cc: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    fca5430d
ftdi_sio.c 86.2 KB