fix(ccs): handle 1-param pm_runtime_get_if_active (issue #92) - #96
Open
Till0196 wants to merge 1 commit into
Open
fix(ccs): handle 1-param pm_runtime_get_if_active (issue #92)#96Till0196 wants to merge 1 commit into
Till0196 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes build failures on kernels where pm_runtime_get_if_active() has been backported to the newer 1-parameter form (e.g., Ubuntu 6.8), while existing backport patches expect the older 2-parameter form.
Changes:
- Extend
make_config_compat.plto detect whether the kernel headers expose the 2-parameterpm_runtime_get_if_active()variant. - Add a conditional compat macro in
v4l/compat.hto drop the second argument when only the 1-parameter API exists.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| v4l/scripts/make_config_compat.pl | Adds header scanning to decide whether a compat wrapper is needed for pm_runtime_get_if_active(). |
| v4l/compat.h | Provides a conditional macro wrapper to make 2-arg call sites compile against 1-arg kernels. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…kport kernel 6.9 API (issue tbsdtv#92) v6.8-ccs.patch correctly adds the 2-param form for mainline kernels <= 6.8, but some distributions (e.g. Ubuntu 6.8) backport the simplified 1-param pm_runtime_get_if_active() from 6.9+, causing a "too many arguments" error. Detect the 2-param variant by matching the prototype pattern "pm_runtime_get_if_active[^)]*bool" in the kernel's pm_runtime.h via make_config_compat.pl. This matches on the presence of a bool second parameter rather than a specific parameter name, making the check robust across vendor/backport trees that may rename the parameter. When the pattern is absent (1-param kernel), NEED_PM_RUNTIME_GET_IF_ACTIVE_WRAPPER is defined and compat.h provides a variadic macro that drops the second argument. The (pm_runtime_get_if_active) notation prevents recursive macro expansion and avoids forward-declaration issues since compat.h is force-included before kernel headers. Existing patches (v6.8-ccs.patch, v5.6_pm_runtime_get_if_active.patch) and their stacking order are left unchanged.
Till0196
force-pushed
the
fix/ccs-pm-runtime
branch
from
April 6, 2026 05:38
92382ed to
eb535f5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(ccs): handle 1-param pm_runtime_get_if_active (issue #92)
Fixes #92
Problem
v6.8-ccs.patchchangespm_runtime_get_if_active()to its 2-param form forkernels ≤ 6.8. This is correct for mainline kernels 5.6–6.8, which introduced
the
bool ign_usage_countparameter.However, some distributions backport the simplified 1-param form from
kernel 6.9+ to their 6.8 kernel (e.g. Ubuntu 6.8). On those kernels the patched
2-param call fails to compile:
Fix
Detect which variant the kernel exposes by matching the prototype pattern
pm_runtime_get_if_active[^)]*boolininclude/linux/pm_runtime.hviamake_config_compat.pl. This matches on the presence of aboolsecondparameter rather than a specific parameter name, making the check robust
across vendor/backport trees that may rename the parameter:
When the pattern is absent (1-param kernel),
NEED_PM_RUNTIME_GET_IF_ACTIVE_WRAPPERis defined and
compat.hprovides a variadic macro that drops the second argument:The
(pm_runtime_get_if_active)notation prevents recursive macro expansion.A macro is used instead of a
static inlinewrapper becausecompat.hisforce-included before kernel headers, so the function is not yet declared at
that point.
v6.8-ccs.patchandv5.6_pm_runtime_get_if_active.patchare left unchanged.Testing
Verified that the build completes without errors on Ubuntu 6.8.0-107-generic,
which ships the 1-param variant of
pm_runtime_get_if_active.