fix serial locking
PATCH 1/1 fix serial locking
Hi Keir, I'm having trouble with the serial locking patch from a couple weeks ago, specifically serial_getc():
spin_lock_irqsave(&port->lock, flags);
...
if ( port->driver->getc(port, &c) )
break;
spin_unlock_irqrestore(&port->lock, flags);That leaves port->lock locked, as soon as the first char is successfully received. This patch fixes it for me:
drivers/char/serial.c 2005-06-15 15:54:11 -05:00 renamed from xen/drivers/char/serial.c 2005-06-10 13:20:06 -05:00 +6 -2
@@ -171,6 +171,8 @@ do { for ( ; ; ) { + int received; + spin_lock_irqsave(&port->lock, flags); if ( port->rxbufp != port->rxbufc )
@@ -179,10 +181,12 @@ break; } - if ( port->driver->getc(port, &c) ) - break; + received = port->driver->getc(port, &c); spin_unlock_irqrestore(&port->lock, flags); + + if (received) + break; cpu_relax(); }
Signed-off-by Hollis Blanchard <[email protected]>
Should I take this to mean that almost nobody uses serial console?
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 1 line · Hollis Blanchard
Should I take this to mean that almost nobody uses serial console?
Noone uses getc, apart from debuggers. We hardly ever use debuggers.
-- Keir