tty/serial: atmel: Use uart_console() helper

Use uart_console() helper in instead of open coded variant.

Note, SERIAL_CORE_CONSOLE is selected by SERIAL_ATMEL_CONSOLE,
thus no functional changes expected.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Richard Genoud <richard.genoud@gmail.com>
Link: https://lore.kernel.org/r/20200310133057.86840-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Andy Shevchenko 2020-03-10 15:30:57 +02:00 committed by Greg Kroah-Hartman
parent cfb7bdfc69
commit 207f6f34fb
1 changed files with 5 additions and 15 deletions

View File

@ -2676,18 +2676,8 @@ static struct console atmel_console = {
#define ATMEL_CONSOLE_DEVICE (&atmel_console) #define ATMEL_CONSOLE_DEVICE (&atmel_console)
static inline bool atmel_is_console_port(struct uart_port *port)
{
return port->cons && port->cons->index == port->line;
}
#else #else
#define ATMEL_CONSOLE_DEVICE NULL #define ATMEL_CONSOLE_DEVICE NULL
static inline bool atmel_is_console_port(struct uart_port *port)
{
return false;
}
#endif #endif
static struct uart_driver atmel_uart = { static struct uart_driver atmel_uart = {
@ -2716,14 +2706,14 @@ static int atmel_serial_suspend(struct platform_device *pdev,
struct uart_port *port = platform_get_drvdata(pdev); struct uart_port *port = platform_get_drvdata(pdev);
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
if (atmel_is_console_port(port) && console_suspend_enabled) { if (uart_console(port) && console_suspend_enabled) {
/* Drain the TX shifter */ /* Drain the TX shifter */
while (!(atmel_uart_readl(port, ATMEL_US_CSR) & while (!(atmel_uart_readl(port, ATMEL_US_CSR) &
ATMEL_US_TXEMPTY)) ATMEL_US_TXEMPTY))
cpu_relax(); cpu_relax();
} }
if (atmel_is_console_port(port) && !console_suspend_enabled) { if (uart_console(port) && !console_suspend_enabled) {
/* Cache register values as we won't get a full shutdown/startup /* Cache register values as we won't get a full shutdown/startup
* cycle * cycle
*/ */
@ -2759,7 +2749,7 @@ static int atmel_serial_resume(struct platform_device *pdev)
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
unsigned long flags; unsigned long flags;
if (atmel_is_console_port(port) && !console_suspend_enabled) { if (uart_console(port) && !console_suspend_enabled) {
atmel_uart_writel(port, ATMEL_US_MR, atmel_port->cache.mr); atmel_uart_writel(port, ATMEL_US_MR, atmel_port->cache.mr);
atmel_uart_writel(port, ATMEL_US_IER, atmel_port->cache.imr); atmel_uart_writel(port, ATMEL_US_IER, atmel_port->cache.imr);
atmel_uart_writel(port, ATMEL_US_BRGR, atmel_port->cache.brgr); atmel_uart_writel(port, ATMEL_US_BRGR, atmel_port->cache.brgr);
@ -2913,7 +2903,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
goto err_add_port; goto err_add_port;
#ifdef CONFIG_SERIAL_ATMEL_CONSOLE #ifdef CONFIG_SERIAL_ATMEL_CONSOLE
if (atmel_is_console_port(&atmel_port->uart) if (uart_console(&atmel_port->uart)
&& ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) { && ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) {
/* /*
* The serial core enabled the clock for us, so undo * The serial core enabled the clock for us, so undo
@ -2956,7 +2946,7 @@ err_add_port:
kfree(atmel_port->rx_ring.buf); kfree(atmel_port->rx_ring.buf);
atmel_port->rx_ring.buf = NULL; atmel_port->rx_ring.buf = NULL;
err_alloc_ring: err_alloc_ring:
if (!atmel_is_console_port(&atmel_port->uart)) { if (!uart_console(&atmel_port->uart)) {
clk_put(atmel_port->clk); clk_put(atmel_port->clk);
atmel_port->clk = NULL; atmel_port->clk = NULL;
} }