[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v2 3/6] pci: Rename and change signatures of pci_b
From: |
Cornelia Huck |
Subject: |
Re: [Qemu-devel] [RFC v2 3/6] pci: Rename and change signatures of pci_bus_new() & related functions |
Date: |
Wed, 19 Apr 2017 14:05:22 +0200 |
On Tue, 18 Apr 2017 22:42:07 -0300
Eduardo Habkost <address@hidden> wrote:
> On Wed, Apr 19, 2017 at 10:29:26AM +1000, David Gibson wrote:
> > On Tue, Apr 18, 2017 at 07:17:21PM -0300, Eduardo Habkost wrote:
> > > pci_bus_new*() and pci_register_bus() work only when the 'parent'
> > > argument is a PCI_HOST_BRIDGE object. Rename them to reflect that they
> > > are meant to initialize a bus that's in a PCI host bridge.
> > >
> > > The new function names are:
> > > * pci_host_bus_init() (replacing pci_bus_new())
> > > * pci_host_bus_init_inplace() (replacing pci_bus_new_inplace())
> > > * pci_host_bus_init_irqs() (replacing pci_register_bus())
> >
> > I like the idea, but I'm not terribly convinced by these names.
> > Aren't functions which allocate objects usually called whatever_new()
> > rather than whatever_init()? And pci_register_bus() appears to do
> > more than just initialize irqs.
>
> I agree the names aren't terribly clear. This is what they are
> supposed to mean:
>
> * pci_host_bus_init(phb) initializes phb->bus.
> * pci_host_bus_init(phb) initializes phb->bus using an
> already-allocated object.
> * pci_host_bus_init_irqs() does the same as pci_host_bus_init(),
> but also calls pci_bus_irqs().
>
> I plan to submit API documentation comments later. I am open to
> alternative name suggestions.
>
pci_host_bus_init_irqs() sounds as if it would only init irqs. What
about:
pci_host_bus_new()
pci_host_bus_new_inplace()
pci_host_bus_new_with_irqs()
(the last one might be a bit long, though, especially as it takes so
many arguments already)
- Re: [Qemu-devel] [RFC v2 1/6] pci: Inline pci_host_bus_register() inside pci_bus_init(), (continued)
Re: [Qemu-devel] [RFC v2 3/6] pci: Rename and change signatures of pci_bus_new() & related functions, Peter Maydell, 2017/04/19
[Qemu-devel] [RFC v2 5/6] pci: Set phb->bus inside pci_host_bus_init_inplace(), Eduardo Habkost, 2017/04/18
[Qemu-devel] [RFC v2 6/6] pci: Remove unnecessary PCIBus variables, Eduardo Habkost, 2017/04/18