aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2013-06-18 04:22:14 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-06-18 14:05:34 -0400
commit728cdb7582a230234795619036d887d7f52bce1e (patch)
tree0de33c16dddda3b7e94d3657d27150ee20c24201 /drivers/pci
parentfc6504b3a4dc9beae782a11e6f7c3c4a9f077fb8 (diff)
PCI: Use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM)
PCI PM cap register offset has been saved in pci_pm_init(), so we can use pdev->pm_cap instead of using pci_find_capability(..) here. Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c2
-rw-r--r--drivers/pci/quirks.c6
2 files changed, 3 insertions, 5 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 709791b70ca0..e37fea6e178d 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -805,7 +805,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
805{ 805{
806 pci_power_t ret; 806 pci_power_t ret;
807 807
808 if (!pci_find_capability(dev, PCI_CAP_ID_PM)) 808 if (!dev->pm_cap)
809 return PCI_D0; 809 return PCI_D0;
810 810
811 ret = platform_pci_choose_state(dev); 811 ret = platform_pci_choose_state(dev);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7f492574dcf4..dee5ed4f7b6e 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1832,7 +1832,6 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
1832 u16 command, pmcsr; 1832 u16 command, pmcsr;
1833 u8 __iomem *csr; 1833 u8 __iomem *csr;
1834 u8 cmd_hi; 1834 u8 cmd_hi;
1835 int pm;
1836 1835
1837 switch (dev->device) { 1836 switch (dev->device) {
1838 /* PCI IDs taken from drivers/net/e100.c */ 1837 /* PCI IDs taken from drivers/net/e100.c */
@@ -1870,9 +1869,8 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
1870 * Check that the device is in the D0 power state. If it's not, 1869 * Check that the device is in the D0 power state. If it's not,
1871 * there is no point to look any further. 1870 * there is no point to look any further.
1872 */ 1871 */
1873 pm = pci_find_capability(dev, PCI_CAP_ID_PM); 1872 if (dev->pm_cap) {
1874 if (pm) { 1873 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
1875 pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
1876 if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) 1874 if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
1877 return; 1875 return;
1878 } 1876 }