diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/search.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 8541034021f0..1aabe3dbc7c3 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -436,7 +436,18 @@ exit: | |||
436 | return dev; | 436 | return dev; |
437 | } | 437 | } |
438 | 438 | ||
439 | const struct pci_device_id *pci_find_present(const struct pci_device_id *ids) | 439 | /** |
440 | * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not. | ||
441 | * @ids: A pointer to a null terminated list of struct pci_device_id structures | ||
442 | * that describe the type of PCI device the caller is trying to find. | ||
443 | * | ||
444 | * Obvious fact: You do not have a reference to any device that might be found | ||
445 | * by this function, so if that device is removed from the system right after | ||
446 | * this function is finished, the value will be stale. Use this function to | ||
447 | * find devices that are usually built into a system, or for a general hint as | ||
448 | * to if another device happens to be present at this specific moment in time. | ||
449 | */ | ||
450 | int pci_dev_present(const struct pci_device_id *ids) | ||
440 | { | 451 | { |
441 | struct pci_dev *dev; | 452 | struct pci_dev *dev; |
442 | const struct pci_device_id *found = NULL; | 453 | const struct pci_device_id *found = NULL; |
@@ -452,27 +463,11 @@ const struct pci_device_id *pci_find_present(const struct pci_device_id *ids) | |||
452 | } | 463 | } |
453 | exit: | 464 | exit: |
454 | up_read(&pci_bus_sem); | 465 | up_read(&pci_bus_sem); |
455 | return found; | 466 | if (found) |
456 | } | 467 | return 1; |
457 | 468 | return 0; | |
458 | /** | ||
459 | * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not. | ||
460 | * @ids: A pointer to a null terminated list of struct pci_device_id structures | ||
461 | * that describe the type of PCI device the caller is trying to find. | ||
462 | * | ||
463 | * Obvious fact: You do not have a reference to any device that might be found | ||
464 | * by this function, so if that device is removed from the system right after | ||
465 | * this function is finished, the value will be stale. Use this function to | ||
466 | * find devices that are usually built into a system, or for a general hint as | ||
467 | * to if another device happens to be present at this specific moment in time. | ||
468 | */ | ||
469 | int pci_dev_present(const struct pci_device_id *ids) | ||
470 | { | ||
471 | return pci_find_present(ids) == NULL ? 0 : 1; | ||
472 | } | 469 | } |
473 | |||
474 | EXPORT_SYMBOL(pci_dev_present); | 470 | EXPORT_SYMBOL(pci_dev_present); |
475 | EXPORT_SYMBOL(pci_find_present); | ||
476 | 471 | ||
477 | #ifdef CONFIG_PCI_LEGACY | 472 | #ifdef CONFIG_PCI_LEGACY |
478 | EXPORT_SYMBOL(pci_find_device); | 473 | EXPORT_SYMBOL(pci_find_device); |