Skip to content

Commit 2ad80ae

Browse files
Backward compatibility for timer function
The upstream patch(41cb08555c41) is simply to rename "from_timer" to "timer_container_of" for Linux kernel over v6.15. This patch also adds Linux kernel version check whether or not the rename must be applied, depending on the kernel version in wacom_wac.c. Also to check its availability before compiling all codes, another AC_MSG_CHECKING block has been added in configure.ac. Signed-off-by: Tatsunosuke Tobita <[email protected]>
1 parent e26d178 commit 2ad80ae

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

4.18/wacom_wac.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ static void wacom_force_proxout(struct wacom_wac *wacom_wac)
7575

7676
void wacom_idleprox_timeout(struct timer_list *list)
7777
{
78+
#ifdef WACOM_TIMER_ADDR_CONTAINER_RENAME
7879
struct wacom *wacom = timer_container_of(wacom, list, idleprox_timer);
80+
#else
81+
struct wacom *wacom = from_timer(wacom, list, idleprox_timer);
82+
#endif
7983
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
8084

8185
if (!wacom_wac->hid_data.sense_state) {

configure.ac

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,23 @@ bool timer_delete_sync(struct timer_list *timer) { return true; }
303303
AC_DEFINE([WACOM_TIMER_DELETE_SYNC], [], [kernel defines timer_delete_sync from v6.1.84+])
304304
])
305305

306-
306+
dnl Check if from_timer has been renamed to timer_container_of or
307+
dnl not. This is the case in Linux 6.16 and later.
308+
AC_MSG_CHECKING(timer_container_of)
309+
WACOM_LINUX_TRY_COMPILE([
310+
#include <linux/timer.h>
311+
#ifndef timer_container_of
312+
#error "timer_container_of is not defined"
313+
#endif
314+
],[
315+
],[
316+
HAVE_TIMER_CONTAINER_OF=yes
317+
AC_MSG_RESULT([yes])
318+
AC_DEFINE([WACOM_TIMER_ADDR_CONTAINER_RENAME], [], [kernel defines timer_container_of from v6.16])
319+
],[
320+
HAVE_TIMER_CONTAINER_OF=no
321+
AC_MSG_RESULT([no])
322+
])
307323

308324
dnl Check which version of the driver we should compile
309325
AC_DEFUN([WCM_EXPLODE], [$(echo "$1" | awk '{split($[0],x,"[[^0-9]]"); printf("%03d%03d%03d\n",x[[1]],x[[2]],x[[3]]);}')])

0 commit comments

Comments
 (0)