Note about behavior of pci_attach_device()

I am using pci_attach_device() to search with PCI_SEARCH_BUSDEV set. I find that
if I increment ‘idx’ it continues to return the same device each time. Since there cant
be multiple devices with the same bus number, device, and function one could argue it doesnt make
sense to call it with ‘idx’ other than NULL. However, it might not hurt to have it return NULL
when ‘idx’ is non-zero.


Art Hays
National Institutes of Health
avhays@nih.gov

Yes, idx is ignored when PCI_SEARCH_BUSDEV is set, as there can’t be 2
devices with the same bus/devfunc.

Previously, Art Hays wrote in qdn.public.qnxrtp.os:

I am using pci_attach_device() to search with PCI_SEARCH_BUSDEV set. I find that
if I increment ‘idx’ it continues to return the same device each time. Since there cant
be multiple devices with the same bus number, device, and function one could argue it doesnt make
sense to call it with ‘idx’ other than NULL. However, it might not hurt to have it return NULL
when ‘idx’ is non-zero.


Art Hays
National Institutes of Health
avhays@nih.gov

Hugh Brown <hsbrown@qnx.com> wrote:
: Yes, idx is ignored when PCI_SEARCH_BUSDEV is set, as there can’t be 2
: devices with the same bus/devfunc.

I’ll mention this in the docs.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems