qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 44/50] lasips2: implement lasips2_realize()


From: Peter Maydell
Subject: Re: [PATCH 44/50] lasips2: implement lasips2_realize()
Date: Thu, 9 Jun 2022 12:14:18 +0100

On Sun, 22 May 2022 at 19:20, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Move ps2_kbd_init() and ps2_mouse_init() from lasips2_initfn() to 
> lasips2_realize.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/input/lasips2.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
> index a7c7192c07..6849b71e5c 100644
> --- a/hw/input/lasips2.c
> +++ b/hw/input/lasips2.c
> @@ -256,13 +256,17 @@ LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq)
>      s = LASIPS2(dev);
>
>      s->irq = irq;
> +    return s;
> +}
> +
> +static void lasips2_realize(DeviceState *dev, Error **errp)
> +{
> +    LASIPS2State *s = LASIPS2(dev);
>
> -    vmstate_register(NULL, base, &vmstate_lasips2, s);
> +    vmstate_register(NULL, s->base, &vmstate_lasips2, s);
>
>      s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd);
>      s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse);
> -
> -    return s;
>  }
>
>  static void lasips2_init(Object *obj)
> @@ -292,6 +296,7 @@ static void lasips2_class_init(ObjectClass *klass, void 
> *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
>
> +    dc->realize = lasips2_realize;
>      device_class_set_props(dc, lasips2_properties);
>      set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
>  }

This is a valid refactoring, so in that sense
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

but I'd prefer it if we just broke migration compat for this machine
and converted it to use dc->vmsd rather than vmstate_register().

thanks
-- PMM



reply via email to

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