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

Commit 5797ae36 authored by Stephane Chazelas's avatar Stephane Chazelas Committed by Linus Torvalds
Browse files

serial: MPSC: Stop rx engine when CREAD cleared



Currently, the MPSC driver doesn't stop recieving characters when the CREAD
flag in termios->c_cflag is cleared.  It should.  Also, only start receiving
if its not already started.

Signed-off-by: default avatarStephane Chazelas <stephane@artesyncp.com>
Signed-off-by: default avatarMark A. Greer <mgreer@mvista.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6c1ead5e
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -1520,7 +1520,6 @@ mpsc_set_termios(struct uart_port *port, struct ktermios *termios,
	mpsc_set_baudrate(pi, baud);

	/* Characters/events to read */
	pi->rcv_data = 1;
	pi->port.read_status_mask = SDMA_DESC_CMDSTAT_OR;

	if (termios->c_iflag & INPCK)
@@ -1544,11 +1543,15 @@ mpsc_set_termios(struct uart_port *port, struct ktermios *termios,
			pi->port.ignore_status_mask |= SDMA_DESC_CMDSTAT_OR;
	}

	/* Ignore all chars if CREAD not set */
	if (!(termios->c_cflag & CREAD))
		pi->rcv_data = 0;
	else
	if ((termios->c_cflag & CREAD)) {
		if (!pi->rcv_data) {
			pi->rcv_data = 1;
			mpsc_start_rx(pi);
		}
	} else if (pi->rcv_data) {
		mpsc_stop_rx(port);
		pi->rcv_data = 0;
	}

	spin_unlock_irqrestore(&pi->port.lock, flags);
	return;