From: Vaibhav Gupta <vaibhavgupta40@gmail.com>
To: Bjorn Helgaas <helgaas@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Bjorn Helgaas <bjorn@helgaas.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Vaibhav Gupta <vaibhavgupta40@gmail.com>,
Carolina Jubran <cjubran@nvidia.com>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2] net/mlx5: Use generic power management
Date: Fri, 4 Dec 2026 19:52:52 +0100 [thread overview]
Message-ID: <20261204185308.6819-1-vaibhavgupta40@gmail.com> (raw)
In-Reply-To: <dbcb3cfa-25e0-40c8-a3fa-e381a8db5445@nvidia.com>
Switch to the generic power management and remove the usage of legacy
(pci_driver) hooks.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
---
v2: The patch itself is no different than v1. v2 because it has been
resigned and compile tested after rebasing it over linux-next-20261204
and torvalds-linux at commit 8dac6df92a2e.
---
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 0439fcfb9ce5..faa6f16fad9b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -2209,8 +2209,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);
@@ -2218,13 +2219,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),
@@ -2286,8 +2290,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.1
next prev parent reply other threads:[~2026-12-04 18:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 19:41 [PATCH v1] net/mlx5: Use generic power management Vaibhav Gupta
2026-10-18 19:41 ` netdev-bot+sashiko
2026-10-28 6:29 ` Carolina Jubran
[not found] ` <CAP+cEOMaiHDRW+YAdPdj795pntKLUCQDB1E=vM4cjNfvPqTWvA@mail.gmail.com>
2026-11-25 6:45 ` Carolina Jubran
2026-12-04 18:52 ` Vaibhav Gupta [this message]
2026-10-22 19:41 ` Tariq Toukan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204185308.6819-1-vaibhavgupta40@gmail.com \
--to=vaibhavgupta40@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=bhelgaas@google.com \
--cc=bjorn@helgaas.com \
--cc=cjubran@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=helgaas@kernel.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox