qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 4/8] pci: Define pci_bus_fn/pci_bus_ret_fn type


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 4/8] pci: Define pci_bus_fn/pci_bus_ret_fn type
Date: Thu, 21 Oct 2021 14:54:44 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0

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 <peterx@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);




reply via email to

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