customhidsony: fix DKMS build failures on kernel >= 6.12#4192
Open
manzolo wants to merge 1 commit intoRetroPie:masterfrom
Open
customhidsony: fix DKMS build failures on kernel >= 6.12#4192manzolo wants to merge 1 commit intoRetroPie:masterfrom
manzolo wants to merge 1 commit intoRetroPie:masterfrom
Conversation
Two kernel API changes break the hid-sony DKMS module when building against kernel >= 6.12: 1. asm/unaligned.h was removed; the replacement is linux/unaligned.h. Detect this at DKMS pre-build time using the kernel version and patch the downloaded hid-sony.c source accordingly. 2. The hid_driver.report_fixup callback return type changed from u8* to const u8* (kernel >= 6.2). The old rpi-5.10.y source still uses the non-const signature, causing -Werror=incompatible-pointer-types to fail the build. Suppress the error via ccflags-y since promoting u8* to const u8* is always safe. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Two kernel API changes break the hid-sony DKMS module when building against kernel >= 6.12 (Ubuntu 24.10+):
1.
asm/unaligned.hremoved (kernel >= 6.12)The hid-sony source downloaded from
rpi-5.10.yincludes<asm/unaligned.h>, which was removed in kernel 6.12 in favour of<linux/unaligned.h>. Build error:Fix: detect the kernel version in the DKMS
PRE_BUILDscript and replace the include viasedwhenkernel >= 6.12.2.
hid_driver.report_fixupreturn type changed toconst u8 *(kernel >= 6.2)The old source has
sony_report_fixupreturningu8 *, but newer kernel headers expectconst u8 *, causing-Werror=incompatible-pointer-typesto abort the build:Fix: add
ccflags-y += -Wno-error=incompatible-pointer-typesto the DKMSMakefile. Promotingu8 *toconst u8 *is always safe. On older kernels the flag is a no-op.Backwards compatibility
asm/unaligned.hreplacement: guarded by kernel version check, no change on kernel < 6.12ccflags-yflag: no-op on kernels where the type already matchesTest
Verified on Ubuntu 26.04 / kernel 7.0.0-14-generic and kernel 6.17.0-22-generic.