tty: serial: st-asc: Make the locking RT aware
authorLionel Debieve <lionel.debieve@st.com>
Wed, 22 Mar 2017 17:12:31 +0000 (18:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 Mar 2017 13:29:05 +0000 (15:29 +0200)
The lock is a sleeping lock and local_irq_save() is not the
standard implementation now. Working for both -RT and non
RT.

Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/st-asc.c

index c334bcc59c649eedc2933ac29c4dc1ef45ae21d2..4889396d4c45e8f983bac348b59b59ea22c442a4 100644 (file)
@@ -887,13 +887,12 @@ static void asc_console_write(struct console *co, const char *s, unsigned count)
        int locked = 1;
        u32 intenable;
 
-       local_irq_save(flags);
        if (port->sysrq)
                locked = 0; /* asc_interrupt has already claimed the lock */
        else if (oops_in_progress)
-               locked = spin_trylock(&port->lock);
+               locked = spin_trylock_irqsave(&port->lock, flags);
        else
-               spin_lock(&port->lock);
+               spin_lock_irqsave(&port->lock, flags);
 
        /*
         * Disable interrupts so we don't get the IRQ line bouncing
@@ -911,8 +910,7 @@ static void asc_console_write(struct console *co, const char *s, unsigned count)
        asc_out(port, ASC_INTEN, intenable);
 
        if (locked)
-               spin_unlock(&port->lock);
-       local_irq_restore(flags);
+               spin_unlock_irqrestore(&port->lock, flags);
 }
 
 static int asc_console_setup(struct console *co, char *options)