Skip to content

Commit d196ece

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Add pci shutdown method.
Add pci shutdown method to put device in the proper WoL and power state. Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c1ef146 commit d196ece

File tree

1 file changed

+31
-0
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+31
-0
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7617,6 +7617,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
76177617
goto init_err_pci_clean;
76187618

76197619
bnxt_get_wol_settings(bp);
7620+
if (bp->flags & BNXT_FLAG_WOL_CAP)
7621+
device_set_wakeup_enable(&pdev->dev, bp->wol);
7622+
else
7623+
device_set_wakeup_capable(&pdev->dev, false);
76207624

76217625
rc = register_netdev(dev);
76227626
if (rc)
@@ -7641,6 +7645,32 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
76417645
return rc;
76427646
}
76437647

7648+
static void bnxt_shutdown(struct pci_dev *pdev)
7649+
{
7650+
struct net_device *dev = pci_get_drvdata(pdev);
7651+
struct bnxt *bp;
7652+
7653+
if (!dev)
7654+
return;
7655+
7656+
rtnl_lock();
7657+
bp = netdev_priv(dev);
7658+
if (!bp)
7659+
goto shutdown_exit;
7660+
7661+
if (netif_running(dev))
7662+
dev_close(dev);
7663+
7664+
if (system_state == SYSTEM_POWER_OFF) {
7665+
bnxt_clear_int_mode(bp);
7666+
pci_wake_from_d3(pdev, bp->wol);
7667+
pci_set_power_state(pdev, PCI_D3hot);
7668+
}
7669+
7670+
shutdown_exit:
7671+
rtnl_unlock();
7672+
}
7673+
76447674
/**
76457675
* bnxt_io_error_detected - called when PCI error is detected
76467676
* @pdev: Pointer to PCI device
@@ -7757,6 +7787,7 @@ static struct pci_driver bnxt_pci_driver = {
77577787
.id_table = bnxt_pci_tbl,
77587788
.probe = bnxt_init_one,
77597789
.remove = bnxt_remove_one,
7790+
.shutdown = bnxt_shutdown,
77607791
.err_handler = &bnxt_err_handler,
77617792
#if defined(CONFIG_BNXT_SRIOV)
77627793
.sriov_configure = bnxt_sriov_configure,

0 commit comments

Comments
 (0)