Switch to the generic power management and remove the usage of legacy (pci_driver) hooks. Signed-off-by: Vaibhav Gupta <vaib…@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