Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit adc8d746 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman
Browse files

tty: move the termios object into the tty



This will let us sort out a whole pile of tty related races. The
alternative would be to keep points and refcount the termios objects.
However
1. They are tiny anyway
2. Many devices don't use the stored copies
3. We can remove a pty special case

Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6d31a88c
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -338,7 +338,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
{
{
	/* Handle turning off CRTSCTS */
	/* Handle turning off CRTSCTS */
	if ((old_termios->c_cflag & CRTSCTS) &&
	if ((old_termios->c_cflag & CRTSCTS) &&
	    !(tty->termios->c_cflag & CRTSCTS)) {
	    !(tty->termios.c_cflag & CRTSCTS)) {
		tty->hw_stopped = 0;
		tty->hw_stopped = 0;
	}
	}
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -58,7 +58,7 @@ static int ath_wakeup_ar3k(struct tty_struct *tty)
		return status;
		return status;


	/* Disable Automatic RTSCTS */
	/* Disable Automatic RTSCTS */
	memcpy(&ktermios, tty->termios, sizeof(ktermios));
	ktermios = tty->termios;
	ktermios.c_cflag &= ~CRTSCTS;
	ktermios.c_cflag &= ~CRTSCTS;
	tty_set_termios(tty, &ktermios);
	tty_set_termios(tty, &ktermios);


+2 −2
Original line number Original line Diff line number Diff line
@@ -446,8 +446,8 @@ static void if_set_termios(struct tty_struct *tty, struct ktermios *old)
		goto out;
		goto out;
	}
	}


	iflag = tty->termios->c_iflag;
	iflag = tty->termios.c_iflag;
	cflag = tty->termios->c_cflag;
	cflag = tty->termios.c_cflag;
	old_cflag = old ? old->c_cflag : cflag;
	old_cflag = old ? old->c_cflag : cflag;
	gig_dbg(DEBUG_IF, "%u: iflag %x cflag %x old %x",
	gig_dbg(DEBUG_IF, "%u: iflag %x cflag %x old %x",
		cs->minor_index, iflag, cflag, old_cflag);
		cs->minor_index, iflag, cflag, old_cflag);
+8 −8
Original line number Original line Diff line number Diff line
@@ -1009,15 +1009,15 @@ isdn_tty_change_speed(modem_info *info)
		quot;
		quot;
	int i;
	int i;


	if (!port->tty || !port->tty->termios)
	if (!port->tty)
		return;
		return;
	cflag = port->tty->termios->c_cflag;
	cflag = port->tty->termios.c_cflag;


	quot = i = cflag & CBAUD;
	quot = i = cflag & CBAUD;
	if (i & CBAUDEX) {
	if (i & CBAUDEX) {
		i &= ~CBAUDEX;
		i &= ~CBAUDEX;
		if (i < 1 || i > 2)
		if (i < 1 || i > 2)
			port->tty->termios->c_cflag &= ~CBAUDEX;
			port->tty->termios.c_cflag &= ~CBAUDEX;
		else
		else
			i += 15;
			i += 15;
	}
	}
