Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: 8250_omap: use uart_port pointer when available

There are unnecessary "up->port." accesses on many places in 8250_omap.
"port" is avalable on most places, so instead simply use "port->".

And make port available in omap8250_restore_regs() too. It's used on
many places in there.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250611100319.186924-34-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
20ca8be9 0a6fb2dc

+27 -26
+27 -26
drivers/tty/serial/8250/8250_omap.c
··· 176 176 static void __omap8250_set_mctrl(struct uart_port *port, unsigned int mctrl) 177 177 { 178 178 struct uart_8250_port *up = up_to_u8250p(port); 179 - struct omap8250_priv *priv = up->port.private_data; 179 + struct omap8250_priv *priv = port->private_data; 180 180 u8 lcr; 181 181 182 182 serial8250_do_set_mctrl(port, mctrl); ··· 303 303 304 304 static void omap8250_restore_regs(struct uart_8250_port *up) 305 305 { 306 - struct omap8250_priv *priv = up->port.private_data; 306 + struct uart_port *port = &up->port; 307 + struct omap8250_priv *priv = port->private_data; 307 308 struct uart_8250_dma *dma = up->dma; 308 309 u8 mcr = serial8250_in_MCR(up); 309 310 310 311 /* Port locked to synchronize UART_IER access against the console. */ 311 - lockdep_assert_held_once(&up->port.lock); 312 + lockdep_assert_held_once(&port->lock); 312 313 313 314 if (dma && dma->tx_running) { 314 315 /* ··· 360 359 361 360 omap8250_update_mdr1(up, priv); 362 361 363 - __omap8250_set_mctrl(&up->port, up->port.mctrl); 362 + __omap8250_set_mctrl(port, port->mctrl); 364 363 365 364 serial_out(up, UART_OMAP_MDR3, priv->mdr3); 366 365 367 - if (up->port.rs485.flags & SER_RS485_ENABLED && 368 - up->port.rs485_config == serial8250_em485_config) 366 + if (port->rs485.flags & SER_RS485_ENABLED && 367 + port->rs485_config == serial8250_em485_config) 369 368 serial8250_em485_stop_tx(up, true); 370 369 } 371 370 ··· 378 377 const struct ktermios *old) 379 378 { 380 379 struct uart_8250_port *up = up_to_u8250p(port); 381 - struct omap8250_priv *priv = up->port.private_data; 380 + struct omap8250_priv *priv = port->private_data; 382 381 unsigned char cval = 0; 383 382 unsigned int baud; 384 383 ··· 419 418 * ignoring of characters only occurs if the bit is set 420 419 * in @ignore_status_mask as well. 421 420 */ 422 - up->port.read_status_mask = UART_LSR_OE | UART_LSR_DR; 421 + port->read_status_mask = UART_LSR_OE | UART_LSR_DR; 423 422 if (termios->c_iflag & INPCK) 424 - up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; 423 + port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; 425 424 if (termios->c_iflag & (IGNBRK | PARMRK)) 426 - up->port.read_status_mask |= UART_LSR_BI; 425 + port->read_status_mask |= UART_LSR_BI; 427 426 428 427 /* 429 428 * Characters to ignore 430 429 */ 431 - up->port.ignore_status_mask = 0; 430 + port->ignore_status_mask = 0; 432 431 if (termios->c_iflag & IGNPAR) 433 - up->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; 432 + port->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; 434 433 if (termios->c_iflag & IGNBRK) { 435 - up->port.ignore_status_mask |= UART_LSR_BI; 434 + port->ignore_status_mask |= UART_LSR_BI; 436 435 /* 437 436 * If we're ignoring parity and break indicators, 438 437 * ignore overruns too (for real raw support). 439 438 */ 440 439 if (termios->c_iflag & IGNPAR) 441 - up->port.ignore_status_mask |= UART_LSR_OE; 440 + port->ignore_status_mask |= UART_LSR_OE; 442 441 } 443 442 444 443 /* 445 444 * ignore all characters if CREAD is not set 446 445 */ 447 446 if ((termios->c_cflag & CREAD) == 0) 448 - up->port.ignore_status_mask |= UART_LSR_DR; 447 + port->ignore_status_mask |= UART_LSR_DR; 449 448 450 449 /* 451 450 * Modem status interrupts 452 451 */ 453 452 up->ier &= ~UART_IER_MSI; 454 - if (UART_ENABLE_MS(&up->port, termios->c_cflag)) 453 + if (UART_ENABLE_MS(port, termios->c_cflag)) 455 454 up->ier |= UART_IER_MSI; 456 455 457 456 up->lcr = cval; ··· 489 488 priv->xoff = termios->c_cc[VSTOP]; 490 489 491 490 priv->efr = 0; 492 - up->port.status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS | UPSTAT_AUTOXOFF); 491 + port->status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS | UPSTAT_AUTOXOFF); 493 492 494 - if (termios->c_cflag & CRTSCTS && up->port.flags & UPF_HARD_FLOW && 493 + if (termios->c_cflag & CRTSCTS && port->flags & UPF_HARD_FLOW && 495 494 !mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS) && 496 495 !mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_CTS)) { 497 496 /* Enable AUTOCTS (autoRTS is enabled when RTS is raised) */ 498 - up->port.status |= UPSTAT_AUTOCTS | UPSTAT_AUTORTS; 497 + port->status |= UPSTAT_AUTOCTS | UPSTAT_AUTORTS; 499 498 priv->efr |= UART_EFR_CTS; 500 - } else if (up->port.flags & UPF_SOFT_FLOW) { 499 + } else if (port->flags & UPF_SOFT_FLOW) { 501 500 /* 502 501 * OMAP rx s/w flow control is borked; the transmitter remains 503 502 * stuck off even if rx flow control is subsequently disabled ··· 509 508 * Transmit XON1, XOFF1 510 509 */ 511 510 if (termios->c_iflag & IXOFF) { 512 - up->port.status |= UPSTAT_AUTOXOFF; 511 + port->status |= UPSTAT_AUTOXOFF; 513 512 priv->efr |= OMAP_UART_SW_TX; 514 513 } 515 514 } ··· 771 770 uart_port_unlock_irq(port); 772 771 } 773 772 774 - enable_irq(up->port.irq); 773 + enable_irq(port->irq); 775 774 776 775 pm_runtime_mark_last_busy(port->dev); 777 776 pm_runtime_put_autosuspend(port->dev); ··· 798 797 up->ier = 0; 799 798 serial_out(up, UART_IER, 0); 800 799 uart_port_unlock_irq(port); 801 - disable_irq_nosync(up->port.irq); 800 + disable_irq_nosync(port->irq); 802 801 dev_pm_clear_wake_irq(port->dev); 803 802 804 803 serial8250_release_dma(up); ··· 1311 1310 static int omap_8250_dma_handle_irq(struct uart_port *port) 1312 1311 { 1313 1312 struct uart_8250_port *up = up_to_u8250p(port); 1314 - struct omap8250_priv *priv = up->port.private_data; 1313 + struct omap8250_priv *priv = port->private_data; 1315 1314 u16 status; 1316 1315 u8 iir; 1317 1316 ··· 1333 1332 1334 1333 serial8250_modem_status(up); 1335 1334 if (status & UART_LSR_THRE && up->dma->tx_err) { 1336 - if (uart_tx_stopped(&up->port) || 1337 - kfifo_is_empty(&up->port.state->port.xmit_fifo)) { 1335 + if (uart_tx_stopped(port) || 1336 + kfifo_is_empty(&port->state->port.xmit_fifo)) { 1338 1337 up->dma->tx_err = 0; 1339 1338 serial8250_tx_chars(up); 1340 1339 } else {