S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)

{

    S390PCIBusDevice *pbdev;

    int i;

    int j = 0;

    S390pciState *s = S390_PCI_HOST_BRIDGE(

        object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));



    if (!s) {

        return NULL;

    }



    for (i = 0; i < PCI_SLOT_MAX; i++) {

        pbdev = &s->pbdev[i];



        if (pbdev->fh == 0) {

            continue;

        }



        if (j == idx) {

            return pbdev;

        }

        j++;

    }



    return NULL;

}

S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)

{

    S390PCIBusDevice *pbdev;

    int i;

    int j = 0;

    S390pciState *s = S390_PCI_HOST_BRIDGE(

        object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));



    if (!s) {

        return NULL;

    }



    for (i = 0; i < PCI_SLOT_MAX; i++) {

        pbdev = &s->pbdev[i];



        if (pbdev->fh == 0) {

            continue;

        }



        if (j == idx) {

            return pbdev;

        }

        j++;

    }



    return NULL;

}

S390PCIBusDevice *FUNC_0(uint32_t idx)

{

    S390PCIBusDevice *pbdev;

    int VAR_0;

    int VAR_1 = 0;

    S390pciState *s = S390_PCI_HOST_BRIDGE(

        object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));



    if (!s) {

        return NULL;

    }



    for (VAR_0 = 0; VAR_0 < PCI_SLOT_MAX; VAR_0++) {

        pbdev = &s->pbdev[VAR_0];



        if (pbdev->fh == 0) {

            continue;

        }



        if (VAR_1 == idx) {

            return pbdev;

        }

        VAR_1++;

    }



    return NULL;

}

S390PCIBusDevice *FUNC_0(uint32_t idx)
{ S390PCIBusDevice *pbdev; int VAR_0; int VAR_1 = 0; S390pciState *s = S390_PCI_HOST_BRIDGE(
object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL)); if (!s) { return NULL; } for (VAR_0 = 0; VAR_0 < PCI_SLOT_MAX; VAR_0++) { pbdev = &s->pbdev[VAR_0]; if (pbdev->fh == 0) { continue; } if (VAR_1 == idx) { return pbdev; } VAR_1++; } return NULL; }