[Top][All Lists]
[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: |
Tue, 29 Sep 2009 17:50:46 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On Fri, Sep 25, 2009 at 09:49:16AM +0200, Gerd Hoffmann wrote:
> Hi,
>
>>> static int pci_unregister_device(DeviceState *dev)
>
>>> + msix_uninit(pci_dev);
>
>> Since devices call msix_add, I think it is cleaner to have them
>> uninit it as well in their exit routines.
>
> Would work too. But this way you can't miss the msix_uninit() call by
> accident.
What kind of accident? We don't want a garbage collector in here, do we?
> It also saves a few lines of code. msix_uninit() carefully
> checks whenever msix is actually enabled and it is slow path, so calling
> it on non-msix devices isn't a big deal IMHO.
>
> cheers,
> Gerd
Yes, it works, but I find it confusing: IMO init and uninit being in
separate modules just makes code impossible to figure out. For example,
if there's a failure adding the device, device has to call msix_uninit
itself, and IMO it's better to have error handling and cleanup in sync.
--
MST
- [Qemu-devel] [PATCH 10/13] Implement scsi device destruction, (continued)
- [Qemu-devel] [PATCH 10/13] Implement scsi device destruction, Gerd Hoffmann, 2009/09/22
- Re: [Qemu-devel] [PATCH 10/13] Implement scsi device destruction, Markus Armbruster, 2009/09/24
- Re: [Qemu-devel] [PATCH 10/13] Implement scsi device destruction, Gerd Hoffmann, 2009/09/25
- Re: [Qemu-devel] [PATCH 10/13] Implement scsi device destruction, Markus Armbruster, 2009/09/25
- Re: [Qemu-devel] [PATCH 10/13] Implement scsi device destruction, Gerd Hoffmann, 2009/09/25
- Re: [Qemu-devel] [PATCH 10/13] Implement scsi device destruction, Artyom Tarasenko, 2009/09/25
- Re: [Qemu-devel] [PATCH 10/13] Implement scsi device destruction, Markus Armbruster, 2009/09/25
[Qemu-devel] [PATCH 12/13] pci: move unregister from PCIDevice to PCIDeviceInfo, Gerd Hoffmann, 2009/09/22
[Qemu-devel] [PATCH 09/13] Add exit callback to DeviceInfo., Gerd Hoffmann, 2009/09/22
[Qemu-devel] [PATCH 13/13] usb: hook unplug into qdev, cleanups + fixes., Gerd Hoffmann, 2009/09/22
[Qemu-devel] [PATCH 06/13] convert pci bridge to qdev, Gerd Hoffmann, 2009/09/22