]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/tty/serial/crisv10.c
tty: localise the lock
[mirror_ubuntu-bionic-kernel.git] / drivers / tty / serial / crisv10.c
index 80b6b1b1f7257d3b1da80f1b58523e7465bdb36b..a770b10129621bd89dde272213ea052660e5103b 100644 (file)
@@ -955,7 +955,7 @@ static const struct control_pins e100_modem_pins[NR_PORTS] =
 /* Calculate the chartime depending on baudrate, numbor of bits etc. */
 static void update_char_time(struct e100_serial * info)
 {
-       tcflag_t cflags = info->port.tty->termios->c_cflag;
+       tcflag_t cflags = info->port.tty->termios.c_cflag;
        int bits;
 
        /* calc. number of bits / data byte */
@@ -1473,7 +1473,7 @@ rs_stop(struct tty_struct *tty)
                xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char,
                                STOP_CHAR(info->port.tty));
                xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop);
-               if (tty->termios->c_iflag & IXON ) {
+               if (tty->termios.c_iflag & IXON ) {
                        xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
                }
 
@@ -1496,7 +1496,7 @@ rs_start(struct tty_struct *tty)
                                         info->xmit.tail,SERIAL_XMIT_SIZE)));
                xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(tty));
                xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
-               if (tty->termios->c_iflag & IXON ) {
+               if (tty->termios.c_iflag & IXON ) {
                        xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
                }
 
@@ -2929,7 +2929,7 @@ shutdown(struct e100_serial * info)
                        descr[i].buf = 0;
                }
 
-       if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) {
+       if (!info->port.tty || (info->port.tty->termios.c_cflag & HUPCL)) {
                /* hang up DTR and RTS if HUPCL is enabled */
                e100_dtr(info, 0);
                e100_rts(info, 0); /* could check CRTSCTS before doing this */
@@ -2953,12 +2953,12 @@ change_speed(struct e100_serial *info)
        unsigned long flags;
        /* first some safety checks */
 
-       if (!info->port.tty || !info->port.tty->termios)
+       if (!info->port.tty)
                return;
        if (!info->ioport)
                return;
 
-       cflag = info->port.tty->termios->c_cflag;
+       cflag = info->port.tty->termios.c_cflag;
 
        /* possibly, the tx/rx should be disabled first to do this safely */
 
@@ -3088,7 +3088,7 @@ change_speed(struct e100_serial *info)
        info->ioport[REG_REC_CTRL] = info->rx_ctrl;
        xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->port.tty));
        xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
-       if (info->port.tty->termios->c_iflag & IXON ) {
+       if (info->port.tty->termios.c_iflag & IXON ) {
                DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n",
                                STOP_CHAR(info->port.tty)));
                xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
@@ -3355,7 +3355,7 @@ rs_throttle(struct tty_struct * tty)
        DFLOW(DEBUG_LOG(info->line,"rs_throttle %lu\n", tty->ldisc.chars_in_buffer(tty)));
 
        /* Do RTS before XOFF since XOFF might take some time */
-       if (tty->termios->c_cflag & CRTSCTS) {
+       if (tty->termios.c_cflag & CRTSCTS) {
                /* Turn off RTS line */
                e100_rts(info, 0);
        }
@@ -3377,7 +3377,7 @@ rs_unthrottle(struct tty_struct * tty)
        DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc %d\n", tty->ldisc.chars_in_buffer(tty)));
        DFLOW(DEBUG_LOG(info->line,"rs_unthrottle flip.count: %i\n", tty->flip.count));
        /* Do RTS before XOFF since XOFF might take some time */
-       if (tty->termios->c_cflag & CRTSCTS) {
+       if (tty->termios.c_cflag & CRTSCTS) {
                /* Assert RTS line  */
                e100_rts(info, 1);
        }
@@ -3748,7 +3748,7 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
 
        /* Handle turning off CRTSCTS */
        if ((old_termios->c_cflag & CRTSCTS) &&
-           !(tty->termios->c_cflag & CRTSCTS)) {
+           !(tty->termios.c_cflag & CRTSCTS)) {
                tty->hw_stopped = 0;
                rs_start(tty);
        }
@@ -3815,7 +3815,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
         * separate termios for callout and dialin.
         */
        if (info->flags & ASYNC_NORMAL_ACTIVE)
-               info->normal_termios = *tty->termios;
+               info->normal_termios = tty->termios;
        /*
         * Now we wait for the transmit buffer to clear; and we notify
         * the line discipline to only process XON/XOFF characters.
@@ -3976,7 +3976,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
         */
        if (tty_hung_up_p(filp) ||
            (info->flags & ASYNC_CLOSING)) {
-               wait_event_interruptible_tty(info->close_wait,
+               wait_event_interruptible_tty(tty, info->close_wait,
                        !(info->flags & ASYNC_CLOSING));
 #ifdef SERIAL_DO_RESTART
                if (info->flags & ASYNC_HUP_NOTIFY)
@@ -3998,7 +3998,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
                return 0;
        }
 
-       if (tty->termios->c_cflag & CLOCAL) {
+       if (tty->termios.c_cflag & CLOCAL) {
                        do_clocal = 1;
        }
 
@@ -4052,9 +4052,9 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
                printk("block_til_ready blocking: ttyS%d, count = %d\n",
                       info->line, info->count);
 #endif
-               tty_unlock();
+               tty_unlock(tty);
                schedule();
-               tty_lock();
+               tty_lock(tty);
        }
        set_current_state(TASK_RUNNING);
        remove_wait_queue(&info->open_wait, &wait);
@@ -4115,7 +4115,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
         */
        if (tty_hung_up_p(filp) ||
            (info->flags & ASYNC_CLOSING)) {
-               wait_event_interruptible_tty(info->close_wait,
+               wait_event_interruptible_tty(tty, info->close_wait,
                        !(info->flags & ASYNC_CLOSING));
 #ifdef SERIAL_DO_RESTART
                return ((info->flags & ASYNC_HUP_NOTIFY) ?
@@ -4219,7 +4219,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
        }
 
        if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) {
-               *tty->termios = info->normal_termios;
+               tty->termios = info->normal_termios;
                change_speed(info);
        }