Skip to contentSkip to conversation

net: hibmcge: support pci_driver.shutdown()

PATCH Applied Jijie Shao 2 participants 2 messages Oct 14, 2025 – Oct 17, 2025

Subsystems (4)
lore
Share & tools
lore

Jijie Shao

author maintainer
#0 lore raw

PATCH 1/1 net: hibmcge: support pci_driver.shutdown()

support pci_driver.shutdown() for hibmcge driver.

---
 .../net/ethernet/hisilicon/hibmcge/hbg_main.c   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c +17 -0
index 0b92a2e5e986..068da2fd1fea 100644
@@ -472,6 +472,22 @@ static int hbg_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	return 0;
 }
 
+static void hbg_shutdown(struct pci_dev *pdev)
+{
+	struct net_device *netdev = pci_get_drvdata(pdev);
+
+	rtnl_lock();
+	if (netif_running(netdev))
+		dev_close(netdev);
+	rtnl_unlock();
+
+	pci_disable_device(pdev);
+	pci_set_drvdata(pdev, NULL);
+
+	if (system_state == SYSTEM_POWER_OFF)
+		pci_set_power_state(pdev, PCI_D3hot);
+}
+
 static const struct pci_device_id hbg_pci_tbl[] = {
 	{PCI_VDEVICE(HUAWEI, 0x3730), 0},
 	{ }
@@ -482,6 +498,7 @@ static struct pci_driver hbg_driver = {
 	.name		= "hibmcge",
 	.id_table	= hbg_pci_tbl,
 	.probe		= hbg_probe,
+	.shutdown	= hbg_shutdown,
 };
 
 static int __init hbg_module_init(void)
Signature · 1 line
2.33.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 6 lines · On Tue, 14 Oct 2025 21:40:18 +0800 you wrote:

support pci_driver.shutdown() for hibmcge driver.

---
 .../net/ethernet/hisilicon/hibmcge/hbg_main.c   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Here is the summary with links:
- [net-next] net: hibmcge: support pci_driver.shutdown()

    https://git.kernel.org/netdev/net-next/c/0746da01767e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html