qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 10/33] serial: add "instance-id" property


From: Marc-André Lureau
Subject: Re: [PATCH v3 10/33] serial: add "instance-id" property
Date: Wed, 20 Nov 2019 13:06:59 +0400

Hi

On Wed, Oct 23, 2019 at 9:33 PM Marc-André Lureau
<address@hidden> wrote:
>
> This property will be used to move common vmstate registration to
> device realize in following patch.
>
> Signed-off-by: Marc-André Lureau <address@hidden>

I realize adding a "instance-id" property instead of calling
qdev_set_legacy_instance_id() manually doesn't really help.
Patch dropped.

> ---
>  hw/char/serial.c         | 3 +++
>  include/hw/char/serial.h | 1 +
>  2 files changed, 4 insertions(+)
>
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index 069d8715d0..0b61a71e4e 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -990,6 +990,7 @@ SerialState *serial_init(int base, qemu_irq irq, int 
> baudbase,
>      s->irq = irq;
>      qdev_prop_set_uint32(dev, "baudbase", baudbase);
>      qdev_prop_set_chr(dev, "chardev", chr);
> +    qdev_prop_set_int32(dev, "instance-id", base);
>      serial_realize_core(s, &error_fatal);
>      qdev_set_legacy_instance_id(dev, base, 2);
>      qdev_init_nofail(dev);
> @@ -1003,6 +1004,7 @@ SerialState *serial_init(int base, qemu_irq irq, int 
> baudbase,
>  static Property serial_properties[] = {
>      DEFINE_PROP_CHR("chardev", SerialState, chr),
>      DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200),
> +    DEFINE_PROP_INT32("instance-id", SerialState, instance_id, 0),
>      DEFINE_PROP_END_OF_LIST(),
>  };
>
> @@ -1073,6 +1075,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
>      s->irq = irq;
>      qdev_prop_set_uint32(dev, "baudbase", baudbase);
>      qdev_prop_set_chr(dev, "chardev", chr);
> +    qdev_prop_set_int32(dev, "instance-id", base);
>
>      serial_realize_core(s, &error_fatal);
>      qdev_set_legacy_instance_id(dev, base, 2);
> diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
> index 3dc618598e..b472c7cd57 100644
> --- a/include/hw/char/serial.h
> +++ b/include/hw/char/serial.h
> @@ -78,6 +78,7 @@ typedef struct SerialState {
>
>      QEMUTimer *modem_status_poll;
>      MemoryRegion io;
> +    int instance_id;
>  } SerialState;
>
>  extern const VMStateDescription vmstate_serial;
> --
> 2.23.0.606.g08da6496b6
>




reply via email to

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