hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/tty/serial/amba-pl011.c
....@@ -2191,18 +2191,24 @@
21912191 {
21922192 struct uart_amba_port *uap = amba_ports[co->index];
21932193 unsigned int old_cr = 0, new_cr;
2194
- unsigned long flags;
2194
+ unsigned long flags = 0;
21952195 int locked = 1;
21962196
21972197 clk_enable(uap->clk);
21982198
2199
- local_irq_save(flags);
2199
+ /*
2200
+ * local_irq_save(flags);
2201
+ *
2202
+ * This local_irq_save() is nonsense. If we come in via sysrq
2203
+ * handling then interrupts are already disabled. Aside of
2204
+ * that the port.sysrq check is racy on SMP regardless.
2205
+ */
22002206 if (uap->port.sysrq)
22012207 locked = 0;
22022208 else if (oops_in_progress)
2203
- locked = spin_trylock(&uap->port.lock);
2209
+ locked = spin_trylock_irqsave(&uap->port.lock, flags);
22042210 else
2205
- spin_lock(&uap->port.lock);
2211
+ spin_lock_irqsave(&uap->port.lock, flags);
22062212
22072213 /*
22082214 * First save the CR then disable the interrupts
....@@ -2228,8 +2234,7 @@
22282234 pl011_write(old_cr, uap, REG_CR);
22292235
22302236 if (locked)
2231
- spin_unlock(&uap->port.lock);
2232
- local_irq_restore(flags);
2237
+ spin_unlock_irqrestore(&uap->port.lock, flags);
22332238
22342239 clk_disable(uap->clk);
22352240 }