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);