Skip to content

Commit 2c71459

Browse files
lrgirdwoclaude
andcommitted
ci: codestyle: fail on kernel-only includes from user-space code
Run the include checker on the source tree in the codestyle workflow, so that a pull request that includes a header from src/kernel/include in user-space code fails without waiting for the firmware builds, and also when no CI configuration compiles the file. Describe it in the src/kernel README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 3c2887c commit 2c71459

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎.github/workflows/codestyle.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,14 @@ jobs:
3838
run: yamllint -f parsable
3939
-d "$yamllint_config"
4040
--strict .github/workflows/*.yml *.yml
41+
42+
kernel-includes:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
46+
with:
47+
filter: 'tree:0'
48+
49+
- name: no kernel-only headers in user-space code
50+
# see scripts/check_kernel_includes.py
51+
run: python3 scripts/check_kernel_includes.py --sources --strict

‎src/kernel/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ Kernel-only headers are in [`include/sof/kernel`](include/sof/kernel) and are in
3030
`<sof/kernel/platform.h>`. The directory is on the include path of the firmware, the host
3131
library and the testbench, but not of LLEXT modules. Kernel-only headers that the host builds
3232
replace with their own versions, such as the `rtos/` headers, have not moved yet.
33+
User-space code must not include anything from here: the `codestyle` CI workflow runs
34+
`scripts/check_kernel_includes.py --sources`, which fails when a user-space source or header
35+
includes `<sof/kernel/...>`.
3336

3437
Code here may use kernel-only headers. User-space code must not call into it directly. The
3538
checker in `scripts/check_kernel_includes.py` reports kernel-only includes from user-space

0 commit comments

Comments
 (0)