git: 59cbead6b15f - main - linuxkpi: Add support for `suspend_noirq` callback in `struct dev_pm_ops`

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 13 Dec 2023 18:28:50 UTC
The branch main has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=59cbead6b15fd2320fa0a98dc680aef5d6e1438f

commit 59cbead6b15fd2320fa0a98dc680aef5d6e1438f
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-12-09 16:24:20 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-12-13 18:18:47 +0000

    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 df06b356e092..7a5d813063a9 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 99750d5ced26..852cec9cdc94 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);
 }