Commit 83f6e152 authored by Brice Goglin's avatar Brice Goglin Committed by Jeff Garzik

myri10ge: no need to save MSI and PCIe state in the driver

The PCI MSI and express state are already saved and restored by the
current versions of pci_save_state/pci_restore_state.
Therefore it is no longer necessary for the driver to do it.
Signed-off-by: default avatarBrice Goglin <brice@myri.com>
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 3621cec5
...@@ -199,8 +199,6 @@ struct myri10ge_priv { ...@@ -199,8 +199,6 @@ struct myri10ge_priv {
unsigned long serial_number; unsigned long serial_number;
int vendor_specific_offset; int vendor_specific_offset;
int fw_multicast_support; int fw_multicast_support;
u32 devctl;
u16 msi_flags;
u32 read_dma; u32 read_dma;
u32 write_dma; u32 write_dma;
u32 read_write_dma; u32 read_write_dma;
...@@ -2520,34 +2518,6 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp) ...@@ -2520,34 +2518,6 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
} }
} }
static void myri10ge_save_state(struct myri10ge_priv *mgp)
{
struct pci_dev *pdev = mgp->pdev;
int cap;
pci_save_state(pdev);
/* now save PCIe and MSI state that Linux will not
* save for us */
cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
pci_read_config_dword(pdev, cap + PCI_EXP_DEVCTL, &mgp->devctl);
cap = pci_find_capability(pdev, PCI_CAP_ID_MSI);
pci_read_config_word(pdev, cap + PCI_MSI_FLAGS, &mgp->msi_flags);
}
static void myri10ge_restore_state(struct myri10ge_priv *mgp)
{
struct pci_dev *pdev = mgp->pdev;
int cap;
/* restore PCIe and MSI state that linux will not */
cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
pci_write_config_dword(pdev, cap + PCI_CAP_ID_EXP, mgp->devctl);
cap = pci_find_capability(pdev, PCI_CAP_ID_MSI);
pci_write_config_word(pdev, cap + PCI_MSI_FLAGS, mgp->msi_flags);
pci_restore_state(pdev);
}
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state) static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state)
...@@ -2568,7 +2538,7 @@ static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -2568,7 +2538,7 @@ static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state)
rtnl_unlock(); rtnl_unlock();
} }
myri10ge_dummy_rdma(mgp, 0); myri10ge_dummy_rdma(mgp, 0);
myri10ge_save_state(mgp); pci_save_state(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
pci_set_power_state(pdev, pci_choose_state(pdev, state)); pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0; return 0;
...@@ -2593,7 +2563,8 @@ static int myri10ge_resume(struct pci_dev *pdev) ...@@ -2593,7 +2563,8 @@ static int myri10ge_resume(struct pci_dev *pdev)
mgp->dev->name); mgp->dev->name);
return -EIO; return -EIO;
} }
myri10ge_restore_state(mgp);
pci_restore_state(pdev);
status = pci_enable_device(pdev); status = pci_enable_device(pdev);
if (status < 0) { if (status < 0) {
...@@ -2608,7 +2579,7 @@ static int myri10ge_resume(struct pci_dev *pdev) ...@@ -2608,7 +2579,7 @@ static int myri10ge_resume(struct pci_dev *pdev)
/* Save configuration space to be restored if the /* Save configuration space to be restored if the
* nic resets due to a parity error */ * nic resets due to a parity error */
myri10ge_save_state(mgp); pci_save_state(pdev);
if (netif_running(netdev)) { if (netif_running(netdev)) {
rtnl_lock(); rtnl_lock();
...@@ -2674,10 +2645,10 @@ static void myri10ge_watchdog(struct work_struct *work) ...@@ -2674,10 +2645,10 @@ static void myri10ge_watchdog(struct work_struct *work)
* when the driver was loaded, or the last time the * when the driver was loaded, or the last time the
* nic was resumed from power saving mode. * nic was resumed from power saving mode.
*/ */
myri10ge_restore_state(mgp); pci_restore_state(mgp->pdev);
/* save state again for accounting reasons */ /* save state again for accounting reasons */
myri10ge_save_state(mgp); pci_save_state(mgp->pdev);
} else { } else {
/* if we get back -1's from our slot, perhaps somebody /* if we get back -1's from our slot, perhaps somebody
...@@ -2917,7 +2888,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2917,7 +2888,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* Save configuration space to be restored if the /* Save configuration space to be restored if the
* nic resets due to a parity error */ * nic resets due to a parity error */
myri10ge_save_state(mgp); pci_save_state(pdev);
/* Setup the watchdog timer */ /* Setup the watchdog timer */
setup_timer(&mgp->watchdog_timer, myri10ge_watchdog_timer, setup_timer(&mgp->watchdog_timer, myri10ge_watchdog_timer,
...@@ -2937,7 +2908,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2937,7 +2908,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0; return 0;
abort_with_state: abort_with_state:
myri10ge_restore_state(mgp); pci_restore_state(pdev);
abort_with_firmware: abort_with_firmware:
myri10ge_dummy_rdma(mgp, 0); myri10ge_dummy_rdma(mgp, 0);
...@@ -2992,7 +2963,7 @@ static void myri10ge_remove(struct pci_dev *pdev) ...@@ -2992,7 +2963,7 @@ static void myri10ge_remove(struct pci_dev *pdev)
myri10ge_dummy_rdma(mgp, 0); myri10ge_dummy_rdma(mgp, 0);
/* avoid a memory leak */ /* avoid a memory leak */
myri10ge_restore_state(mgp); pci_restore_state(pdev);
bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry);
dma_free_coherent(&pdev->dev, bytes, dma_free_coherent(&pdev->dev, bytes,
......
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