aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-11-11 00:32:42 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-24 18:25:13 -0500
commitdba90dfe48e2e00e79a15c95940730b6926ee176 (patch)
treeaf32687abec213653a6432842a8962adcf3a9e8c /drivers/pci
parent39a53062cb5b2ceca6035f3ed67317672f0bcf3b (diff)
PCIe port bus: use pci_pcie_cap()
Use pci_pcie_cap() instead of pci_find_capability() to get PCIe capability offset in PCI Express Port Bus driver. This avoids unnecessary serarch in PCI configuration space. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pcie/portdrv_core.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 52f84fca9f7d..ce99c7121372 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -108,7 +108,7 @@ static int pcie_port_enable_msix(struct pci_dev *dev, int *vectors, int mask)
108 * the value in this field indicates which MSI-X Table entry is 108 * the value in this field indicates which MSI-X Table entry is
109 * used to generate the interrupt message." 109 * used to generate the interrupt message."
110 */ 110 */
111 pos = pci_find_capability(dev, PCI_CAP_ID_EXP); 111 pos = pci_pcie_cap(dev);
112 pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, &reg16); 112 pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, &reg16);
113 entry = (reg16 >> 9) & PCIE_PORT_MSI_VECTOR_MASK; 113 entry = (reg16 >> 9) & PCIE_PORT_MSI_VECTOR_MASK;
114 if (entry >= nr_entries) 114 if (entry >= nr_entries)
@@ -226,7 +226,7 @@ static int get_port_device_capability(struct pci_dev *dev)
226 u16 reg16; 226 u16 reg16;
227 u32 reg32; 227 u32 reg32;
228 228
229 pos = pci_find_capability(dev, PCI_CAP_ID_EXP); 229 pos = pci_pcie_cap(dev);
230 pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, &reg16); 230 pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, &reg16);
231 /* Hot-Plug Capable */ 231 /* Hot-Plug Capable */
232 if (reg16 & PORT_TO_SLOT_MASK) { 232 if (reg16 & PORT_TO_SLOT_MASK) {
@@ -305,7 +305,8 @@ int pcie_port_device_probe(struct pci_dev *dev)
305 int pos, type; 305 int pos, type;
306 u16 reg; 306 u16 reg;
307 307
308 if (!(pos = pci_find_capability(dev, PCI_CAP_ID_EXP))) 308 pos = pci_pcie_cap(dev);
309 if (!pos)
309 return -ENODEV; 310 return -ENODEV;
310 311
311 pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, &reg); 312 pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, &reg);
@@ -327,7 +328,7 @@ int pcie_port_device_probe(struct pci_dev *dev)
327int pcie_port_device_register(struct pci_dev *dev) 328int pcie_port_device_register(struct pci_dev *dev)
328{ 329{
329 struct pcie_port_data *port_data; 330 struct pcie_port_data *port_data;
330 int status, capabilities, irq_mode, i, nr_serv; 331 int status, capabilities, irq_mode, i, nr_serv, pos;
331 int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; 332 int vectors[PCIE_PORT_DEVICE_MAXSERVICES];
332 u16 reg16; 333 u16 reg16;
333 334
@@ -337,9 +338,8 @@ int pcie_port_device_register(struct pci_dev *dev)
337 pci_set_drvdata(dev, port_data); 338 pci_set_drvdata(dev, port_data);
338 339
339 /* Get port type */ 340 /* Get port type */
340 pci_read_config_word(dev, 341 pos = pci_pcie_cap(dev);
341 pci_find_capability(dev, PCI_CAP_ID_EXP) + 342 pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, &reg16);
342 PCIE_CAPABILITIES_REG, &reg16);
343 port_data->port_type = (reg16 >> 4) & PORT_TYPE_MASK; 343 port_data->port_type = (reg16 >> 4) & PORT_TYPE_MASK;
344 344
345 capabilities = get_port_device_capability(dev); 345 capabilities = get_port_device_capability(dev);