* [PATCH v1] net/mlx5: Use generic power management
@ 2026-10-17 19:41 Vaibhav Gupta
0 siblings, 0 replies; only message in thread
From: Vaibhav Gupta @ 2026-10-17 19:41 UTC (permalink / raw)
To: Bjorn Helgaas, Bjorn Helgaas, Bjorn Helgaas, Saeed Mahameed,
Leon Romanovsky, Tariq Toukan, Mark Bloch, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Vaibhav Gupta, netdev, linux-rdma, linux-kernel
Switch to the generic power management and remove the usage of legacy
(pci_driver) hooks.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 5f28d906c35b..d8dba3328bb6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -2204,8 +2204,9 @@ static void shutdown(struct pci_dev *pdev)
mlx5_pci_disable_device(dev);
}
-static int mlx5_suspend(struct pci_dev *pdev, pm_message_t state)
+static int mlx5_suspend(struct device *device)
{
+ struct pci_dev *pdev = to_pci_dev(device);
struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
mlx5_unload_one(dev, true);
@@ -2213,13 +2214,16 @@ static int mlx5_suspend(struct pci_dev *pdev, pm_message_t state)
return 0;
}
-static int mlx5_resume(struct pci_dev *pdev)
+static int mlx5_resume(struct device *device)
{
+ struct pci_dev *pdev = to_pci_dev(device);
struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
return mlx5_load_one(dev, false);
}
+static DEFINE_SIMPLE_DEV_PM_OPS(mlx5_pm_ops, mlx5_suspend, mlx5_resume);
+
static const struct pci_device_id mlx5_core_pci_table[] = {
{ PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_CONNECTIB) },
{ PCI_VDEVICE(MELLANOX, 0x1012),
@@ -2281,8 +2285,7 @@ static struct pci_driver mlx5_core_driver = {
.id_table = mlx5_core_pci_table,
.probe = probe_one,
.remove = remove_one,
- .suspend = mlx5_suspend,
- .resume = mlx5_resume,
+ .driver.pm = pm_sleep_ptr(&mlx5_pm_ops),
.shutdown = shutdown,
.err_handler = &mlx5_err_handler,
.sriov_configure = mlx5_core_sriov_configure,
--
2.56.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-17 19:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-17 19:41 [PATCH v1] net/mlx5: Use generic power management Vaibhav Gupta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®