qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 12/13] pci: move unregister from PCIDevice to PC


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 12/13] pci: move unregister from PCIDevice to PCIDeviceInfo
Date: Wed, 23 Sep 2009 18:58:45 +0300
User-agent: Mutt/1.5.19 (2009-01-05)

On Tue, Sep 22, 2009 at 11:29:26AM +0200, Gerd Hoffmann wrote:
> diff --git a/hw/pci.c b/hw/pci.c
> index a6cd630..3221a6c 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -26,6 +26,7 @@
>  #include "monitor.h"
>  #include "net.h"
>  #include "sysemu.h"
> +#include "msix.h"
>  
>  //#define DEBUG_PCI
>  #ifdef DEBUG_PCI
> @@ -402,13 +403,15 @@ static void pci_unregister_io_regions(PCIDevice 
> *pci_dev)
>  static int pci_unregister_device(DeviceState *dev)
>  {
>      PCIDevice *pci_dev = DO_UPCAST(PCIDevice, qdev, dev);
> +    PCIDeviceInfo *info = DO_UPCAST(PCIDeviceInfo, qdev, dev->info);
>      int ret = 0;
>  
> -    if (pci_dev->unregister)
> -        ret = pci_dev->unregister(pci_dev);
> +    if (info->exit)
> +        ret = info->exit(pci_dev);
>      if (ret)
>          return ret;
>  
> +    msix_uninit(pci_dev);
>      pci_unregister_io_regions(pci_dev);
>  
>      qemu_free_irqs(pci_dev->irq);

Since devices call msix_add, I think it is cleaner to have them
uninit it as well in their exit routines.

-- 
MST




reply via email to

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