From f0cd29a3400cb9af192842c3e2bcc90cc08c68ca Mon Sep 17 00:00:00 2001 From: Markus Fritsche Date: Wed, 20 May 2026 10:15:24 +0200 Subject: [PATCH] =?UTF-8?q?kernel:=20v4l2=5Ffh=5Fadd/del=20gained=20file*?= =?UTF-8?q?=20arg=20in=206.18=20=E2=80=94=20version-conditional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DKMS build failure on higgs (Pi CM5, kernel 6.18.29+rpt-rpi-2712): daedalus_v4l2_main.c:1049: error: too few arguments to function 'v4l2_fh_add' v4l2-fh.h:97: void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp); daedalus_v4l2_main.c:1063: error: too few arguments to function 'v4l2_fh_del' Signature changed exactly at v6.18 (verified v6.13–v6.17 still use the one-arg form via raw.githubusercontent.com tag walk). Wrap the calls with LINUX_VERSION_CODE >= KERNEL_VERSION(6, 18, 0) so the module keeps building against: * 6.12 LTS / RPi 6.12.75 (one-arg) — hertz * 6.12.88+deb13-arm64 (one-arg) * 6.18.29+rpt-rpi-2712 (file* arg) — higgs running kernel Build verified on both: hertz 6.12.75 clean, higgs 6.18.29 clean + modprobe daedalus_v4l2 succeeds, /dev/daedalus-v4l2 + /dev/video0 appear. Add #include for KERNEL_VERSION + LINUX_VERSION_CODE (also pulled transitively via module.h but explicit is better than implicit). Co-Authored-By: Claude Opus 4.7 (1M context) --- kernel/daedalus_v4l2_main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernel/daedalus_v4l2_main.c b/kernel/daedalus_v4l2_main.c index f3830a5..b066c02 100644 --- a/kernel/daedalus_v4l2_main.c +++ b/kernel/daedalus_v4l2_main.c @@ -30,6 +30,7 @@ #include #include +#include /* LINUX_VERSION_CODE / KERNEL_VERSION */ #include #include #include @@ -1046,7 +1047,16 @@ static int daedalus_open(struct file *file) goto err_ctrl; } ctx->fh.m2m_ctx = ctx->m2m_ctx; + /* + * v4l2_fh_add/del gained a `struct file *filp` second arg in + * Linux 6.18 (commit landing between v6.17 and v6.18 tags). + * Keep building against both 6.12 LTS (no filp arg) and 6.18+. + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 18, 0) + v4l2_fh_add(&ctx->fh, file); +#else v4l2_fh_add(&ctx->fh); +#endif return 0; err_ctrl: @@ -1060,7 +1070,11 @@ static int daedalus_release(struct file *file) { struct daedalus_ctx *ctx = file_to_ctx(file); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 18, 0) + v4l2_fh_del(&ctx->fh, file); +#else v4l2_fh_del(&ctx->fh); +#endif v4l2_m2m_ctx_release(ctx->m2m_ctx); v4l2_ctrl_handler_free(&ctx->hdl); v4l2_fh_exit(&ctx->fh);