static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)

{

    PCIDevice *d;

    int dom, bus;

    unsigned slot;

    Error *local_err = NULL;



    if (pci_read_devaddr(mon, pci_addr, &dom, &bus, &slot)) {

        return -1;

    }



    d = pci_find_device(pci_find_root_bus(dom), bus, PCI_DEVFN(slot, 0));

    if (!d) {

        monitor_printf(mon, "slot %d empty\n", slot);

        return -1;

    }



    qdev_unplug(&d->qdev, &local_err);

    if (error_is_set(&local_err)) {

        monitor_printf(mon, "%s\n", error_get_pretty(local_err));

        error_free(local_err);

        return -1;

    }



    return 0;

}

static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)

{

    PCIDevice *d;

    int dom, bus;

    unsigned slot;

    Error *local_err = NULL;



    if (pci_read_devaddr(mon, pci_addr, &dom, &bus, &slot)) {

        return -1;

    }



    d = pci_find_device(pci_find_root_bus(dom), bus, PCI_DEVFN(slot, 0));

    if (!d) {

        monitor_printf(mon, "slot %d empty\n", slot);

        return -1;

    }



    qdev_unplug(&d->qdev, &local_err);

    if (error_is_set(&local_err)) {

        monitor_printf(mon, "%s\n", error_get_pretty(local_err));

        error_free(local_err);

        return -1;

    }



    return 0;

}

static int FUNC_0(Monitor *VAR_0, const char *VAR_1)

{

    PCIDevice *d;

    int VAR_2, VAR_3;

    unsigned VAR_4;

    Error *local_err = NULL;



    if (pci_read_devaddr(VAR_0, VAR_1, &VAR_2, &VAR_3, &VAR_4)) {

        return -1;

    }



    d = pci_find_device(pci_find_root_bus(VAR_2), VAR_3, PCI_DEVFN(VAR_4, 0));

    if (!d) {

        monitor_printf(VAR_0, "VAR_4 %d empty\n", VAR_4);

        return -1;

    }



    qdev_unplug(&d->qdev, &local_err);

    if (error_is_set(&local_err)) {

        monitor_printf(VAR_0, "%s\n", error_get_pretty(local_err));

        error_free(local_err);

        return -1;

    }



    return 0;

}

static int FUNC_0(Monitor *VAR_0, const char *VAR_1)
{ PCIDevice *d; int VAR_2, VAR_3; unsigned VAR_4; Error *local_err = NULL; if (pci_read_devaddr(VAR_0, VAR_1, &VAR_2, &VAR_3, &VAR_4)) { return -1; } d = pci_find_device(pci_find_root_bus(VAR_2), VAR_3, PCI_DEVFN(VAR_4, 0)); if (!d) { monitor_printf(VAR_0, "VAR_4 %d empty\n", VAR_4); return -1; } qdev_unplug(&d->qdev, &local_err); if (error_is_set(&local_err)) { monitor_printf(VAR_0, "%s\n", error_get_pretty(local_err)); error_free(local_err); return -1; } return 0; }