@@ -1097,7 +1097,7 @@ isdn_tty_shutdown(modem_info *info)
#endif
#endif
	isdn_unlock_drivers();
	isdn_unlock_drivers();
	info->msr &= ~UART_MSR_RI;
	info->msr &= ~UART_MSR_RI;
	if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) {
	if (!info->port.tty || (info->port.tty->termios.c_cflag & HUPCL)) {
		info->mcr &= ~(UART_MCR_DTR | UART_MCR_RTS);
		info->mcr &= ~(UART_MCR_DTR | UART_MCR_RTS);
		if (info->emu.mdmreg[REG_DTRHUP] & BIT_DTRHUP) {
		if (info->emu.mdmreg[REG_DTRHUP] & BIT_DTRHUP) {
			isdn_tty_modem_reset_regs(info, 0);
			isdn_tty_modem_reset_regs(info, 0);
@@ -1469,13 +1469,13 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
	if (!old_termios)
	if (!old_termios)
		isdn_tty_change_speed(info);
		isdn_tty_change_speed(info);
	else {
	else {
		if (tty->termios->c_cflag == old_termios->c_cflag &&
		if (tty->termios.c_cflag == old_termios->c_cflag &&
		    tty->termios->c_ispeed == old_termios->c_ispeed &&
		    tty->termios.c_ispeed == old_termios->c_ispeed &&
		    tty->termios->c_ospeed == old_termios->c_ospeed)
		    tty->termios.c_ospeed == old_termios->c_ospeed)
			return;
			return;
		isdn_tty_change_speed(info);
		isdn_tty_change_speed(info);
		if ((old_termios->c_cflag & CRTSCTS) &&
		if ((old_termios->c_cflag & CRTSCTS) &&
		    !(tty->termios->c_cflag & CRTSCTS))
		    !(tty->termios.c_cflag & CRTSCTS))
			tty->hw_stopped = 0;
			tty->hw_stopped = 0;
	}
	}
}
}
+10 −10
Original line number Original line Diff line number Diff line
@@ -518,7 +518,7 @@ static void sdio_uart_check_modem_status(struct sdio_uart_port *port)
	if (status & UART_MSR_DCTS) {
	if (status & UART_MSR_DCTS) {
		port->icount.cts++;
		port->icount.cts++;
		tty = tty_port_tty_get(&port->port);
		tty = tty_port_tty_get(&port->port);
		if (tty && (tty->termios->c_cflag & CRTSCTS)) {
		if (tty && (tty->termios.c_cflag & CRTSCTS)) {
			int cts = (status & UART_MSR_CTS);
			int cts = (status & UART_MSR_CTS);
			if (tty->hw_stopped) {
			if (tty->hw_stopped) {
				if (cts) {
				if (cts) {
@@ -671,12 +671,12 @@ static int sdio_uart_activate(struct tty_port *tport, struct tty_struct *tty)
	port->ier = UART_IER_RLSI|UART_IER_RDI|UART_IER_RTOIE|UART_IER_UUE;
	port->ier = UART_IER_RLSI|UART_IER_RDI|UART_IER_RTOIE|UART_IER_UUE;
	port->mctrl = TIOCM_OUT2;
	port->mctrl = TIOCM_OUT2;


	sdio_uart_change_speed(port, tty->termios, NULL);
	sdio_uart_change_speed(port, &tty->termios, NULL);


	if (tty->termios->c_cflag & CBAUD)
	if (tty->termios.c_cflag & CBAUD)
		sdio_uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR);
		sdio_uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR);


	if (tty->termios->c_cflag & CRTSCTS)
	if (tty->termios.c_cflag & CRTSCTS)
		if (!(sdio_uart_get_mctrl(port) & TIOCM_CTS))
		if (!(sdio_uart_get_mctrl(port) & TIOCM_CTS))
			tty->hw_stopped = 1;
			tty->hw_stopped = 1;


@@ -850,7 +850,7 @@ static void sdio_uart_throttle(struct tty_struct *tty)
{
{
	struct sdio_uart_port *port = tty->driver_data;
	struct sdio_uart_port *port = tty->driver_data;


	if (!I_IXOFF(tty) && !(tty->termios->c_cflag & CRTSCTS))
	if (!I_IXOFF(tty) && !(tty->termios.c_cflag & CRTSCTS))
		return;
		return;


	if (sdio_uart_claim_func(port) != 0)
	if (sdio_uart_claim_func(port) != 0)
@@ -861,7 +861,7 @@ static void sdio_uart_throttle(struct tty_struct *tty)
		sdio_uart_start_tx(port);
		sdio_uart_start_tx(port);
	}
	}


	if (tty->termios->c_cflag & CRTSCTS)
	if (tty->termios.c_cflag & CRTSCTS)
		sdio_uart_clear_mctrl(port, TIOCM_RTS);
		sdio_uart_clear_mctrl(port, TIOCM_RTS);


	sdio_uart_irq(port->func);
	sdio_uart_irq(port->func);
@@ -872,7 +872,7 @@ static void sdio_uart_unthrottle(struct tty_struct *tty)
{
{
	struct sdio_uart_port *port = tty->driver_data;
	struct sdio_uart_port *port = tty->driver_data;


	if (!I_IXOFF(tty) && !(tty->termios->c_cflag & CRTSCTS))
	if (!I_IXOFF(tty) && !(tty->termios.c_cflag & CRTSCTS))
		return;
		return;


	if (sdio_uart_claim_func(port) != 0)
	if (sdio_uart_claim_func(port) != 0)
@@ -887,7 +887,7 @@ static void sdio_uart_unthrottle(struct tty_struct *tty)
		}
		}
	}
	}


	if (tty->termios->c_cflag & CRTSCTS)
	if (tty->termios.c_cflag & CRTSCTS)
		sdio_uart_set_mctrl(port, TIOCM_RTS);
		sdio_uart_set_mctrl(port, TIOCM_RTS);


	sdio_uart_irq(port->func);
	sdio_uart_irq(port->func);
@@ -898,12 +898,12 @@ static void sdio_uart_set_termios(struct tty_struct *tty,
						struct ktermios *old_termios)
						struct ktermios *old_termios)
{
{
	struct sdio_uart_port *port = tty->driver_data;
	struct sdio_uart_port *port = tty->driver_data;
	unsigned int cflag = tty->termios->c_cflag;
	unsigned int cflag = tty->termios.c_cflag;


	if (sdio_uart_claim_func(port) != 0)
	if (sdio_uart_claim_func(port) != 0)
		return;
		return;


	sdio_uart_change_speed(port, tty->termios, old_termios);
	sdio_uart_change_speed(port, &tty->termios, old_termios);


	/* Handle transition to B0 status */
	/* Handle transition to B0 status */
	if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD))
	if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD))
Loading