git: d2145e9b9644 - main - LinuxKPI: restore several hard coded return values for the CONFIG_PM case
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 20 Oct 2026 23:24:24 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=d2145e9b96448da34d3cfede24c509af6d830c92
commit d2145e9b96448da34d3cfede24c509af6d830c92
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-10-19 21:30:14 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-10-20 22:50:14 +0000
LinuxKPI: restore several hard coded return values for the CONFIG_PM case
drm-kmod sets CONFIG_PM (unclear if for other parts) but LinuxKPI
has no understanding of a dev->power implementation for pm_runtime.h.
The return values based on !CONFIG_PM thus cause problems to drm-kmod.
Return the previous values under CONFIG_PM but leave the TODO logging
as the actual implementation is missing and return values may not be
universally correct (beyond the known drm-kmod use cases).
The following functions having a return value but none sepcific for
CONFIG_PM as (based on drm-kmod master):
pm_runtime_resume only caller ignores the return value
pm_runtime_set_active two callers ignore the return value
pm_runtime_put_autosuspend all callers seem to ignore the return value
pm_runtime_autosuspend 2/3 callers ignore the return value;
3rd is #ifdef __linux__
pm_runtime_suspended 3/4 callers ... do check the return value
but the logic expects the false, which also
matches the previous value.
Fixes: 863fe7ae5152 ("LinuxKPI: re-implement pm_runtime.h")
Reported by: markj
MFC after: 3 days
Tested by: markj, Oleg V. Nauman (oleg.nauman gmail.com)
Differential Revision: https://reviews.freebsd.org/D60878
---
.../linuxkpi/common/include/linux/pm_runtime.h | 27 ++++++++++++++++++----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/pm_runtime.h b/sys/compat/linuxkpi/common/include/linux/pm_runtime.h
index c4fcfad2860d..ba3aaec2d0f7 100644
--- a/sys/compat/linuxkpi/common/include/linux/pm_runtime.h
+++ b/sys/compat/linuxkpi/common/include/linux/pm_runtime.h
@@ -17,11 +17,11 @@
/*
* Return values, where needed, are based on the !CONFIG_PM/!CONFIG_PM_SLEEP
* assumption given we currently do not support anything in here.
- * We could #error in case CONFIG_PM or CONFIG_PM_SLEEP are set but that
- * would likely be too intrusive for now.
- *
- * We could likely use dev_dbg() in here instead of pr_debug() if the former
- * would be mapped to the latter with additional dev information.
+ * Several values used to be hard coded in the previous implementation
+ * with the assumption that CONFIG_PM was set for the driver to compile
+ * and returned appropriate values as needed for drm-kmod. They were restored
+ * inline leaving the TODO logging available as the implementation itself is
+ * still missing as are any non-trivial dev->power bits in LinuxKPI.
*/
static inline void
@@ -132,14 +132,22 @@ static inline int
pm_runtime_get_sync(struct device *dev __unused)
{
pr_debug("%s TODO\n", __func__);
+#ifdef CONFIG_PM
+ return (0);
+#else
return (1);
+#endif
}
static inline int
pm_runtime_get_if_in_use(struct device *dev __unused)
{
pr_debug("%s TODO\n", __func__);
+#ifdef CONFIG_PM
+ return (1);
+#else
return (-EINVAL);
+#endif
}
#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION < 60900
@@ -151,14 +159,23 @@ pm_runtime_get_if_active(struct device *dev __unused)
#endif
{
pr_debug("%s TODO\n", __func__);
+#ifdef CONFIG_PM
+ return (1);
+#else
return (-EINVAL);
+#endif
+
}
static inline int
pm_runtime_resume_and_get(struct device *dev __unused)
{
pr_debug("%s TODO\n", __func__);
+#ifdef CONFIG_PM
+ return (0);
+#else
return (1);
+#endif
}
#endif /* _LINUXKPI_LINUX_PM_RUNTIME_H_ */