> +int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int  
> ht_cap)
> +{
> +     int rc;
> +     u8 cap, mask;
> +
> +     if (ht_cap == HT_CAPTYPE_SLAVE || ht_cap == HT_CAPTYPE_HOST)
> +             mask = HT_3BIT_CAP_MASK;
> +     else
> +             mask = HT_5BIT_CAP_MASK;
> +

+       pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_HT);

or the caller will loop forever if a second same type HT cap is found.

> +     while (pos) {
> +             rc = pci_read_config_byte(dev, pos + 3, &cap);
> +             if (rc != PCIBIOS_SUCCESSFUL)
> +                     return 0;
> +
> +             if ((cap & mask) == ht_cap)
> +                     return pos;
> +
> +             pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_HT);
> +     }
> +
> +     return 0;
> +}


Segher


_______________________________________________
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to