forked from sonoble/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yet another uart race condition fix (sonic-net#75)
Signed-off-by: Guohan Lu <[email protected]>
- Loading branch information
Showing
1 changed file
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,11 @@ From: Guohan Lu <[email protected]> | |
|
||
this is complete the fix in a5ba1d95e46ecaea638ddd7cd144107c783acb5d | ||
--- | ||
drivers/tty/serial/serial_core.c | 6 ++++-- | ||
1 file changed, 4 insertions(+), 2 deletions(-) | ||
drivers/tty/serial/serial_core.c | 12 ++++++++---- | ||
1 file changed, 8 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c | ||
index 53e6db8..ec1187d 100644 | ||
index 53e6db8..c98a5d0 100644 | ||
--- a/drivers/tty/serial/serial_core.c | ||
+++ b/drivers/tty/serial/serial_core.c | ||
@@ -530,10 +530,12 @@ static int uart_put_char(struct tty_struct *tty, unsigned char c) | ||
|
@@ -26,3 +26,18 @@ index 53e6db8..ec1187d 100644 | |
if (port && uart_circ_chars_free(circ) != 0) { | ||
circ->buf[circ->head] = c; | ||
circ->head = (circ->head + 1) & (UART_XMIT_SIZE - 1); | ||
@@ -567,10 +569,12 @@ static int uart_write(struct tty_struct *tty, | ||
} | ||
|
||
circ = &state->xmit; | ||
- if (!circ->buf) | ||
+ port = uart_port_lock(state, flags); | ||
+ if (!circ->buf) { | ||
+ uart_port_unlock(port, flags); | ||
return 0; | ||
+ } | ||
|
||
- port = uart_port_lock(state, flags); | ||
while (port) { | ||
c = CIRC_SPACE_TO_END(circ->head, circ->tail, UART_XMIT_SIZE); | ||
if (count < c) |