• Peter Hurley's avatar
    tty: Document locking for tty_port_open() · addd4672
    Peter Hurley authored
    The tty lock is held when the tty driver's open method is called
    (from the lone call-site, tty_open()). The call-tree audit [1] of
    tty_port_open() is a closed graph of the callers of tty_port_open();
    ie., all callers originate from only tty_open().
    
    Of these callers, none drop the tty lock.
    
    Also, document that tty_port_block_til_ready() may drop and reacquire
    the tty lock when blocking, which means the tty or tty_port may have
    changed state.
    
    [1]
    Call-tree audit of tty_port_open()
    
    tty_open()
      tty->ops->open() --+
                         |
            rs_open():arch/ia64/hp/sim/simserial.c
           *line_open():arch/um/drivers/line.c
            gdm_tty_open():drivers/staging/gdm724x/gdm_tty.c
            fwtty_open():drivers/staging/fwserial/fwserial.c
            acm_tty_open():drivers/usb/class/cdc-acm.c
            serial_open():drivers/usb/serial/usb-serial.c
            pti_tty_driver_open():drivers/misc/pti.c
            ipoctal_open():drivers/ipack/devices/ipoctal.c
            isicom_open():drivers/tty/isicom.c
            dashtty_open():drivers/tty/metag_da.c
            goldfish_tty_open():drivers/tty/goldfish.c
            ehv_bc_tty_open():drivers/tty/ehv_bytechan.c
            mxser_open():drivers/tty/mxser.c
            kgdb_nmi_tty_open():drivers/tty/serial/kgdb_nmi.c
            ifx_spi_open():drivers/tty/serial/ifx6x60.c
            smd_tty_open():drivers/tty/serial/msm_smd_tty.c
            ntty_open():drivers/tty/nozomi.c
            capinc_tty_open():drivers/isdn/capi/capi.c
            tpk_open():drivers/char/ttyprintk.c
            sdio_uart_open():drivers/mmc/card/sdio_uart.c
            rfcomm_tty_open():net/bluetooth/rfcomm/tty.c
                         |
                         +- tty_port_open()
    
    * line_open() is the .open method for 2 um drivers
      declared in ./arch/um/drivers/stdio_console.c and
      in ./arch/um/drivers/ssl.c, and not called directly
    Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    addd4672
tty_port.c 16 KB