Skip to content

Commit 286d9b8

Browse files
andy-shevgregkh
authored andcommitted
serial: 8250: Use cached port name directly in messages
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@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b340cbb commit 286d9b8

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

drivers/tty/serial/8250/8250_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ static int univ8250_setup_irq(struct uart_8250_port *up)
323323
* the port is opened so this value needs to be preserved.
324324
*/
325325
if (up->bugs & UART_BUG_THRE) {
326-
pr_debug("ttyS%d - using backup timer\n", serial_index(port));
326+
pr_debug("%s - using backup timer\n", port->name);
327327

328328
up->timer.function = serial8250_backup_timeout;
329329
mod_timer(&up->timer, jiffies +

drivers/tty/serial/8250/8250_port.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,8 +1211,8 @@ static void autoconfig(struct uart_8250_port *up)
12111211
if (!port->iobase && !port->mapbase && !port->membase)
12121212
return;
12131213

1214-
DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04lx, 0x%p): ",
1215-
serial_index(port), port->iobase, port->membase);
1214+
DEBUG_AUTOCONF("%s: autoconf (0x%04lx, 0x%p): ",
1215+
port->name, port->iobase, port->membase);
12161216

12171217
/*
12181218
* We really do need global IRQs disabled here - we're going to
@@ -1363,9 +1363,8 @@ static void autoconfig(struct uart_8250_port *up)
13631363
fintek_8250_probe(up);
13641364

13651365
if (up->capabilities != old_capabilities) {
1366-
pr_warn("ttyS%d: detected caps %08x should be %08x\n",
1367-
serial_index(port), old_capabilities,
1368-
up->capabilities);
1366+
pr_warn("%s: detected caps %08x should be %08x\n",
1367+
port->name, old_capabilities, up->capabilities);
13691368
}
13701369
out:
13711370
DEBUG_AUTOCONF("iir=%d ", scratch);
@@ -2212,8 +2211,7 @@ int serial8250_do_startup(struct uart_port *port)
22122211
*/
22132212
if (!(port->flags & UPF_BUGGY_UART) &&
22142213
(serial_port_in(port, UART_LSR) == 0xff)) {
2215-
printk_ratelimited(KERN_INFO "ttyS%d: LSR safety check engaged!\n",
2216-
serial_index(port));
2214+
pr_info_ratelimited("%s: LSR safety check engaged!\n", port->name);
22172215
retval = -ENODEV;
22182216
goto out;
22192217
}
@@ -2245,8 +2243,8 @@ int serial8250_do_startup(struct uart_port *port)
22452243
(port->type == PORT_ALTR_16550_F128)) && (port->fifosize > 1)) {
22462244
/* Bounds checking of TX threshold (valid 0 to fifosize-2) */
22472245
if ((up->tx_loadsz < 2) || (up->tx_loadsz > port->fifosize)) {
2248-
pr_err("ttyS%d TX FIFO Threshold errors, skipping\n",
2249-
serial_index(port));
2246+
pr_err("%s TX FIFO Threshold errors, skipping\n",
2247+
port->name);
22502248
} else {
22512249
serial_port_out(port, UART_ALTR_AFR,
22522250
UART_ALTR_EN_TXFIFO_LW);
@@ -2343,8 +2341,8 @@ int serial8250_do_startup(struct uart_port *port)
23432341
if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT) {
23442342
if (!(up->bugs & UART_BUG_TXEN)) {
23452343
up->bugs |= UART_BUG_TXEN;
2346-
pr_debug("ttyS%d - enabling bad tx status workarounds\n",
2347-
serial_index(port));
2344+
pr_debug("%s - enabling bad tx status workarounds\n",
2345+
port->name);
23482346
}
23492347
} else {
23502348
up->bugs &= ~UART_BUG_TXEN;
@@ -2373,8 +2371,8 @@ int serial8250_do_startup(struct uart_port *port)
23732371
if (up->dma) {
23742372
retval = serial8250_request_dma(up);
23752373
if (retval) {
2376-
pr_warn_ratelimited("ttyS%d - failed to request DMA\n",
2377-
serial_index(port));
2374+
pr_warn_ratelimited("%s - failed to request DMA\n",
2375+
port->name);
23782376
up->dma = NULL;
23792377
}
23802378
}

0 commit comments

Comments
 (0)