static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)

{

    PCIDevice *pci_dev = (PCIDevice *)qdev;

    PCIDeviceInfo *info = container_of(base, PCIDeviceInfo, qdev);

    PCIBus *bus;

    int devfn, rc;



    /* initialize cap_present for pci_is_express() and pci_config_size() */

    if (info->is_express) {

        pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;

    }



    bus = FROM_QBUS(PCIBus, qdev_get_parent_bus(qdev));

    devfn = pci_dev->devfn;

    pci_dev = do_pci_register_device(pci_dev, bus, base->name, devfn,

                                     info->config_read, info->config_write);

    assert(pci_dev);

    rc = info->init(pci_dev);

    if (rc != 0)

        return rc;

    if (qdev->hotplugged)

        bus->hotplug(pci_dev, 1);

    return 0;

}

static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)

{

    PCIDevice *pci_dev = (PCIDevice *)qdev;

    PCIDeviceInfo *info = container_of(base, PCIDeviceInfo, qdev);

    PCIBus *bus;

    int devfn, rc;



    

    if (info->is_express) {

        pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;

    }



    bus = FROM_QBUS(PCIBus, qdev_get_parent_bus(qdev));

    devfn = pci_dev->devfn;

    pci_dev = do_pci_register_device(pci_dev, bus, base->name, devfn,

                                     info->config_read, info->config_write);

    assert(pci_dev);

    rc = info->init(pci_dev);

    if (rc != 0)

        return rc;

    if (qdev->hotplugged)

        bus->hotplug(pci_dev, 1);

    return 0;

}

static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1)

{

    PCIDevice *pci_dev = (PCIDevice *)VAR_0;

    PCIDeviceInfo *info = container_of(VAR_1, PCIDeviceInfo, VAR_0);

    PCIBus *bus;

    int VAR_2, VAR_3;



    

    if (info->is_express) {

        pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;

    }



    bus = FROM_QBUS(PCIBus, qdev_get_parent_bus(VAR_0));

    VAR_2 = pci_dev->VAR_2;

    pci_dev = do_pci_register_device(pci_dev, bus, VAR_1->name, VAR_2,

                                     info->config_read, info->config_write);

    assert(pci_dev);

    VAR_3 = info->init(pci_dev);

    if (VAR_3 != 0)

        return VAR_3;

    if (VAR_0->hotplugged)

        bus->hotplug(pci_dev, 1);

    return 0;

}

static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1)
{ PCIDevice *pci_dev = (PCIDevice *)VAR_0; PCIDeviceInfo *info = container_of(VAR_1, PCIDeviceInfo, VAR_0); PCIBus *bus; int VAR_2, VAR_3; if (info->is_express) { pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS; } bus = FROM_QBUS(PCIBus, qdev_get_parent_bus(VAR_0)); VAR_2 = pci_dev->VAR_2; pci_dev = do_pci_register_device(pci_dev, bus, VAR_1->name, VAR_2,
info->config_read, info->config_write); assert(pci_dev); VAR_3 = info->init(pci_dev); if (VAR_3 != 0)
return VAR_3; if (VAR_0->hotplugged)
bus->hotplug(pci_dev, 1); return 0; }