Skip to content

Commit

Permalink
tg3: Implement the shutdown handler
Browse files Browse the repository at this point in the history
Also remove the call to tg3_power_down_prepare() in tg3_power_down()
since tg3_close() calls it.

Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nithin Sujir authored and David S. Miller committed Jul 30, 2013
1 parent 5137a2e commit 4c305fa
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -4226,8 +4226,6 @@ static int tg3_power_down_prepare(struct tg3 *tp)

static void tg3_power_down(struct tg3 *tp)
{
tg3_power_down_prepare(tp);

pci_wake_from_d3(tp->pdev, tg3_flag(tp, WOL_ENABLE));
pci_set_power_state(tp->pdev, PCI_D3hot);
}
Expand Down Expand Up @@ -17743,6 +17741,23 @@ static int tg3_resume(struct device *device)

static SIMPLE_DEV_PM_OPS(tg3_pm_ops, tg3_suspend, tg3_resume);

static void tg3_shutdown(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct tg3 *tp = netdev_priv(dev);

rtnl_lock();
netif_device_detach(dev);

if (netif_running(dev))
dev_close(dev);

if (system_state == SYSTEM_POWER_OFF)
tg3_power_down(tp);

rtnl_unlock();
}

/**
* tg3_io_error_detected - called when PCI error is detected
* @pdev: Pointer to PCI device
Expand Down Expand Up @@ -17898,6 +17913,7 @@ static struct pci_driver tg3_driver = {
.remove = tg3_remove_one,
.err_handler = &tg3_err_handler,
.driver.pm = &tg3_pm_ops,
.shutdown = tg3_shutdown,
};

module_pci_driver(tg3_driver);

0 comments on commit 4c305fa

Please sign in to comment.