diff options
author | Roland Dreier <rolandd@cisco.com> | 2005-10-28 20:35:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-11-10 19:09:14 -0500 |
commit | 24a4e377068d15424cd6a921d41352f295548037 (patch) | |
tree | f6eb0e19f3828ca713d8151a63292de6d2287a90 /include/linux/pci.h | |
parent | 6d23c8bc7a6af4300b3c5244f4c21211f9adb960 (diff) |
[PATCH] PCI: add pci_find_next_capability()
Some devices have more than one capability of the same type. For
example, the PCI header for the PathScale InfiniPath looks like:
04:01.0 InfiniBand: Unknown device 1fc1:000d (rev 02)
Subsystem: Unknown device 1fc1:000d
Flags: bus master, fast devsel, latency 0, IRQ 193
Memory at fea00000 (64-bit, non-prefetchable) [size=2M]
Capabilities: [c0] HyperTransport: Slave or Primary Interface
Capabilities: [f8] HyperTransport: Interrupt Discovery and Configuration
There are _two_ HyperTransport capabilities, and the PathScale driver
wants to look at both of them.
The current pci_find_capability() API doesn't work for this, since it
only allows us to get to the first capability of a given type. The
patch below introduces a new pci_find_next_capability(), which can be
used in a loop like
for (pos = pci_find_capability(pdev, <ID>);
pos;
pos = pci_find_next_capability(pdev, pos, <ID>)) {
/* ... */
}
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 3596ac94ecff..7063241e34d9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -338,6 +338,7 @@ struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, const | |||
338 | struct pci_dev *pci_find_device_reverse (unsigned int vendor, unsigned int device, const struct pci_dev *from); | 338 | struct pci_dev *pci_find_device_reverse (unsigned int vendor, unsigned int device, const struct pci_dev *from); |
339 | struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); | 339 | struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); |
340 | int pci_find_capability (struct pci_dev *dev, int cap); | 340 | int pci_find_capability (struct pci_dev *dev, int cap); |
341 | int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); | ||
341 | int pci_find_ext_capability (struct pci_dev *dev, int cap); | 342 | int pci_find_ext_capability (struct pci_dev *dev, int cap); |
342 | struct pci_bus * pci_find_next_bus(const struct pci_bus *from); | 343 | struct pci_bus * pci_find_next_bus(const struct pci_bus *from); |
343 | 344 | ||
@@ -550,6 +551,7 @@ static inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUS | |||
550 | static inline int pci_register_driver(struct pci_driver *drv) { return 0;} | 551 | static inline int pci_register_driver(struct pci_driver *drv) { return 0;} |
551 | static inline void pci_unregister_driver(struct pci_driver *drv) { } | 552 | static inline void pci_unregister_driver(struct pci_driver *drv) { } |
552 | static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } | 553 | static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } |
554 | static inline int pci_find_next_capability (struct pci_dev *dev, u8 post, int cap) { return 0; } | ||
553 | static inline int pci_find_ext_capability (struct pci_dev *dev, int cap) {return 0; } | 555 | static inline int pci_find_ext_capability (struct pci_dev *dev, int cap) {return 0; } |
554 | static inline const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev) { return NULL; } | 556 | static inline const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev) { return NULL; } |
555 | 557 | ||