aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKok, Auke <auke-jan.h.kok@intel.com>2007-02-16 17:39:28 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-17 15:37:14 -0500
commit1d33e9c606bcf3d00bf67477e34253e861bb71c3 (patch)
tree70e783fe225800e26b9cacebc816b29e5d7d1908
parentd2ed16356ff4fb9de23fbc5e5d582ce580390106 (diff)
e1000: remove obsolete custom pci_save_state code
Now that 2.6.19 provides a proper implementation that saves MSI, PCI-E config space, we can have the e1000 driver use those instead of it's custom implementation. Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/e1000/e1000.h1
-rw-r--r--drivers/net/e1000/e1000_main.c58
2 files changed, 2 insertions, 57 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 689f158a469e..dd4b728ac4b5 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -337,7 +337,6 @@ struct e1000_adapter {
337 struct e1000_rx_ring test_rx_ring; 337 struct e1000_rx_ring test_rx_ring;
338 338
339 339
340 uint32_t *config_space;
341 int msg_enable; 340 int msg_enable;
342#ifdef CONFIG_PCI_MSI 341#ifdef CONFIG_PCI_MSI
343 boolean_t have_msi; 342 boolean_t have_msi;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index f293690b8fc2..a71023741c3a 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -5071,58 +5071,6 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
5071 return 0; 5071 return 0;
5072} 5072}
5073 5073
5074#ifdef CONFIG_PM
5075/* Save/restore 16 or 64 dwords of PCI config space depending on which
5076 * bus we're on (PCI(X) vs. PCI-E)
5077 */
5078#define PCIE_CONFIG_SPACE_LEN 256
5079#define PCI_CONFIG_SPACE_LEN 64
5080static int
5081e1000_pci_save_state(struct e1000_adapter *adapter)
5082{
5083 struct pci_dev *dev = adapter->pdev;
5084 int size;
5085 int i;
5086
5087 if (adapter->hw.mac_type >= e1000_82571)
5088 size = PCIE_CONFIG_SPACE_LEN;
5089 else
5090 size = PCI_CONFIG_SPACE_LEN;
5091
5092 WARN_ON(adapter->config_space != NULL);
5093
5094 adapter->config_space = kmalloc(size, GFP_KERNEL);
5095 if (!adapter->config_space) {
5096 DPRINTK(PROBE, ERR, "unable to allocate %d bytes\n", size);
5097 return -ENOMEM;
5098 }
5099 for (i = 0; i < (size / 4); i++)
5100 pci_read_config_dword(dev, i * 4, &adapter->config_space[i]);
5101 return 0;
5102}
5103
5104static void
5105e1000_pci_restore_state(struct e1000_adapter *adapter)
5106{
5107 struct pci_dev *dev = adapter->pdev;
5108 int size;
5109 int i;
5110
5111 if (adapter->config_space == NULL)
5112 return;
5113
5114 if (adapter->hw.mac_type >= e1000_82571)
5115 size = PCIE_CONFIG_SPACE_LEN;
5116 else
5117 size = PCI_CONFIG_SPACE_LEN;
5118 for (i = 0; i < (size / 4); i++)
5119 pci_write_config_dword(dev, i * 4, adapter->config_space[i]);
5120 kfree(adapter->config_space);
5121 adapter->config_space = NULL;
5122 return;
5123}
5124#endif /* CONFIG_PM */
5125
5126static int 5074static int
5127e1000_suspend(struct pci_dev *pdev, pm_message_t state) 5075e1000_suspend(struct pci_dev *pdev, pm_message_t state)
5128{ 5076{
@@ -5142,9 +5090,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
5142 } 5090 }
5143 5091
5144#ifdef CONFIG_PM 5092#ifdef CONFIG_PM
5145 /* Implement our own version of pci_save_state(pdev) because pci- 5093 retval = pci_save_state(pdev);
5146 * express adapters have 256-byte config spaces. */
5147 retval = e1000_pci_save_state(adapter);
5148 if (retval) 5094 if (retval)
5149 return retval; 5095 return retval;
5150#endif 5096#endif
@@ -5231,7 +5177,7 @@ e1000_resume(struct pci_dev *pdev)
5231 uint32_t err; 5177 uint32_t err;
5232 5178
5233 pci_set_power_state(pdev, PCI_D0); 5179 pci_set_power_state(pdev, PCI_D0);
5234 e1000_pci_restore_state(adapter); 5180 pci_restore_state(pdev);
5235 if ((err = pci_enable_device(pdev))) { 5181 if ((err = pci_enable_device(pdev))) {
5236 printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n"); 5182 printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n");
5237 return err; 5183 return err;