e100: Do suspend/shutdown like e1000
This fixes a "trying to free already free IRQ" message and simplifies the shutdown/suspend code by re-using already existing code when going to suspend. The code is now symmetric with e100_resume. Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
@@ -2782,16 +2782,13 @@ static void __devexit e100_remove(struct pci_dev *pdev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
|
||||||
static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
|
static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
|
||||||
{
|
{
|
||||||
struct net_device *netdev = pci_get_drvdata(pdev);
|
struct net_device *netdev = pci_get_drvdata(pdev);
|
||||||
struct nic *nic = netdev_priv(netdev);
|
struct nic *nic = netdev_priv(netdev);
|
||||||
|
|
||||||
if (netif_running(netdev))
|
if (netif_running(netdev))
|
||||||
napi_disable(&nic->napi);
|
e100_down(nic);
|
||||||
del_timer_sync(&nic->watchdog);
|
|
||||||
netif_carrier_off(nic->netdev);
|
|
||||||
netif_device_detach(netdev);
|
netif_device_detach(netdev);
|
||||||
|
|
||||||
pci_save_state(pdev);
|
pci_save_state(pdev);
|
||||||
@@ -2804,14 +2801,13 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
|
|||||||
pci_enable_wake(pdev, PCI_D3cold, 0);
|
pci_enable_wake(pdev, PCI_D3cold, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
free_irq(pdev->irq, netdev);
|
|
||||||
|
|
||||||
pci_disable_device(pdev);
|
pci_disable_device(pdev);
|
||||||
pci_set_power_state(pdev, PCI_D3hot);
|
pci_set_power_state(pdev, PCI_D3hot);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_PM
|
||||||
static int e100_resume(struct pci_dev *pdev)
|
static int e100_resume(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
struct net_device *netdev = pci_get_drvdata(pdev);
|
struct net_device *netdev = pci_get_drvdata(pdev);
|
||||||
@@ -2832,26 +2828,7 @@ static int e100_resume(struct pci_dev *pdev)
|
|||||||
|
|
||||||
static void e100_shutdown(struct pci_dev *pdev)
|
static void e100_shutdown(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
struct net_device *netdev = pci_get_drvdata(pdev);
|
e100_suspend(pdev, PMSG_SUSPEND);
|
||||||
struct nic *nic = netdev_priv(netdev);
|
|
||||||
|
|
||||||
if (netif_running(netdev))
|
|
||||||
napi_disable(&nic->napi);
|
|
||||||
del_timer_sync(&nic->watchdog);
|
|
||||||
netif_carrier_off(nic->netdev);
|
|
||||||
|
|
||||||
if ((nic->flags & wol_magic) | e100_asf(nic)) {
|
|
||||||
pci_enable_wake(pdev, PCI_D3hot, 1);
|
|
||||||
pci_enable_wake(pdev, PCI_D3cold, 1);
|
|
||||||
} else {
|
|
||||||
pci_enable_wake(pdev, PCI_D3hot, 0);
|
|
||||||
pci_enable_wake(pdev, PCI_D3cold, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
free_irq(pdev->irq, netdev);
|
|
||||||
|
|
||||||
pci_disable_device(pdev);
|
|
||||||
pci_set_power_state(pdev, PCI_D3hot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------ PCI Error Recovery infrastructure -------------- */
|
/* ------------------ PCI Error Recovery infrastructure -------------- */
|
||||||
|
Reference in New Issue
Block a user