diff options
| author | Jiang Liu <jiang.liu@huawei.com> | 2012-08-20 15:30:43 -0400 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-08-23 12:11:13 -0400 |
| commit | f8c0fcacfe2e2fd4ee3eadd790959323097004fd (patch) | |
| tree | 50fb7000183a20a3c436aabbaf30c28c76635c90 | |
| parent | 0f49bfbd0f2ee6d57398ba5fcf39de6b566c43bb (diff) | |
e1000e: Use PCI Express Capability accessors
Use PCI Express Capability access functions to simplify e1000e driver.
[bhelgaas: split e1000e and igb into separate patches]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
| -rw-r--r-- | drivers/net/ethernet/intel/e1000e/netdev.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 95b245310f17..9f474b2cc819 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
| @@ -5570,16 +5570,15 @@ static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep, | |||
| 5570 | */ | 5570 | */ |
| 5571 | if (adapter->flags & FLAG_IS_QUAD_PORT) { | 5571 | if (adapter->flags & FLAG_IS_QUAD_PORT) { |
| 5572 | struct pci_dev *us_dev = pdev->bus->self; | 5572 | struct pci_dev *us_dev = pdev->bus->self; |
| 5573 | int pos = pci_pcie_cap(us_dev); | ||
| 5574 | u16 devctl; | 5573 | u16 devctl; |
| 5575 | 5574 | ||
| 5576 | pci_read_config_word(us_dev, pos + PCI_EXP_DEVCTL, &devctl); | 5575 | pcie_capability_read_word(us_dev, PCI_EXP_DEVCTL, &devctl); |
| 5577 | pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, | 5576 | pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, |
| 5578 | (devctl & ~PCI_EXP_DEVCTL_CERE)); | 5577 | (devctl & ~PCI_EXP_DEVCTL_CERE)); |
| 5579 | 5578 | ||
| 5580 | e1000_power_off(pdev, sleep, wake); | 5579 | e1000_power_off(pdev, sleep, wake); |
| 5581 | 5580 | ||
| 5582 | pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, devctl); | 5581 | pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, devctl); |
| 5583 | } else { | 5582 | } else { |
| 5584 | e1000_power_off(pdev, sleep, wake); | 5583 | e1000_power_off(pdev, sleep, wake); |
| 5585 | } | 5584 | } |
| @@ -5593,25 +5592,15 @@ static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | |||
| 5593 | #else | 5592 | #else |
| 5594 | static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | 5593 | static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) |
| 5595 | { | 5594 | { |
| 5596 | int pos; | ||
| 5597 | u16 reg16; | ||
| 5598 | |||
| 5599 | /* | 5595 | /* |
| 5600 | * Both device and parent should have the same ASPM setting. | 5596 | * Both device and parent should have the same ASPM setting. |
| 5601 | * Disable ASPM in downstream component first and then upstream. | 5597 | * Disable ASPM in downstream component first and then upstream. |
| 5602 | */ | 5598 | */ |
| 5603 | pos = pci_pcie_cap(pdev); | 5599 | pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, state); |
| 5604 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); | ||
| 5605 | reg16 &= ~state; | ||
| 5606 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); | ||
| 5607 | |||
| 5608 | if (!pdev->bus->self) | ||
| 5609 | return; | ||
| 5610 | 5600 | ||
| 5611 | pos = pci_pcie_cap(pdev->bus->self); | 5601 | if (pdev->bus->self) |
| 5612 | pci_read_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, ®16); | 5602 | pcie_capability_clear_word(pdev->bus->self, PCI_EXP_LNKCTL, |
| 5613 | reg16 &= ~state; | 5603 | state); |
| 5614 | pci_write_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, reg16); | ||
| 5615 | } | 5604 | } |
| 5616 | #endif | 5605 | #endif |
| 5617 | static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | 5606 | static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) |
