diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2020-02-24 13:05:16 +0100 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2020-02-24 13:05:16 +0100 |
commit | 8be6754822fc0025f963e8216cf5cfe5cf01965d (patch) | |
tree | 76fce8f223ed0e9986d2f7ee8477182606f00862 /include/linux/serial_core.h | |
parent | 93bf1d7cbe98985ba4540b6889011ebbb742da5b (diff) | |
parent | 76e5c6fd6d163f1aa63969cc982e79be1fee87a7 (diff) |
Merge tag 'v4.4.214' into toradex_vf_4.4-next
This is the 4.4.214 stable release
Diffstat (limited to 'include/linux/serial_core.h')
-rw-r--r-- | include/linux/serial_core.h | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 297d4fa1cfe5..b5b527efeea0 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -159,6 +159,7 @@ struct uart_port { struct console *cons; /* struct console, if any */ #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(SUPPORT_SYSRQ) unsigned long sysrq; /* sysrq timeout */ + unsigned int sysrq_ch; /* char for sysrq */ #endif /* flags must be updated while holding port mutex */ @@ -440,8 +441,42 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) } return 0; } +static inline int +uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) +{ + if (port->sysrq) { + if (ch && time_before(jiffies, port->sysrq)) { + port->sysrq_ch = ch; + port->sysrq = 0; + return 1; + } + port->sysrq = 0; + } + return 0; +} +static inline void +uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) +{ + int sysrq_ch; + + sysrq_ch = port->sysrq_ch; + port->sysrq_ch = 0; + + spin_unlock_irqrestore(&port->lock, irqflags); + + if (sysrq_ch) + handle_sysrq(sysrq_ch); +} #else -#define uart_handle_sysrq_char(port,ch) ({ (void)port; 0; }) +static inline int +uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) { return 0; } +static inline int +uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) { return 0; } +static inline void +uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) +{ + spin_unlock_irqrestore(&port->lock, irqflags); +} #endif /* |