Skip to content

spacemit: rtl8852bs: guard GCC-only warning flags for clang builds#10139

Merged
igorpecovnik merged 1 commit into
armbian:mainfrom
iav:spacemit-rtl8852bs-clang-guard
Jul 7, 2026
Merged

spacemit: rtl8852bs: guard GCC-only warning flags for clang builds#10139
igorpecovnik merged 1 commit into
armbian:mainfrom
iav:spacemit-rtl8852bs-clang-guard

Conversation

@iav

@iav iav commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Description

The rtl8852bs driver bundled in the spacemit vendor kernel adds two GCC-only warning options unconditionally in its Makefile:

ccflags-y += -Wno-restrict
ccflags-y += -Wno-old-style-declaration

clang does not know these options, and with the kernel's -Werror=unknown-warning-option the build fails:

error: unknown warning option '-Wno-restrict' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wno-old-style-declaration'

On the spacemit family the driver is in-tree and EXTRAWIFI is forced off in the family config, so it cannot be excluded — this breaks every clang kernel build for the family.

Fix: wrap the two GCC-only flags in $(call cc-disable-warning, ...), so each is added only for a compiler that understands the positive warning name (GCC). This is also robust against CC carrying a ccache prefix, unlike the ifeq ($(CC), clang) compare further down the same Makefile. The remaining -Wno-* in that block (unused, empty-body, missing-prototypes, missing-declarations) are understood by clang and left untouched. GCC behaviour is unchanged.

How Has This Been Tested?

Kernel build for bananapif3 (spacemit, kernel 6.18):

  • GCC full build: rtl8852bs (372 objects) + 8852bs.ko + linux-image .deb — 0 errors.
  • clang full build with the driver enabled: 8852bs.ko built under clang, 0 unknown-warning-option / 0 errors, linux-image .deb produced.

Repro:

./compile.sh kernel BOARD=bananapif3 BRANCH=current KERNEL_COMPILER=clang

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings

Summary by CodeRabbit

  • Bug Fixes
    • Improved wireless driver build compatibility by avoiding compiler flags that can break clang-based builds.
    • Reduced build failures caused by unsupported warning options while keeping GCC-compatible warning handling intact.

The in-tree rtl8852bs Makefile adds -Wno-restrict and
-Wno-old-style-declaration unconditionally. clang rejects these GCC-only
options and the kernel's -Werror=unknown-warning-option makes it fatal,
breaking every clang kernel build for spacemit (rtl8852bs is in-tree
there, EXTRAWIFI is forced off in the family config). Wrap both flags in
$(call cc-disable-warning, ...) so each is added only for compilers that
know the positive warning name (GCC), robust against a ccache CC prefix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@iav iav requested review from pyavitz and sven-ola as code owners July 7, 2026 14:17
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change modifies a kernel patch file for the rtl8852bs wireless driver Makefile, converting unconditional GCC-only warning suppression flags (-Wno-restrict, -Wno-old-style-declaration) into conditional flags using cc-disable-warning, avoiding build failures on clang.

Changes

rtl8852bs Patch Update

Layer / File(s) Summary
Conditional warning suppression
patch/kernel/archive/spacemit-6.18/020-rtl8852bs-guard-gcc-only-warnings-for-clang.patch
Replaces unconditional `-Wno-restrict` and `-Wno-old-style-declaration` flags with `$(call cc-disable-warning, ...)` equivalents so they only apply when the compiler supports them.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: guarding GCC-only warning flags for clang builds in rtl8852bs.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added 08 Milestone: Third quarter release size/small PR with less then 50 lines Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Jul 7, 2026
@github-actions github-actions Bot added the Ready to merge Reviewed, tested and ready for merge label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot removed the Needs review Seeking for review label Jul 7, 2026
@igorpecovnik igorpecovnik merged commit 4a096f7 into armbian:main Jul 7, 2026
13 checks passed
@iav iav deleted the spacemit-rtl8852bs-clang-guard branch July 7, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 Milestone: Third quarter release Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

3 participants