Skip to content

Commit 5c47a1a

Browse files
committed
Add conditional compilation for changes with timer symbols in kernel 6.16
Link: https://git.kernel.org/torvalds/c/41cb08555c416 Signed-off-by: Mario Limonciello (AMD) <[email protected]>
1 parent 0ff1e9d commit 5c47a1a

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

QDMA/linux-kernel/driver/libqdma/qdma_mbox.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,11 @@ static int mbox_rcv_one_msg(struct qdma_mbox *mbox)
308308

309309
static inline void mbox_timer_stop(struct qdma_mbox *mbox)
310310
{
311+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
311312
del_timer(&mbox->timer);
313+
#else
314+
timer_delete_sync(&mbox->timer);
315+
#endif
312316
}
313317

314318
static inline void mbox_timer_start(struct qdma_mbox *mbox)
@@ -432,7 +436,9 @@ static void mbox_timer_handler(struct timer_list *t)
432436
static void mbox_timer_handler(unsigned long arg)
433437
#endif
434438
{
435-
#if KERNEL_VERSION(4, 15, 0) <= LINUX_VERSION_CODE
439+
#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 16, 0)
440+
struct qdma_mbox *mbox = timer_container_of(mbox, t, timer);
441+
#elif KERNEL_VERSION(4, 15, 0) <= LINUX_VERSION_CODE
436442
struct qdma_mbox *mbox = from_timer(mbox, t, timer);
437443
#else
438444
struct qdma_mbox *mbox = (struct qdma_mbox *)arg;

patch

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/xrt/XRT/src/runtime_src/core/pcie/driver/linux/xocl/lib/libqdma/QDMA/linux-kernel/driver/libqdma/qdma_mbox.c b/xrt/XRT/src/runtime_src/core/pcie/driver/linux/xocl/lib/libqdma/QDMA/linux-kernel/driver/libqdma/qdma_mbox.c
2+
index 6438c6a21..e647f9c2b 100755
3+
--- a/QDMA/linux-kernel/driver/libqdma/qdma_mbox.c
4+
+++ b/QDMA/linux-kernel/driver/libqdma/qdma_mbox.c
5+
@@ -308,7 +308,11 @@ static int mbox_rcv_one_msg(struct qdma_mbox *mbox)
6+
7+
static inline void mbox_timer_stop(struct qdma_mbox *mbox)
8+
{
9+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
10+
del_timer(&mbox->timer);
11+
+#else
12+
+ timer_delete_sync(&mbox->timer);
13+
+#endif
14+
}
15+
16+
static inline void mbox_timer_start(struct qdma_mbox *mbox)
17+
@@ -432,7 +436,9 @@ static void mbox_timer_handler(struct timer_list *t)
18+
static void mbox_timer_handler(unsigned long arg)
19+
#endif
20+
{
21+
-#if KERNEL_VERSION(4, 15, 0) <= LINUX_VERSION_CODE
22+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 16, 0)
23+
+ struct qdma_mbox *mbox = timer_container_of(mbox, t, timer);
24+
+#elif KERNEL_VERSION(4, 15, 0) <= LINUX_VERSION_CODE
25+
struct qdma_mbox *mbox = from_timer(mbox, t, timer);
26+
#else
27+
struct qdma_mbox *mbox = (struct qdma_mbox *)arg;

0 commit comments

Comments
 (0)