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: introduce RPM guard()s

Having this, guards like these work:
guard(serial8250_rpm)(up);
or
scoped_guard(serial8250_rpm, up) {
...
}

See e.g. "serial: 8250: use guard()s" later in this series.

And make them available to anyone (EXPORT + put in 8250.h) as drivers
open code this anyway.

The _tx ones are not defined as they would have no user.

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

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
9f8da7b2 0fd60b68

+9 -2
+5
drivers/tty/serial/8250/8250.h
··· 186 186 187 187 void serial8250_clear_and_reinit_fifos(struct uart_8250_port *p); 188 188 189 + void serial8250_rpm_get(struct uart_8250_port *p); 190 + void serial8250_rpm_put(struct uart_8250_port *p); 191 + DEFINE_GUARD(serial8250_rpm, struct uart_8250_port *, 192 + serial8250_rpm_get(_T), serial8250_rpm_put(_T)); 193 + 189 194 static inline u32 serial_dl_read(struct uart_8250_port *up) 190 195 { 191 196 return up->dl_read(up);
+4 -2
drivers/tty/serial/8250/8250_port.c
··· 508 508 } 509 509 EXPORT_SYMBOL_GPL(serial8250_clear_and_reinit_fifos); 510 510 511 - static void serial8250_rpm_get(struct uart_8250_port *p) 511 + void serial8250_rpm_get(struct uart_8250_port *p) 512 512 { 513 513 if (!(p->capabilities & UART_CAP_RPM)) 514 514 return; 515 515 pm_runtime_get_sync(p->port.dev); 516 516 } 517 + EXPORT_SYMBOL_GPL(serial8250_rpm_get); 517 518 518 - static void serial8250_rpm_put(struct uart_8250_port *p) 519 + void serial8250_rpm_put(struct uart_8250_port *p) 519 520 { 520 521 if (!(p->capabilities & UART_CAP_RPM)) 521 522 return; 522 523 pm_runtime_mark_last_busy(p->port.dev); 523 524 pm_runtime_put_autosuspend(p->port.dev); 524 525 } 526 + EXPORT_SYMBOL_GPL(serial8250_rpm_put); 525 527 526 528 /** 527 529 * serial8250_em485_init() - put uart_8250_port into rs485 emulating