]> pilppa.com Git - linux-2.6-omap-h63xx.git/commit
[PATCH] PCI: add pci_find_next_capability()
authorRoland Dreier <rolandd@cisco.com>
Sat, 29 Oct 2005 00:35:34 +0000 (17:35 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2005 00:09:14 +0000 (16:09 -0800)
commit24a4e377068d15424cd6a921d41352f295548037
treef6eb0e19f3828ca713d8151a63292de6d2287a90
parent6d23c8bc7a6af4300b3c5244f4c21211f9adb960
[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>
drivers/pci/pci.c
include/linux/pci.h