legacy.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. #include <linux/init.h>
  2. #include <linux/pci.h>
  3. #include <linux/module.h>
  4. #include <linux/interrupt.h>
  5. #include "pci.h"
  6. /**
  7. * pci_find_device - begin or continue searching for a PCI device by vendor/device id
  8. * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
  9. * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
  10. * @from: Previous PCI device found in search, or %NULL for new search.
  11. *
  12. * Iterates through the list of known PCI devices. If a PCI device is found
  13. * with a matching @vendor and @device, a pointer to its device structure is
  14. * returned. Otherwise, %NULL is returned.
  15. * A new search is initiated by passing %NULL as the @from argument.
  16. * Otherwise if @from is not %NULL, searches continue from next device
  17. * on the global list.
  18. *
  19. * NOTE: Do not use this function any more; use pci_get_device() instead, as
  20. * the PCI device returned by this function can disappear at any moment in
  21. * time.
  22. */
  23. struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device,
  24. struct pci_dev *from)
  25. {
  26. struct pci_dev *pdev;
  27. pci_dev_get(from);
  28. pdev = pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
  29. pci_dev_put(pdev);
  30. return pdev;
  31. }
  32. EXPORT_SYMBOL(pci_find_device);