Package: v4l2loopback-dkms
Tags: patch
Followup-For: Bug #1108287
X-Debbugs-Cc: s...@debian.org

Hi,

here's a patch that seems to work for me.

Two parts, one that is technically optional because that header already
gets included indirectly, and the actual fix, which is to use the new name
for the renamed macro, and provide a fallback #define for older versions,
which includes the version shipped in trixie.

   Simon

-- System Information:
Debian Release: 13.0
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing-debug'), (500, 
'testing'), (1, 'experimental')
Architecture: ppc64el (ppc64le)

Kernel: Linux 6.16.0-rc6+ (SMP w/64 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages v4l2loopback-dkms depends on:
ii  dkms  3.2.0-1

v4l2loopback-dkms recommends no packages.

Versions of packages v4l2loopback-dkms suggests:
ii  v4l2loopback-utils  0.15.0-2.1

-- no debconf information
Description: Add <linux/timer.h> include
 The code checks for the "timer_setup" macro, which is defined in this header.
Author: Simon Richter <s...@debian.org>
Bug-Debian: https://bugs.debian.org/1108287
Forwarded: no
Last-Update: 2025-07-22

--- v4l2loopback-0.15.0.orig/v4l2loopback.c
+++ v4l2loopback-0.15.0/v4l2loopback.c
@@ -23,6 +23,7 @@
 #include <linux/slab.h>
 #include <linux/fs.h>
 #include <linux/capability.h>
+#include <linux/timer.h>
 #include <linux/eventpoll.h>
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-common.h>
Description: Use timer_container_of instead of from_timer
 This interface got renamed, so use the new name and add a compatibility
 #define.
Author: Simon Richter <s...@debian.org>
Bug-Debian: https://bugs.debian.org/1108287
Forwarded: no
Last-Update: 2025-07-22

--- v4l2loopback-0.15.0.orig/v4l2loopback.c
+++ v4l2loopback-0.15.0/v4l2loopback.c
@@ -46,10 +46,14 @@
 #define strscpy strlcpy
 #endif
 
-#if defined(timer_setup) && defined(from_timer)
+#if defined(timer_setup) && (defined(from_timer) || 
defined(timer_container_of))
 #define HAVE_TIMER_SETUP
 #endif
 
+#if !defined(timer_container_of) && defined(from_timer)
+#define timer_container_of(var, timer, field) from_timer(var, timer, field)
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 7, 0)
 #define VFL_TYPE_VIDEO VFL_TYPE_GRABBER
 #endif
@@ -2670,7 +2674,7 @@ static void check_timers(struct v4l2_loo
 #ifdef HAVE_TIMER_SETUP
 static void sustain_timer_clb(struct timer_list *t)
 {
-       struct v4l2_loopback_device *dev = from_timer(dev, t, sustain_timer);
+       struct v4l2_loopback_device *dev = timer_container_of(dev, t, 
sustain_timer);
 #else
 static void sustain_timer_clb(unsigned long nr)
 {
@@ -2695,7 +2699,7 @@ static void sustain_timer_clb(unsigned l
 #ifdef HAVE_TIMER_SETUP
 static void timeout_timer_clb(struct timer_list *t)
 {
-       struct v4l2_loopback_device *dev = from_timer(dev, t, timeout_timer);
+       struct v4l2_loopback_device *dev = timer_container_of(dev, t, 
timeout_timer);
 #else
 static void timeout_timer_clb(unsigned long nr)
 {

Reply via email to