git: 28ca279559d3 - stable/15 - LinuxKPI: add can_wakeup option and accessor functions

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sat, 19 Sep 2026 14:40:31 UTC
The branch stable/15 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=28ca279559d3ff80af69cb3e1e32cb3e6246be47

commit 28ca279559d3ff80af69cb3e1e32cb3e6246be47
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-08-16 22:05:42 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-09-19 09:34:11 +0000

    LinuxKPI: add can_wakeup option and accessor functions
    
    We can implement device_set_wakeup_capable() in the !CONFIG_PM_SLEEP
    case;  we do not have the infrastructure in place for the CONFIG_PM_SLEEP
    case so leave a pr_debug TODO.
    
    Needed by an upcoming wireless driver.
    
    Reviewed by:    dumbbell
    Differential Revision: https://reviews.freebsd.org/D58883
    
    (cherry picked from commit a424fb3519ebf8fb972e7ba45ba19df322992b00)
---
 sys/compat/linuxkpi/common/include/linux/pm.h | 17 +++++++++++++++++
 sys/compat/linuxkpi/common/src/linux_compat.c |  6 ++++++
 2 files changed, 23 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/pm.h b/sys/compat/linuxkpi/common/include/linux/pm.h
index 932697e0eda8..baf1c152a310 100644
--- a/sys/compat/linuxkpi/common/include/linux/pm.h
+++ b/sys/compat/linuxkpi/common/include/linux/pm.h
@@ -49,6 +49,7 @@ struct dev_pm_domain {
 
 struct dev_pm_info {
 	atomic_t usage_count;
+	bool can_wakeup;
 };
 
 #define	PM_EVENT_FREEZE		0x0001
@@ -111,4 +112,20 @@ pm_vt_switch_unregister(struct device *dev __unused)
 {
 }
 
+#ifdef CONFIG_PM_SLEEP
+static inline void
+device_set_wakeup_capable(struct device *dev __unused, bool capable __unused)
+{
+	pr_debug("%s: TODO\n", __func__);
+}
+#else
+void linuxkpi_device_set_wakeup_capable(struct device *, bool);
+
+static inline void
+device_set_wakeup_capable(struct device *dev, bool capable)
+{
+	linuxkpi_device_set_wakeup_capable(dev, capable);
+}
+#endif
+
 #endif	/* _LINUXKPI_LINUX_PM_H */
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 31fd80faac1d..5b16531e42ed 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -2818,6 +2818,12 @@ device_can_wakeup(struct device *dev)
 	return (false);
 }
 
+void
+linuxkpi_device_set_wakeup_capable(struct device *dev, bool capable)
+{
+	dev->power.can_wakeup = capable;
+}
+
 static void
 devm_device_group_remove(struct device *dev, void *p)
 {