[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: Eduardo Habkost
Subject: Re: [Qemu-devel] [for-2.12 6/7] pci: Eliminate redundant PCIDevice::bus pointer
Date: Wed, 29 Nov 2017 09:41:09 -0200
User-agent: Mutt/1.9.1 (2017-09-22)

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.

Reviewed-by: Eduardo Habkost <address@hidden>


reply via email to

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