]> rtime.felk.cvut.cz Git - zynq/linux.git/blobdiff - drivers/tty/serial/amba-pl011.c
Apply preempt_rt patch-4.9-rt1.patch.xz
[zynq/linux.git] / drivers / tty / serial / amba-pl011.c
index e2c33b9528d82ed7a2c27d083d7b1d222da68178..53af53c43e8c2c558430a54929912e983d88e2f2 100644 (file)
@@ -2194,13 +2194,19 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
 
        clk_enable(uap->clk);
 
-       local_irq_save(flags);
+       /*
+        * local_irq_save(flags);
+        *
+        * This local_irq_save() is nonsense. If we come in via sysrq
+        * handling then interrupts are already disabled. Aside of
+        * that the port.sysrq check is racy on SMP regardless.
+       */
        if (uap->port.sysrq)
                locked = 0;
        else if (oops_in_progress)
-               locked = spin_trylock(&uap->port.lock);
+               locked = spin_trylock_irqsave(&uap->port.lock, flags);
        else
-               spin_lock(&uap->port.lock);
+               spin_lock_irqsave(&uap->port.lock, flags);
 
        /*
         *      First save the CR then disable the interrupts
@@ -2224,8 +2230,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
                pl011_write(old_cr, uap, REG_CR);
 
        if (locked)
-               spin_unlock(&uap->port.lock);
-       local_irq_restore(flags);
+               spin_unlock_irqrestore(&uap->port.lock, flags);
 
        clk_disable(uap->clk);
 }