Le 25/11/2011 08:56, [email protected] a écrit :
> +static hwloc_obj_t hwloc_topology_get_pcidev(hwloc_topology_t topology, 
> hwloc_obj_t parent, int domain, int bus, int dev)
> +{
> +  hwloc_obj_t child;
> +
> +  if (parent->type == HWLOC_OBJ_PCI_DEVICE
> +      && parent->attr->pcidev.domain == domain
> +      && parent->attr->pcidev.bus == bus
> +      && parent->attr->pcidev.dev == dev)
> +    return parent;
> +
> +  for (child = parent->first_child; child; child = child->next_sibling) {
> +    hwloc_obj_t found;
> +    found = hwloc_topology_get_pcidev(topology, child, domain, bus, dev);
> +    if (found)
> +      return found;
> +  }
> +    pci_card = hwloc_topology_get_pcidev(topology, topology->levels[0][0], 
> domain, bus, dev);
> +    if (!pci_card)
> +      return;

hwloc_get_pcidev_by_busid(topology, domain, bus, dev, 0) should work
here (hwloc/helper.h). Unless you have some complex plans with the
"parent" parameter?

Brice

Reply via email to