From 59cbead6b15fd2320fa0a98dc680aef5d6e1438f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Sat, 9 Dec 2023 17:24:20 +0100 Subject: [PATCH] linuxkpi: Add support for `suspend_noirq` callback in `struct dev_pm_ops` [Why] This callback is being used by the amdgpu DRM driver in Linux 5.18. [How] The callback is called after `suspend_late()`. Reviewed by: emaste, manu Approved by: emaste, manu Differential Revision: https://reviews.freebsd.org/D43029 --- sys/compat/linuxkpi/common/include/linux/device.h | 1 + sys/compat/linuxkpi/common/src/linux_pci.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index df06b356e0923c..7a5d813063a9bb 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -81,6 +81,7 @@ struct dev_pm_ops { int (*poweroff_late)(struct device *dev); int (*restore)(struct device *dev); int (*restore_early)(struct device *dev); + int (*suspend_noirq)(struct device *dev); int (*runtime_suspend)(struct device *dev); int (*runtime_resume)(struct device *dev); int (*runtime_idle)(struct device *dev); diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 99750d5ced26e1..852cec9cdc948c 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -643,6 +643,8 @@ linux_pci_suspend(device_t dev) error = -pmops->suspend(&pdev->dev); if (error == 0 && pmops->suspend_late != NULL) error = -pmops->suspend_late(&pdev->dev); + if (error == 0 && pmops->suspend_noirq != NULL) + error = -pmops->suspend_noirq(&pdev->dev); } return (error); }