Skip to content

Commit

Permalink
netxen: implement pci driver shutdown
Browse files Browse the repository at this point in the history
Implement pci driver shutdown functionality, this helps
quiescing all PCI transaction before chipset is reset.

Amit Kumar Salecha <amit@qlogic.com>
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Amit Kumar Salecha authored and David S. Miller committed Aug 24, 2009
1 parent ce644ed commit 22b5794
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions drivers/net/netxen/netxen_nic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@ netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
netxen_p3_free_mac_list(adapter);

adapter->set_promisc(adapter, NETXEN_NIU_NON_PROMISC_MODE);

netxen_napi_disable(adapter);

netxen_release_tx_buffers(adapter);
Expand Down Expand Up @@ -1288,14 +1290,11 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)

free_netdev(netdev);
}

#ifdef CONFIG_PM
static int
netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)
static int __netxen_nic_shutdown(struct pci_dev *pdev)
{

struct netxen_adapter *adapter = pci_get_drvdata(pdev);
struct net_device *netdev = adapter->netdev;
int retval;

netif_device_detach(netdev);

Expand All @@ -1307,18 +1306,40 @@ netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)

netxen_nic_detach(adapter);

pci_save_state(pdev);
if (adapter->portnum == 0)
netxen_free_dummy_dma(adapter);

retval = pci_save_state(pdev);
if (retval)
return retval;

if (netxen_nic_wol_supported(adapter)) {
pci_enable_wake(pdev, PCI_D3cold, 1);
pci_enable_wake(pdev, PCI_D3hot, 1);
}

pci_disable_device(pdev);
pci_set_power_state(pdev, pci_choose_state(pdev, state));

return 0;
}
static void netxen_nic_shutdown(struct pci_dev *pdev)
{
if (__netxen_nic_shutdown(pdev))
return;
}
#ifdef CONFIG_PM
static int
netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)
{
int retval;

retval = __netxen_nic_shutdown(pdev);
if (retval)
return retval;

pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0;
}

static int
netxen_nic_resume(struct pci_dev *pdev)
Expand Down Expand Up @@ -2068,8 +2089,9 @@ static struct pci_driver netxen_driver = {
.remove = __devexit_p(netxen_nic_remove),
#ifdef CONFIG_PM
.suspend = netxen_nic_suspend,
.resume = netxen_nic_resume
.resume = netxen_nic_resume,
#endif
.shutdown = netxen_nic_shutdown
};

static int __init netxen_init_module(void)
Expand Down

0 comments on commit 22b5794

Please sign in to comment.