On 10/21/21 13:44, Philippe Mathieu-Daudé wrote: > On 10/21/21 12:42, Peter Xu wrote: >> The pci_bus_fn is similar to pci_bus_dev_fn that only takes a PCIBus* and an >> opaque. The pci_bus_ret_fn is similar to pci_bus_fn but it allows to return >> a >> void* pointer. >> >> Use them where proper in pci.[ch], and to be used elsewhere. >> >> Signed-off-by: Peter Xu <pet...@redhat.com> >> --- >> hw/pci/pci.c | 6 ++---- >> include/hw/pci/pci.h | 12 +++++------- >> 2 files changed, 7 insertions(+), 11 deletions(-) > >> --- a/include/hw/pci/pci.h >> +++ b/include/hw/pci/pci.h >> @@ -402,6 +402,8 @@ OBJECT_DECLARE_TYPE(PCIBus, PCIBusClass, PCI_BUS) >> #define TYPE_PCIE_BUS "PCIE" >> >> typedef void (*pci_bus_dev_fn)(PCIBus *b, PCIDevice *d, void *opaque); >> +typedef void (*pci_bus_fn)(PCIBus *b, void *opaque); >> +typedef void* (*pci_bus_ret_fn)(PCIBus *b, void *opaque);
Now looking at patch #8, I wonder if it wouldn't be cleaner to have a single: /* * pci_bus_fn: * @bus: PCI bus * @opaque: Pointer to opaque pointer, can be used as input *and* output * Return #true on success, #false on failure */ typedef bool (*pci_bus_fn)(PCIBus *bus, void **opaque);