Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1605756

[PATCH RT] tty: serial: st-asc: Make the locking RT aware

From <lionel.debieve@st.com>
Newsgroups linux.kernel
Subject [PATCH RT] tty: serial: st-asc: Make the locking RT aware
Date 2017-03-21 17:10 +0100
Message-ID <tnuw9-5FD-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Lionel Debieve <lionel.debieve@st.com>

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>
---
 drivers/tty/serial/st-asc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index 379e5bd..1815423 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -803,13 +803,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
@@ -827,8 +826,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)
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH RT] tty: serial: st-asc: Make the locking RT aware <lionel.debieve@st.com> - 2017-03-21 17:10 +0100
  Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Steven Rostedt <rostedt@goodmis.org> - 2017-03-21 19:50 +0100
    Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Thomas Gleixner <tglx@linutronix.de> - 2017-03-21 20:00 +0100
      Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Steven Rostedt <rostedt@goodmis.org> - 2017-03-21 21:20 +0100
        Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Lionel DEBIEVE <lionel.debieve@st.com> - 2017-03-22 09:50 +0100
          RE: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Lionel DEBIEVE <lionel.debieve@st.com> - 2017-03-22 17:20 +0100
          Re: [PATCH RT] tty: serial: st-asc: Make the locking RT aware Steven Rostedt <rostedt@goodmis.org> - 2017-03-22 17:20 +0100

csiph-web