This reverts commit da9a5aa3402db0ff3b57216d8dbf2478e1046cae. In order to ease backporting a fix for a sysrq regression, revert this rewrite which was since added on top. The other sysrq helpers now bail out early when sysrq is not enabled; it's better to keep that pattern here as well. Note that the __releases() attribute won't be needed after the follow-on fix either.
Unified · Split
| @@ -3239,19 +3239,22 @@ int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) · 3238 unmodified lines | ||
| 3239 | 3239 | } |
| 3240 | 3240 | EXPORT_SYMBOL_GPL(uart_prepare_sysrq_char); |
| 3241 | 3241 | |
| 3242 | −void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long flags) | |
| 3243 | −__releases(&port->lock) | |
| 3242 | +void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) | |
| 3244 | 3243 | { |
| 3245 | − if (port->has_sysrq) { | |
| 3246 | − int sysrq_ch = port->sysrq_ch; | |
| 3244 | + int sysrq_ch; | |
| 3247 | 3245 | |
| 3248 | − port->sysrq_ch = 0; | |
| 3249 | − spin_unlock_irqrestore(&port->lock, flags); | |
| 3250 | − if (sysrq_ch) | |
| 3251 | − handle_sysrq(sysrq_ch); | |
| 3252 | − } else { | |
| 3253 | − spin_unlock_irqrestore(&port->lock, flags); | |
| 3246 | + if (!port->has_sysrq) { | |
| 3247 | + spin_unlock_irqrestore(&port->lock, irqflags); | |
| 3248 | + return; | |
| 3254 | 3249 | } |
| 3250 | + | |
| 3251 | + sysrq_ch = port->sysrq_ch; | |
| 3252 | + port->sysrq_ch = 0; | |
| 3253 | + | |
| 3254 | + spin_unlock_irqrestore(&port->lock, irqflags); | |
| 3255 | + | |
| 3256 | + if (sysrq_ch) | |
| 3257 | + handle_sysrq(sysrq_ch); | |
| 3255 | 3258 | } |
| 3256 | 3259 | EXPORT_SYMBOL_GPL(uart_unlock_and_check_sysrq); |
| 3257 | 3260 | |
| @@ -464,7 +464,8 @@ extern void uart_insert_char(struct uart_port *port, unsigned int status, · 463 unmodified lines | ||
| 464 | 464 | |
| 465 | 465 | extern int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch); |
| 466 | 466 | extern int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch); |
| 467 | −extern void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long flags); | |
| 467 | +extern void uart_unlock_and_check_sysrq(struct uart_port *port, | |
| 468 | + unsigned long irqflags); | |
| 468 | 469 | extern int uart_handle_break(struct uart_port *port); |
| 469 | 470 | |
| 470 | 471 | /* |