Patchwork Re: hw/serial.c: Xmit fifo never used

login
register
mail settings
Submitter Frank Mehnert
Date May 26, 2010, 11:06 a.m.
Message ID <201005261306.07673.frank.mehnert@sun.com>
Download mbox | patch
Permalink /patch/53608/
State New
Headers show

Comments

Frank Mehnert - May 26, 2010, 11:06 a.m.
On Wednesday 26 May 2010, Jan Kiszka wrote:
> Frank Mehnert wrote:
> > I assume the correct condition would be '>= 0', that is
> >
> >         ...
> >         if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
> >             s->tsr_retry++;
> >         ...
>
> Makes sense, patch welcome.

Attached.

Kind regards,

Frank
Jan Kiszka - May 26, 2010, 11:16 a.m.
Frank Mehnert wrote:
> On Wednesday 26 May 2010, Jan Kiszka wrote:
>> Frank Mehnert wrote:
>>> I assume the correct condition would be '>= 0', that is
>>>
>>>         ...
>>>         if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
>>>             s->tsr_retry++;
>>>         ...
>> Makes sense, patch welcome.
> 
> Attached.

Signed-off, subject, and description please. And I would keep Stefano as
the original author of this feature in CC. A cross-check by him might be
good as we enable a code path that was apparently dead so far.

Thanks,
Jan
Stefano Stabellini - May 26, 2010, 11:42 a.m.
On Wed, 26 May 2010, Jan Kiszka wrote:
> Frank Mehnert wrote:
> > On Wednesday 26 May 2010, Jan Kiszka wrote:
> >> Frank Mehnert wrote:
> >>> I assume the correct condition would be '>= 0', that is
> >>>
> >>>         ...
> >>>         if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
> >>>             s->tsr_retry++;
> >>>         ...
> >> Makes sense, patch welcome.
> > 
> > Attached.
> 
> Signed-off, subject, and description please. And I would keep Stefano as
> the original author of this feature in CC. A cross-check by him might be
> good as we enable a code path that was apparently dead so far.
> 

I think the patch is correct.

Patch

diff --git a/hw/serial.c b/hw/serial.c
index 9102edb..0b1550b 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -327,7 +327,7 @@  static void serial_xmit(void *opaque)
         /* in loopback mode, say that we just received a char */
         serial_receive1(s, &s->tsr, 1);
     } else if (qemu_chr_write(s->chr, &s->tsr, 1) != 1) {
-        if ((s->tsr_retry > 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
+        if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
             s->tsr_retry++;
             qemu_mod_timer(s->transmit_timer,  new_xmit_ts + s->char_transmit_time);
             return;