[PATCH 07/12] hw/char/serial: Remove redundant reset

Bernhard Beschow posted 12 patches 1 month, 1 week ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, "Cédric Le Goater" <clg@kaod.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, Richard Henderson <richard.henderson@linaro.org>, Helge Deller <deller@gmx.de>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
There is a newer version of this series
[PATCH 07/12] hw/char/serial: Remove redundant reset
Posted by Bernhard Beschow 1 month, 1 week ago
There is no need to invoke the reset method in realize since the reset
framework will do so anyway before the machine starts.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/char/serial.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/char/serial.c b/hw/char/serial.c
index 485b98f03f..0f3469a1e8 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -934,7 +934,6 @@ static void serial_realize(DeviceState *dev, Error **errp)
                              serial_event, serial_be_change, s, NULL, true);
     fifo8_create(&s->recv_fifo, UART_FIFO_LENGTH);
     fifo8_create(&s->xmit_fifo, UART_FIFO_LENGTH);
-    serial_reset(s);
 }
 
 static void serial_unrealize(DeviceState *dev)
-- 
2.53.0
Re: [PATCH 07/12] hw/char/serial: Remove redundant reset
Posted by Peter Maydell 1 month, 1 week ago
On Mon, 2 Mar 2026 at 22:03, Bernhard Beschow <shentey@gmail.com> wrote:
>
> There is no need to invoke the reset method in realize since the reset
> framework will do so anyway before the machine starts.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>  hw/char/serial.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index 485b98f03f..0f3469a1e8 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -934,7 +934,6 @@ static void serial_realize(DeviceState *dev, Error **errp)
>                               serial_event, serial_be_change, s, NULL, true);
>      fifo8_create(&s->recv_fifo, UART_FIFO_LENGTH);
>      fifo8_create(&s->xmit_fifo, UART_FIFO_LENGTH);
> -    serial_reset(s);
>  }

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

It would be nice to make this not do qemu_register_reset(),
though right now because it's a direct subtype of TYPE_DEVICE
that would imply having all the devices that directly
instantiate TYPE_SERIAL arranging to reset it in their own
reset methods.

thanks
-- PMM