qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 11/11] hw/misc/vmcoreinfo: Convert reset handler to DeviceRes


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 11/11] hw/misc/vmcoreinfo: Convert reset handler to DeviceReset
Date: Thu, 26 Sep 2019 18:02:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

On 9/26/19 5:17 PM, Philippe Mathieu-Daudé wrote:
> Convert the reset handler into a proper Device reset method.

Marc-André noticed this one is incorrect, because while being QDEV it is
not connected to a QBUS.

Maybe we can add a Device::unconnected property, and when set, the
parent realize() calls 'qemu_register_reset(dev->reset, dev);'?
This might look the same, but at least Devices implementations could
stop to use this function...

> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>  hw/misc/vmcoreinfo.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c
> index 326a3ce8f4..a1c4847cdf 100644
> --- a/hw/misc/vmcoreinfo.c
> +++ b/hw/misc/vmcoreinfo.c
> @@ -13,7 +13,6 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "qemu/module.h"
> -#include "sysemu/reset.h"
>  #include "hw/nvram/fw_cfg.h"
>  #include "migration/vmstate.h"
>  #include "hw/misc/vmcoreinfo.h"
> @@ -26,7 +25,7 @@ static void fw_cfg_vmci_write(void *dev, off_t offset, 
> size_t len)
>          && s->vmcoreinfo.guest_format != FW_CFG_VMCOREINFO_FORMAT_NONE;
>  }
>  
> -static void vmcoreinfo_reset(void *dev)
> +static void vmcoreinfo_reset(DeviceState *dev)
>  {
>      VMCoreInfoState *s = VMCOREINFO(dev);
>  
> @@ -61,7 +60,6 @@ static void vmcoreinfo_realize(DeviceState *dev, Error 
> **errp)
>                               NULL, fw_cfg_vmci_write, s,
>                               &s->vmcoreinfo, sizeof(s->vmcoreinfo), false);
>  
> -    qemu_register_reset(vmcoreinfo_reset, dev);
>      vmcoreinfo_state = s;
>  }
>  
> @@ -84,6 +82,7 @@ static void vmcoreinfo_device_class_init(ObjectClass 
> *klass, void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>  
>      dc->vmsd = &vmstate_vmcoreinfo;
> +    dc->reset = vmcoreinfo_reset;
>      dc->realize = vmcoreinfo_realize;
>      dc->hotpluggable = false;
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> 



reply via email to

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