Skip to contentSkip to conversation

char/serial: Fix emptyness handling

PATCH Applied Don Slutz 5 participants 6 messages Mar 18, 2014 – Apr 7, 2014

lore
Share & tools
lore

Don Slutz

author
#0 lore raw

PATCH v3 1/1 char/serial: Fix emptyness handling

The commit 88c1ee73d3231c74ff90bcfc084a7589670ec244 char/serial: Fix emptyness check

Still causes extra NULL byte(s) to be sent.

So if the fifo is empty, do not send an extra NULL byte.

---
Changes V2 to v3
Revert v2 changes
Fix coding style issues.
Changes v1 to v2
Do full state change on fifo8_is_empty.

 hw/char/serial.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/char/serial.c +4 -2
index 6d3b5af..f4d167f 100644
@@ -225,8 +225,10 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
 
     if (s->tsr_retry <= 0) {
         if (s->fcr & UART_FCR_FE) {
-            s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
-                        0 : fifo8_pop(&s->xmit_fifo);
+            if (fifo8_is_empty(&s->xmit_fifo)) {
+                return FALSE;
+            }
+            s->tsr = fifo8_pop(&s->xmit_fifo);
             if (!s->xmit_fifo.num) {
                 s->lsr |= UART_LSR_THRE;
             }
Signature · 1 line
1.8.4
author
#1 lore raw

Ping. (Since this is a bug fix, I think it can go into 2.0)
-Don Slutz

Quoted 37 lines · Don Slutz

The commit 88c1ee73d3231c74ff90bcfc084a7589670ec244 char/serial: Fix emptyness check

Still causes extra NULL byte(s) to be sent.

So if the fifo is empty, do not send an extra NULL byte.

---
Changes V2 to v3
Revert v2 changes
Fix coding style issues.
Changes v1 to v2
Do full state change on fifo8_is_empty.

  hw/char/serial.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
hw/char/serial.c +4 -2
index 6d3b5af..f4d167f 100644
@@ -225,8 +225,10 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
 
      if (s->tsr_retry <= 0) {
          if (s->fcr & UART_FCR_FE) {
-            s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
-                        0 : fifo8_pop(&s->xmit_fifo);
+            if (fifo8_is_empty(&s->xmit_fifo)) {
+                return FALSE;
+            }
+            s->tsr = fifo8_pop(&s->xmit_fifo);
              if (!s->xmit_fifo.num) {
                  s->lsr |= UART_LSR_THRE;
              }
#2 lore raw

Il 28/03/2014 12:43, Don Slutz ha scritto:

Quoted 2 lines

Ping. (Since this is a bug fix, I think it can go into 2.0)
-Don Slutz

I think the problem is that not many people understand the 8250 device model. CCing someone who hopefully does...

Paolo

Quoted 40 lines · Don Slutz
Quoted 36 lines

The commit 88c1ee73d3231c74ff90bcfc084a7589670ec244 char/serial: Fix emptyness check

Still causes extra NULL byte(s) to be sent.

So if the fifo is empty, do not send an extra NULL byte.

---
Changes V2 to v3
Revert v2 changes
Fix coding style issues.
Changes v1 to v2
Do full state change on fifo8_is_empty.

  hw/char/serial.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
hw/char/serial.c +4 -2
index 6d3b5af..f4d167f 100644
@@ -225,8 +225,10 @@ static gboolean serial_xmit(GIOChannel *chan,
 GIOCondition cond, void *opaque)
        if (s->tsr_retry <= 0) {
          if (s->fcr & UART_FCR_FE) {
-            s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
-                        0 : fifo8_pop(&s->xmit_fifo);
+            if (fifo8_is_empty(&s->xmit_fifo)) {
+                return FALSE;
+            }
+            s->tsr = fifo8_pop(&s->xmit_fifo);
              if (!s->xmit_fifo.num) {
                  s->lsr |= UART_LSR_THRE;
              }
#3 lore raw
Quoted 9 lines · Paolo Bonzini

Il 28/03/2014 12:43, Don Slutz ha scritto:

Quoted 2 lines

Ping. (Since this is a bug fix, I think it can go into 2.0)
-Don Slutz

I think the problem is that not many people understand the 8250 device model. CCing someone who hopefully does...

I have a bit of experience with 16550 :) Ill push for a merge on this one.

Regards,
Peter

Quoted 47 lines

Paolo

Quoted 42 lines · Don Slutz
Quoted 37 lines

The commit 88c1ee73d3231c74ff90bcfc084a7589670ec244 char/serial: Fix emptyness check

Still causes extra NULL byte(s) to be sent.

So if the fifo is empty, do not send an extra NULL byte.

---
Changes V2 to v3
Revert v2 changes
Fix coding style issues.
Changes v1 to v2
Do full state change on fifo8_is_empty.

  hw/char/serial.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
hw/char/serial.c +4 -2
index 6d3b5af..f4d167f 100644
@@ -225,8 +225,10 @@ static gboolean serial_xmit(GIOChannel *chan,
 GIOCondition cond, void *opaque)
        if (s->tsr_retry <= 0) {
          if (s->fcr & UART_FCR_FE) {
-            s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
-                        0 : fifo8_pop(&s->xmit_fifo);
+            if (fifo8_is_empty(&s->xmit_fifo)) {
+                return FALSE;
+            }
+            s->tsr = fifo8_pop(&s->xmit_fifo);
              if (!s->xmit_fifo.num) {
                  s->lsr |= UART_LSR_THRE;
              }
#4 lore raw
Quoted 5 lines · Peter Crosthwaite
Quoted 4 lines · Paolo Bonzini

Il 28/03/2014 12:43, Don Slutz ha scritto:

Quoted 2 lines

Ping. (Since this is a bug fix, I think it can go into 2.0)
-Don Slutz

Not sure what the exact standard is for 2.0 stuff... but changing the subject (to include something about 2.0) or CC'ing Peter Maydell may help get this into 2.0 (just did both ;)

Quoted 53 lines
Quoted 4 lines

I think the problem is that not many people understand the 8250 device model. CCing someone who hopefully does...

I have a bit of experience with 16550 :) Ill push for a merge on this one.

Regards,
Peter

Quoted 44 lines

Paolo

Quoted 40 lines · Don Slutz
Quoted 36 lines

The commit 88c1ee73d3231c74ff90bcfc084a7589670ec244 char/serial: Fix emptyness check

Still causes extra NULL byte(s) to be sent.

So if the fifo is empty, do not send an extra NULL byte.

---
Changes V2 to v3
Revert v2 changes
Fix coding style issues.
Changes v1 to v2
Do full state change on fifo8_is_empty.

  hw/char/serial.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
hw/char/serial.c +4 -2
index 6d3b5af..f4d167f 100644
@@ -225,8 +225,10 @@ static gboolean serial_xmit(GIOChannel *chan,
 GIOCondition cond, void *opaque)
        if (s->tsr_retry <= 0) {
          if (s->fcr & UART_FCR_FE) {
-            s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
-                        0 : fifo8_pop(&s->xmit_fifo);
+            if (fifo8_is_empty(&s->xmit_fifo)) {
+                return FALSE;
+            }
+            s->tsr = fifo8_pop(&s->xmit_fifo);
              if (!s->xmit_fifo.num) {
                  s->lsr |= UART_LSR_THRE;
              }
#5 lore raw
In reply to Peter Crosthwaite
Quoted 7 lines · Peter Crosthwaite
Quoted 6 lines · Paolo Bonzini

Il 28/03/2014 12:43, Don Slutz ha scritto:

Quoted 2 lines

Ping. (Since this is a bug fix, I think it can go into 2.0)
-Don Slutz

Quoted 5 lines
Quoted 3 lines

I think the problem is that not many people understand the 8250 device model. CCing someone who hopefully does...

I have a bit of experience with 16550 :) Ill push for a merge on this one.

Applied to master, thanks.

-- PMM