[Top][All Lists]

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

Re: [Qemu-devel] [for-2.12 6/7] pci: Eliminate redundant PCIDevice::bus

From: Marcel Apfelbaum
Subject: Re: [Qemu-devel] [for-2.12 6/7] pci: Eliminate redundant PCIDevice::bus pointer
Date: Wed, 29 Nov 2017 16:43:56 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 29/11/2017 13:41, Eduardo Habkost wrote:
On Wed, Nov 29, 2017 at 12:54:04PM +0200, Marcel Apfelbaum wrote:
On 29/11/2017 10:46, David Gibson wrote:
The bus pointer in PCIDevice is basically redundant with QOM information.
It's always initialized to the qdev_get_parent_bus(), the only difference
is the type.

Therefore this patch eliminates the field, instead creating a pci_get_bus()
helper to do the type mangling to derive it conveniently from the QOM
Device object underneath.

Hi David,

I personally don't see why the caching of the bus bothers you.
It makes the code a little easier to read, but indeed is a duplication
of data; let's see what Michael has to say, is a matter of
taste I suppose.

I'm all for removing duplication of data because it makes the
code less fragile.  We don't even take care of clearing
pci_dev->bus when the device is removed from the bus, so there's
a window between unplugging a device and actually freeing the
object where pci_dev->bus can become a dangling pointer.

This is a good point.

Reviewed-by: Marcel Apfelbaum <address@hidden>


Reviewed-by: Eduardo Habkost <address@hidden>

reply via email to

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