Skip to contentSkip to conversation

samples: Convert timers to use timer_setup()

PATCH Applied Kees Cook 2 participants 3 messages Oct 16, 2017 – Oct 19, 2017

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 samples: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

---
 samples/connector/cn_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
samples/connector/cn_test.c +3 -3
index d12cc944b696..95cd06f4ec1e 100644
@@ -125,12 +125,12 @@ static int cn_test_want_notify(void)
 #endif
 
 static u32 cn_test_timer_counter;
-static void cn_test_timer_func(unsigned long __data)
+static void cn_test_timer_func(struct timer_list *unused)
 {
 	struct cn_msg *m;
 	char data[32];
 
-	pr_debug("%s: timer fired with data %lu\n", __func__, __data);
+	pr_debug("%s: timer fired\n", __func__);
 
 	m = kzalloc(sizeof(*m) + sizeof(data), GFP_ATOMIC);
 	if (m) {
@@ -168,7 +168,7 @@ static int cn_test_init(void)
 		goto err_out;
 	}
 
-	setup_timer(&cn_test_timer, cn_test_timer_func, 0);
+	timer_setup(&cn_test_timer, cn_test_timer_func, 0);
 	mod_timer(&cn_test_timer, jiffies + msecs_to_jiffies(1000));
 
 	pr_info("initialized with id={%u.%u}\n",
Signature · 6 lines
2.7.4


-- 
Kees Cook
Pixel Security
#1 lore raw
Quoted 5 lines · On Mon, 16 Oct 2017 16:02:25 -0700 Kees Cook <[email protected]> wrote:

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Argh, so I'm the samples/ maintainer too now? :)

Applied, thanks.

jon

author
#2 lore raw
Quoted 10 lines · Jonathan Corbet
Quoted 5 lines · On Mon, 16 Oct 2017 16:02:25 -0700 Kees Cook <[email protected]> wrote:

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Argh, so I'm the samples/ maintainer too now? :)

Well, other subdirectories appear to have separate maintainers, but since you touched this last, it seemed best?

Quoted 1 line

Applied, thanks.

Thanks! FWIW, if I ever direct stuff your way and you'd rather I carry it, just let me know. :)

-Kees

Signature · 2 lines
Kees Cook
Pixel Security