Skip to content

Kernel timer API changed #9

@MaxBR97

Description

@MaxBR97

The kernel's timer API was changed 9 months ago. ch5 drivers cannot compile because of that. I've provided a fix suggestion for the first driver (sed1) that makes it compile and work:


From d5ae6d6ee20439eaea4c187ab88c107864c120cc Mon Sep 17 00:00:00 2001
From: Max Brener <linmaxi@gmail.com>
Date: Sun, 15 Feb 2026 14:48:38 +0200
Subject: [PATCH] Adopt timer API changes

---
 ch5/sed1/sed1_driver/sed1_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ch5/sed1/sed1_driver/sed1_drv.c b/ch5/sed1/sed1_driver/sed1_drv.c
index ea9e004..e9380b6 100644
--- a/ch5/sed1/sed1_driver/sed1_drv.c
+++ b/ch5/sed1/sed1_driver/sed1_drv.c
@@ -90,7 +90,7 @@ static struct stMyCtx *gpriv;
 
 static void timesup(struct timer_list *timer)
 {
-	struct stMyCtx *priv = from_timer(priv, timer, timr);
+	struct stMyCtx *priv = timer_container_of(priv, timer, timr);
 
 	atomic_set(&priv->timed_out, 1);
 	pr_notice("*** Timer expired! ***\n");
@@ -152,7 +152,7 @@ static void encrypt_decrypt_payload(int work, struct sed_ds *kd, struct sed_ds *
 	t2 = ktime_get_real_ns();
 
 	// work done, cancel the timeout
-	if (del_timer(&priv->timr) == 0)
+	if (timer_delete(&priv->timr) == 0)
 		pr_debug("cancelled the timer while it's inactive! (deadline missed?)\n");
 	else
 		pr_debug("processing complete, timeout cancelled\n");
@@ -378,7 +378,7 @@ static void __exit sed1_drv_exit(void)
 	struct stMyCtx *priv = gpriv;
 
 	dev_dbg(priv->dev, "unloading\n");
-	del_timer_sync(&priv->timr);
+	timer_delete_sync(&priv->timr);
 	misc_deregister(&llkd_miscdev);
 }
 
-- 
2.43.0


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions