Commit 728cdb75 authored by Yijing Wang's avatar Yijing Wang Committed by Bjorn Helgaas

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: default avatarYijing Wang <wangyijing@huawei.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent fc6504b3
...@@ -805,7 +805,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) ...@@ -805,7 +805,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
{ {
pci_power_t ret; pci_power_t ret;
if (!pci_find_capability(dev, PCI_CAP_ID_PM)) if (!dev->pm_cap)
return PCI_D0; return PCI_D0;
ret = platform_pci_choose_state(dev); ret = platform_pci_choose_state(dev);
......
...@@ -1832,7 +1832,6 @@ static void quirk_e100_interrupt(struct pci_dev *dev) ...@@ -1832,7 +1832,6 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
u16 command, pmcsr; u16 command, pmcsr;
u8 __iomem *csr; u8 __iomem *csr;
u8 cmd_hi; u8 cmd_hi;
int pm;
switch (dev->device) { switch (dev->device) {
/* PCI IDs taken from drivers/net/e100.c */ /* PCI IDs taken from drivers/net/e100.c */
...@@ -1870,9 +1869,8 @@ static void quirk_e100_interrupt(struct pci_dev *dev) ...@@ -1870,9 +1869,8 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
* Check that the device is in the D0 power state. If it's not, * Check that the device is in the D0 power state. If it's not,
* there is no point to look any further. * there is no point to look any further.
*/ */
pm = pci_find_capability(dev, PCI_CAP_ID_PM); if (dev->pm_cap) {
if (pm) { pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment