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

Configure Feed

Select the types of activity you want to include in your feed.

serial: 8250_omap: extract omap_8250_set_termios_atomic()

To use guard()s easily in omap_8250_set_termios(), split it into atomic
and non-atomic part. The former can be easily guarded -- without a need
of indenting or moving code.

omap_8250_set_termios() would likely profit from a cleanup similar to
one in serial8250_do_set_termios() in commit cdc4a3e0b235 ("serial:
8250: extract serial8250_set_fcr()") and earlier.

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

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
302c8145 9a2225f2

+24 -15
+24 -15
drivers/tty/serial/8250/8250_omap.c
··· 369 369 serial8250_em485_stop_tx(up, true); 370 370 } 371 371 372 - /* 373 - * OMAP can use "CLK / (16 or 13) / div" for baud rate. And then we have have 374 - * some differences in how we want to handle flow control. 375 - */ 376 - static void omap_8250_set_termios(struct uart_port *port, 377 - struct ktermios *termios, 378 - const struct ktermios *old) 372 + static void omap_8250_set_termios_atomic(struct uart_port *port, struct ktermios *termios, 373 + const struct ktermios *old, unsigned int baud) 379 374 { 380 375 struct uart_8250_port *up = up_to_u8250p(port); 381 376 struct omap8250_priv *priv = port->private_data; 382 - unsigned char cval = 0; 383 - unsigned int baud; 377 + u8 cval; 384 378 385 379 cval = UART_LCR_WLEN(tty_get_char_size(termios->c_cflag)); 386 380 ··· 387 393 if (termios->c_cflag & CMSPAR) 388 394 cval |= UART_LCR_SPAR; 389 395 390 - /* 391 - * Ask the core to calculate the divisor for us. 392 - */ 393 - baud = uart_get_baud_rate(port, termios, old, 394 - port->uartclk / 16 / UART_DIV_MAX, 395 - port->uartclk / 13); 396 396 omap_8250_get_divisor(port, baud, priv); 397 397 398 398 /* ··· 506 518 uart_port_unlock_irq(&up->port); 507 519 pm_runtime_mark_last_busy(port->dev); 508 520 pm_runtime_put_autosuspend(port->dev); 521 + } 522 + 523 + /* 524 + * OMAP can use "CLK / (16 or 13) / div" for baud rate. And then we have have 525 + * some differences in how we want to handle flow control. 526 + */ 527 + static void omap_8250_set_termios(struct uart_port *port, 528 + struct ktermios *termios, 529 + const struct ktermios *old) 530 + { 531 + struct omap8250_priv *priv = port->private_data; 532 + unsigned int baud; 533 + 534 + /* 535 + * Ask the core to calculate the divisor for us. 536 + */ 537 + baud = uart_get_baud_rate(port, termios, old, 538 + port->uartclk / 16 / UART_DIV_MAX, 539 + port->uartclk / 13); 540 + 541 + omap_8250_set_termios_atomic(port, termios, old, baud); 509 542 510 543 /* calculate wakeup latency constraint */ 511 544 priv->calc_latency = USEC_PER_SEC * 64 * 8 / baud;