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

Commit 91f3541b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "serial: core: Fix crashes while echoing when closing"

parents 7e3a243c 2cb9c77b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1689,6 +1689,7 @@ static void pl011_shutdown(struct uart_port *port)
			plat->exit();
	}

	pl011_dma_flush_buffer(port);
}

static void
+15 −13
Original line number Diff line number Diff line
@@ -1802,6 +1802,20 @@ free_irq:
	return retval;
}

/*
 * Flush any TX data submitted for DMA. Called when the TX circular
 * buffer is reset.
 */
static void atmel_flush_buffer(struct uart_port *port)
{
	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);

	if (atmel_use_pdc_tx(port)) {
		UART_PUT_TCR(port, 0);
		atmel_port->pdc_tx.ofs = 0;
	}
}

/*
 * Disable the port
 */
@@ -1853,20 +1867,8 @@ static void atmel_shutdown(struct uart_port *port)
	atmel_free_gpio_irq(port);

	atmel_port->ms_irq_enabled = false;
}

/*
 * Flush any TX data submitted for DMA. Called when the TX circular
 * buffer is reset.
 */
static void atmel_flush_buffer(struct uart_port *port)
{
	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);

	if (atmel_use_pdc_tx(port)) {
		UART_PUT_TCR(port, 0);
		atmel_port->pdc_tx.ofs = 0;
	}
	atmel_flush_buffer(port);
}

/*
+16 −14
Original line number Diff line number Diff line
@@ -1034,6 +1034,20 @@ fail_rx_dma:
	return ret;
}

/*
 * Flush any TX data submitted for DMA and PIO. Called when the
 * TX circular buffer is reset.
 */
static void tegra_uart_flush_buffer(struct uart_port *u)
{
	struct tegra_uart_port *tup = to_tegra_uport(u);

	tup->tx_bytes = 0;
	if (tup->tx_dma_chan)
		dmaengine_terminate_all(tup->tx_dma_chan);
	return;
}

static void tegra_uart_shutdown(struct uart_port *u)
{
	struct tegra_uart_port *tup = to_tegra_uport(u);
@@ -1046,6 +1060,8 @@ static void tegra_uart_shutdown(struct uart_port *u)
	tegra_uart_dma_channel_free(tup, true);
	tegra_uart_dma_channel_free(tup, false);
	free_irq(u->irq, tup);

	tegra_uart_flush_buffer(u);
}

static void tegra_uart_enable_ms(struct uart_port *u)
@@ -1174,20 +1190,6 @@ static void tegra_uart_set_termios(struct uart_port *u,
	return;
}

/*
 * Flush any TX data submitted for DMA and PIO. Called when the
 * TX circular buffer is reset.
 */
static void tegra_uart_flush_buffer(struct uart_port *u)
{
	struct tegra_uart_port *tup = to_tegra_uport(u);

	tup->tx_bytes = 0;
	if (tup->tx_dma_chan)
		dmaengine_terminate_all(tup->tx_dma_chan);
	return;
}

static const char *tegra_uart_type(struct uart_port *u)
{
	return TEGRA_UART_TYPE;
+4 −5
Original line number Diff line number Diff line
@@ -1364,12 +1364,8 @@ static void uart_close(struct tty_struct *tty, struct file *filp)

	mutex_lock(&port->mutex);
	uart_shutdown(tty, state);
	uart_flush_buffer(tty);

	tty_ldisc_flush(tty);

	tty_port_tty_set(port, NULL);
	tty->closing = 0;

	spin_lock_irqsave(&port->lock, flags);

	if (port->blocked_open) {
@@ -1394,6 +1390,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
	wake_up_interruptible(&port->close_wait);

	mutex_unlock(&port->mutex);

	tty_ldisc_flush(tty);
	tty->closing = 0;
}

static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
+2 −0
Original line number Diff line number Diff line
@@ -273,6 +273,8 @@ static void timbuart_shutdown(struct uart_port *port)
	dev_dbg(port->dev, "%s\n", __func__);
	free_irq(port->irq, uart);
	iowrite32(0, port->membase + TIMBUART_IER);

	timbuart_flush_buffer(port);
}

static int get_bindex(int baud)