qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 09/13] Add exit callback to DeviceInfo.


From: Christoph Egger
Subject: Re: [Qemu-devel] [PATCH 09/13] Add exit callback to DeviceInfo.
Date: Tue, 22 Sep 2009 12:06:22 +0200
User-agent: KMail/1.9.10

On Tuesday 22 September 2009 11:29:23 Gerd Hoffmann wrote:
> This adds a exit callback for device destruction to DeviceInfo, so
> we can hook cleanups into qdev device destruction.

This is not enough.
You need a childexit to allow devices to cleanup their children
in the device tree first.

Christoph

>
> Followup patches will put that into use.
>
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
>  hw/qdev.c |    2 ++
>  hw/qdev.h |    2 ++
>  2 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index 4931da1..a25245a 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -245,6 +245,8 @@ void qdev_free(DeviceState *dev)
>  #endif
>          if (dev->info->reset)
>              qemu_unregister_reset(dev->info->reset, dev);
> +        if (dev->info->exit)
> +            dev->info->exit(dev);
>      }
>      QLIST_REMOVE(dev, sibling);
>      qemu_free(dev);
> diff --git a/hw/qdev.h b/hw/qdev.h
> index c036aff..0db2d32 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -107,6 +107,7 @@ BusState *qdev_get_child_bus(DeviceState *dev, const
> char *name); /*** Device API.  ***/
>
>  typedef int (*qdev_initfn)(DeviceState *dev, DeviceInfo *info);
> +typedef int (*qdev_exitfn)(DeviceState *dev);
>
>  struct DeviceInfo {
>      const char *name;
> @@ -124,6 +125,7 @@ struct DeviceInfo {
>
>      /* Private to qdev / bus.  */
>      qdev_initfn init;
> +    qdev_exitfn exit;
>      BusInfo *bus_info;
>      struct DeviceInfo *next;
>  };



-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632





reply via email to

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