Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d33e9c6 authored by Kok, Auke's avatar Kok, Auke Committed by Jeff Garzik
Browse files

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: default avatarAuke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent d2ed1635
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -337,7 +337,6 @@ struct e1000_adapter {
	struct e1000_rx_ring test_rx_ring;


	uint32_t *config_space;
	int msg_enable;
#ifdef CONFIG_PCI_MSI
	boolean_t have_msi;
+2 −56
Original line number Diff line number Diff line
@@ -5071,58 +5071,6 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
	return 0;
}

#ifdef CONFIG_PM
/* Save/restore 16 or 64 dwords of PCI config space depending on which
 * bus we're on (PCI(X) vs. PCI-E)
 */
#define PCIE_CONFIG_SPACE_LEN 256
#define PCI_CONFIG_SPACE_LEN 64
static int
e1000_pci_save_state(struct e1000_adapter *adapter)
{
	struct pci_dev *dev = adapter->pdev;
	int size;
	int i;

	if (adapter->hw.mac_type >= e1000_82571)
		size = PCIE_CONFIG_SPACE_LEN;
	else
		size = PCI_CONFIG_SPACE_LEN;

	WARN_ON(adapter->config_space != NULL);

	adapter->config_space = kmalloc(size, GFP_KERNEL);
	if (!adapter->config_space) {
		DPRINTK(PROBE, ERR, "unable to allocate %d bytes\n", size);
		return -ENOMEM;
	}
	for (i = 0; i < (size / 4); i++)
		pci_read_config_dword(dev, i * 4, &adapter->config_space[i]);
	return 0;
}

static void
e1000_pci_restore_state(struct e1000_adapter *adapter)
{
	struct pci_dev *dev = adapter->pdev;
	int size;
	int i;

	if (adapter->config_space == NULL)
		return;

	if (adapter->hw.mac_type >= e1000_82571)
		size = PCIE_CONFIG_SPACE_LEN;
	else
		size = PCI_CONFIG_SPACE_LEN;
	for (i = 0; i < (size / 4); i++)
		pci_write_config_dword(dev, i * 4, adapter->config_space[i]);
	kfree(adapter->config_space);
	adapter->config_space = NULL;
	return;
}
#endif /* CONFIG_PM */

static int
e1000_suspend(struct pci_dev *pdev, pm_message_t state)
{
@@ -5142,9 +5090,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
	}

#ifdef CONFIG_PM
	/* Implement our own version of pci_save_state(pdev) because pci-
	 * express adapters have 256-byte config spaces. */
	retval = e1000_pci_save_state(adapter);
	retval = pci_save_state(pdev);
	if (retval)
		return retval;
#endif
@@ -5231,7 +5177,7 @@ e1000_resume(struct pci_dev *pdev)
	uint32_t err;

	pci_set_power_state(pdev, PCI_D0);
	e1000_pci_restore_state(adapter);
	pci_restore_state(pdev);
	if ((err = pci_enable_device(pdev))) {
		printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n");
		return err;