qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] serial: reset state at startup


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 1/2] serial: reset state at startup
Date: Fri, 19 Sep 2014 14:57:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

Il 19/09/2014 11:17, Chen, Tiejun ha scritto:
> On 2014/9/19 16:54, Paolo Bonzini wrote:
>> When a serial port is started, its initial state is all zero.  Make
>> it consistent with reset state instead.
>>
>> Signed-off-by: Paolo Bonzini <address@hidden>
>> ---
>>   hw/char/serial.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/char/serial.c b/hw/char/serial.c
>> index 764e184..4523ccb 100644
>> --- a/hw/char/serial.c
>> +++ b/hw/char/serial.c
>> @@ -668,6 +668,7 @@ void serial_realize_core(SerialState *s, Error
>> **errp)
>>                             serial_event, s);
> 
> It should just follow qemu_register_reset(serial_reset, s).
> 
>>       fifo8_create(&s->recv_fifo, UART_FIFO_LENGTH);
>>       fifo8_create(&s->xmit_fifo, UART_FIFO_LENGTH);
>> +    serial_reset(s);
> 
> Or at least we should push this before this pair of fifo8_create() since

No, it should be _after_ the fifo8_create() pair.  With the current
implementation it doesn't matter, but first you create something and
then you initialize it, not the other way round.

Paolo

> static void serial_reset(void *opaque)
> {
>     ...
>     fifo8_reset(&s->recv_fifo);
>     fifo8_reset(&s->xmit_fifo);
> 
> 
> Thanks
> Tiejun
> 
>>   }
>>
>>   void serial_exit_core(SerialState *s)
>>
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]