diff options
author | Govindraj.R <govindraj.raja@ti.com> | 2010-06-15 14:27:56 +0530 |
---|---|---|
committer | Sebastien Jan <s-jan@ti.com> | 2010-06-22 17:36:56 +0200 |
commit | cfb5f43613449b122cf493b7c07fd94952d3c1bb (patch) | |
tree | 72f3b6296786793d0b2902f3ae4182fc3d7d0f3d /drivers | |
parent | 1e8aa840fd0c3f7b3af0d7d4ffea62bcb5a6337f (diff) |
Serial: Hold an port lock while updating console.
To avoid any race condition while writing to console
hold the port lock while writing to console.
Instabilty can be seen in SMP system if port_lock is not held
and two cpu's try to update the console.
For example if there are two independent process running on
two cpu's both process are trying to print an message on console,
so console updation can done by both the process in doing so
both can lock up the console while updating UART_TX reg.
Thus while updating the console with an message using low level
uart_tx reg ensure a port_lock is held before updatng the console
and release the port_lock once updation is completed.
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/serial/omap-serial.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/serial/omap-serial.c b/drivers/serial/omap-serial.c index b40a9118e750..845c7f0a73c3 100644 --- a/drivers/serial/omap-serial.c +++ b/drivers/serial/omap-serial.c @@ -917,6 +917,7 @@ serial_omap_console_write(struct console *co, const char *s, struct uart_omap_port *up = serial_omap_console_ports[co->index]; unsigned int ier; + spin_lock(&up->port.lock); /* * First save the IER then disable the interrupts */ @@ -940,6 +941,8 @@ serial_omap_console_write(struct console *co, const char *s, */ if (up->msr_saved_flags) check_modem_status(up); + + spin_unlock(&up->port.lock); } static int __init |