[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 36/61] pci: use QLIST_ macro instead of direct l
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] Re: [PATCH 36/61] pci: use QLIST_ macro instead of direct list manipulation. |
Date: |
Wed, 30 Sep 2009 13:54:19 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On Wed, Sep 30, 2009 at 07:18:12PM +0900, Isaku Yamahata wrote:
> For maintenance, use QLIST_ macro instead of direct list implementation
> for PCIBus::next which implements singly linked list.
> This patch replace it with QLIST_ macro.
>
> Signed-off-by: Isaku Yamahata <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
> ---
> hw/pci.c | 16 +++++++---------
> 1 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index b358d80..757fe7b 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -45,7 +45,7 @@ struct PCIBus {
> void *irq_opaque;
> PCIDevice *devices[256];
> PCIDevice *parent_dev;
> - PCIBus *next;
> + QLIST_ENTRY(PCIBus) next;
> /* The bus IRQ state is the logical OR of the connected devices.
> Keep a count of the number of devices with raised IRQs. */
> int nirq;
> @@ -70,7 +70,7 @@ static void pci_set_irq(void *opaque, int irq_num, int
> level);
> target_phys_addr_t pci_mem_base;
> static uint16_t pci_default_sub_vendor_id = PCI_SUBVENDOR_ID_REDHAT_QUMRANET;
> static uint16_t pci_default_sub_device_id = PCI_SUBDEVICE_ID_QEMU;
> -static PCIBus *first_bus;
> +static QLIST_HEAD(, PCIBus) first_bus;
> static const VMStateDescription vmstate_pcibus = {
> .name = "PCIBUS",
> @@ -113,8 +113,7 @@ PCIBus *pci_register_bus(DeviceState *parent, const char
> *name,
> bus->devfn_min = devfn_min;
> bus->nirq = nirq;
> bus->irq_count = qemu_mallocz(nirq * sizeof(bus->irq_count[0]));
> - bus->next = first_bus;
> - first_bus = bus;
> + QLIST_INSERT_HEAD(&first_bus, bus, next);
> vmstate_register(nbus++, &vmstate_pcibus, bus);
> qemu_register_reset(pci_bus_reset, bus);
> return bus;
> @@ -129,8 +128,7 @@ static PCIBus *pci_register_secondary_bus(PCIDevice *dev,
> bus = FROM_QBUS(PCIBus, qbus_create(&pci_bus_info, &dev->qdev, name));
> bus->map_irq = map_irq;
> bus->parent_dev = dev;
> - bus->next = dev->bus->next;
> - dev->bus->next = bus;
> + QLIST_INSERT_AFTER(dev->bus, bus, next);
> return bus;
> }
>
> @@ -650,7 +648,7 @@ static PCIBus *pci_find_bus_from(PCIBus *from, int
> bus_num)
> PCIBus *s = from;
>
> while (s && s->bus_num != bus_num)
> - s = s->next;
> + s = QLIST_NEXT(s, next);
>
> return s;
> }
> @@ -1025,7 +1023,7 @@ static void pci_info_device(PCIDevice *d)
>
> void pci_for_each_device(int bus_num, void (*fn)(PCIDevice *d))
> {
> - PCIBus *bus = first_bus;
> + PCIBus *bus = QLIST_FIRST(&first_bus);
> PCIDevice *d;
> int devfn;
>
> @@ -1129,7 +1127,7 @@ static void pci_bridge_write_config(PCIDevice *d,
>
> PCIBus *pci_find_bus(int bus_num)
> {
> - return pci_find_bus_from(first_bus, bus_num);
> + return pci_find_bus_from(QLIST_FIRST(&first_bus), bus_num);
> }
>
> PCIDevice *pci_find_device(int bus_num, int slot, int function)
> --
> 1.6.0.2
>
>
- [Qemu-devel] [PATCH 49/61] pci hot add: pass opaque argument to callback., (continued)
- [Qemu-devel] [PATCH 49/61] pci hot add: pass opaque argument to callback., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 01/61] acpi: split out pc smbus routines from acpi.c into pc_smbus.c, Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 61/61] pc_q35: apic mode for pci interrupt routing., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 11/61] pc: introduce a function to allocate cpu irq., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 51/61] vmstate: add a macro for pointer to struct, VMSTATE_STRUCT_POINTER., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 54/61] pci: add opaque argument to pci_map_irq_fn()., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 30/61] pci_host.h: split non-inline static function in pci_host.h into pci_host_c.h, Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 37/61] pci: add helper function for pci config write function to check address., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 36/61] pci: use QLIST_ macro instead of direct list manipulation., Isaku Yamahata, 2009/09/30
- [Qemu-devel] Re: [PATCH 36/61] pci: use QLIST_ macro instead of direct list manipulation.,
Michael S. Tsirkin <=
- [Qemu-devel] [PATCH 22/61] pci: use appropriate PRIs in PCI_DPRINTF()., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 43/61] pci: add helper function to initialize wmask., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 39/61] pci: factor out config update logic., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 55/61] ioapic: make ioapic_set_irq() static., Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 53/61] pc q35 based chipset emulator, Isaku Yamahata, 2009/09/30
- [Qemu-devel] [PATCH 38/61] pci: fix pci_default_write_config(), Isaku Yamahata, 2009/09/30