Commit a3911f6e authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by Greg Kroah-Hartman

serial: 8250: Add helper for clearing IER

A number of places want to clear IER with the same CAP_UUE trick.
Create a helper for that.
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220816120759.11552-1-ilpo.jarvinen@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5779a072
...@@ -752,6 +752,14 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep) ...@@ -752,6 +752,14 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
serial8250_rpm_put(p); serial8250_rpm_put(p);
} }
static void serial8250_clear_IER(struct uart_8250_port *up)
{
if (up->capabilities & UART_CAP_UUE)
serial_out(up, UART_IER, UART_IER_UUE);
else
serial_out(up, UART_IER, 0);
}
#ifdef CONFIG_SERIAL_8250_RSA #ifdef CONFIG_SERIAL_8250_RSA
/* /*
* Attempts to turn on the RSA FIFO. Returns zero on failure. * Attempts to turn on the RSA FIFO. Returns zero on failure.
...@@ -1329,10 +1337,7 @@ static void autoconfig(struct uart_8250_port *up) ...@@ -1329,10 +1337,7 @@ static void autoconfig(struct uart_8250_port *up)
serial8250_out_MCR(up, save_mcr); serial8250_out_MCR(up, save_mcr);
serial8250_clear_fifos(up); serial8250_clear_fifos(up);
serial_in(up, UART_RX); serial_in(up, UART_RX);
if (up->capabilities & UART_CAP_UUE) serial8250_clear_IER(up);
serial_out(up, UART_IER, UART_IER_UUE);
else
serial_out(up, UART_IER, 0);
out_unlock: out_unlock:
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
...@@ -2142,10 +2147,7 @@ static void serial8250_put_poll_char(struct uart_port *port, ...@@ -2142,10 +2147,7 @@ static void serial8250_put_poll_char(struct uart_port *port,
* First save the IER then disable the interrupts * First save the IER then disable the interrupts
*/ */
ier = serial_port_in(port, UART_IER); ier = serial_port_in(port, UART_IER);
if (up->capabilities & UART_CAP_UUE) serial8250_clear_IER(up);
serial_port_out(port, UART_IER, UART_IER_UUE);
else
serial_port_out(port, UART_IER, 0);
wait_for_xmitr(up, UART_LSR_BOTH_EMPTY); wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
/* /*
...@@ -3383,11 +3385,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, ...@@ -3383,11 +3385,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
* First save the IER then disable the interrupts * First save the IER then disable the interrupts
*/ */
ier = serial_port_in(port, UART_IER); ier = serial_port_in(port, UART_IER);
serial8250_clear_IER(up);
if (up->capabilities & UART_CAP_UUE)
serial_port_out(port, UART_IER, UART_IER_UUE);
else
serial_port_out(port, UART_IER, 0);
/* check scratch reg to see if port powered off during system sleep */ /* check scratch reg to see if port powered off during system sleep */
if (up->canary && (up->canary != serial_port_in(port, UART_SCR))) { if (up->canary && (up->canary != serial_port_in(port, UART_SCR))) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment