Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 44809
b: refs/heads/master
c: d3bac11
h: refs/heads/master
i:
  44807: cb5864a
v: v3
  • Loading branch information
Michael Ellerman authored and Greg Kroah-Hartman committed Dec 20, 2006
1 parent 88e653e commit 98fada5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d86f90f9913d27bb968132bf63499c56bca56db6
refs/heads/master: d3bac118fb27a365d5e9f54f4a078eb9b42f968f
28 changes: 19 additions & 9 deletions trunk/drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap)
}
EXPORT_SYMBOL_GPL(pci_find_next_capability);

static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_type, int cap)
static int __pci_bus_find_cap_start(struct pci_bus *bus,
unsigned int devfn, u8 hdr_type)
{
u16 status;
u8 pos;

pci_bus_read_config_word(bus, devfn, PCI_STATUS, &status);
if (!(status & PCI_STATUS_CAP_LIST))
Expand All @@ -108,15 +108,14 @@ static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_ty
switch (hdr_type) {
case PCI_HEADER_TYPE_NORMAL:
case PCI_HEADER_TYPE_BRIDGE:
pos = PCI_CAPABILITY_LIST;
break;
return PCI_CAPABILITY_LIST;
case PCI_HEADER_TYPE_CARDBUS:
pos = PCI_CB_CAPABILITY_LIST;
break;
return PCI_CB_CAPABILITY_LIST;
default:
return 0;
}
return __pci_find_next_cap(bus, devfn, pos, cap);

return 0;
}

/**
Expand All @@ -140,7 +139,13 @@ static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_ty
*/
int pci_find_capability(struct pci_dev *dev, int cap)
{
return __pci_bus_find_cap(dev->bus, dev->devfn, dev->hdr_type, cap);
int pos;

pos = __pci_bus_find_cap_start(dev->bus, dev->devfn, dev->hdr_type);
if (pos)
pos = __pci_find_next_cap(dev->bus, dev->devfn, pos, cap);

return pos;
}

/**
Expand All @@ -158,11 +163,16 @@ int pci_find_capability(struct pci_dev *dev, int cap)
*/
int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap)
{
int pos;
u8 hdr_type;

pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type);

return __pci_bus_find_cap(bus, devfn, hdr_type & 0x7f, cap);
pos = __pci_bus_find_cap_start(bus, devfn, hdr_type & 0x7f);
if (pos)
pos = __pci_find_next_cap(bus, devfn, pos, cap);

return pos;
}

/**
Expand Down

0 comments on commit 98fada5

Please sign in to comment.