Since we have port name stored in struct uart_port, we better to use that one instead of open coding. This will make it one place source for easier maintenance or modifications. While here, replace printk_ratelimited(KERN_INFO ) by pr_info_ratelimited(). It seems last printk() call in 8250_port.c. Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> --- drivers/tty/serial/8250/8250_core.c | 2 +- drivers/tty/serial/8250/8250_port.c | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index aaedcac8cac7..b1b8bbcfb475 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -323,7 +323,7 @@ static int univ8250_setup_irq(struct uart_8250_port *up) * the port is opened so this value needs to be preserved. */ if (up->bugs & UART_BUG_THRE) { - pr_debug("ttyS%d - using backup timer\n", serial_index(port)); + pr_debug("%s - using backup timer\n", port->name); up->timer.function = serial8250_backup_timeout; mod_timer(&up->timer, jiffies + diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 00459cc3bf7a..a8c93a00a924 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1165,8 +1165,8 @@ static void autoconfig(struct uart_8250_port *up) if (!port->iobase && !port->mapbase && !port->membase) return; - DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04lx, 0x%p): ", - serial_index(port), port->iobase, port->membase); + DEBUG_AUTOCONF("%s: autoconf (0x%04lx, 0x%p): ", + port->name, port->iobase, port->membase); /* * We really do need global IRQs disabled here - we're going to @@ -1317,9 +1317,8 @@ static void autoconfig(struct uart_8250_port *up) fintek_8250_probe(up); if (up->capabilities != old_capabilities) { - pr_warn("ttyS%d: detected caps %08x should be %08x\n", - serial_index(port), old_capabilities, - up->capabilities); + pr_warn("%s: detected caps %08x should be %08x\n", + port->name, old_capabilities, up->capabilities); } out: DEBUG_AUTOCONF("iir=%d ", scratch); @@ -2166,8 +2165,7 @@ int serial8250_do_startup(struct uart_port *port) */ if (!(port->flags & UPF_BUGGY_UART) && (serial_port_in(port, UART_LSR) == 0xff)) { - printk_ratelimited(KERN_INFO "ttyS%d: LSR safety check engaged!\n", - serial_index(port)); + pr_info_ratelimited("%s: LSR safety check engaged!\n", port->name); retval = -ENODEV; goto out; } @@ -2199,8 +2197,8 @@ int serial8250_do_startup(struct uart_port *port) (port->type == PORT_ALTR_16550_F128)) && (port->fifosize > 1)) { /* Bounds checking of TX threshold (valid 0 to fifosize-2) */ if ((up->tx_loadsz < 2) || (up->tx_loadsz > port->fifosize)) { - pr_err("ttyS%d TX FIFO Threshold errors, skipping\n", - serial_index(port)); + pr_err("%s TX FIFO Threshold errors, skipping\n", + port->name); } else { serial_port_out(port, UART_ALTR_AFR, UART_ALTR_EN_TXFIFO_LW); @@ -2297,8 +2295,8 @@ int serial8250_do_startup(struct uart_port *port) if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT) { if (!(up->bugs & UART_BUG_TXEN)) { up->bugs |= UART_BUG_TXEN; - pr_debug("ttyS%d - enabling bad tx status workarounds\n", - serial_index(port)); + pr_debug("%s - enabling bad tx status workarounds\n", + port->name); } } else { up->bugs &= ~UART_BUG_TXEN; @@ -2330,8 +2328,8 @@ int serial8250_do_startup(struct uart_port *port) else retval = serial8250_request_dma(up); if (retval) { - pr_warn_ratelimited("ttyS%d - failed to request DMA\n", - serial_index(port)); + pr_warn_ratelimited("%s - failed to request DMA\n", + port->name); up->dma = NULL; } } -- 2.18.0 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html