diff options
-rw-r--r-- | drivers/pci/search.c | 35 | ||||
-rw-r--r-- | include/linux/pci.h | 2 |
2 files changed, 15 insertions, 22 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); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 3a2b9fbdb379..b39f2abbea17 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -527,7 +527,6 @@ struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); | |||
527 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); | 527 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); |
528 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); | 528 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); |
529 | int pci_dev_present(const struct pci_device_id *ids); | 529 | int pci_dev_present(const struct pci_device_id *ids); |
530 | const struct pci_device_id *pci_find_present(const struct pci_device_id *ids); | ||
531 | 530 | ||
532 | int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, | 531 | int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, |
533 | int where, u8 *val); | 532 | int where, u8 *val); |
@@ -816,7 +815,6 @@ static inline struct pci_dev *pci_get_class(unsigned int class, | |||
816 | 815 | ||
817 | #define pci_dev_present(ids) (0) | 816 | #define pci_dev_present(ids) (0) |
818 | #define no_pci_devices() (1) | 817 | #define no_pci_devices() (1) |
819 | #define pci_find_present(ids) (NULL) | ||
820 | #define pci_dev_put(dev) do { } while (0) | 818 | #define pci_dev_put(dev) do { } while (0) |
821 | 819 | ||
822 | static inline void pci_set_master(struct pci_dev *dev) | 820 | static inline void pci_set_master(struct pci_dev *dev) |