Re: [PATCH v5a 5/5] treewide: Convert del_timer*() to timer_shutdown*()

From: Steven Rostedt
Date: Sun Nov 06 2022 - 16:52:31 EST


On Sun, 6 Nov 2022 13:39:45 -0800
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> So yes, I'm happy with this. It looks like a very reasonable "let's
> handle the scripted trivial cases automatically", and then anything
> more complicated can be left for 6.2.

Great to hear.

>
> And with that cocci script (and how to run it), people can see what
> the script was, and even run it themselves to verify, and that just
> makes me feel all warm and fuzzy about it.

I can update the change log to include:

$ cat timer.cocci
@@
expression E, ptr, slab;
identifier timer, rfield;
@@
(
- del_timer(&ptr->timer);
+ timer_shutdown(&ptr->timer);
|
- del_timer_sync(&ptr->timer);
+ timer_shutdown_sync(&ptr->timer);
)
... when strict
when != ptr->timer.function = E;
(
kfree_rcu(ptr, rfield);
|
kmem_cache_free(slab, ptr);
|
kfree(ptr);
)
$ spatch --dir timer.cocci . > /tmp/t.patch
$ patch -p1 < /tmp/t.patch

if you want.

The question now comes, how should you take it?

- You pull in this series directly.

- Thomas takes it and sends you a pull request (although he's been very
quiet on this topic, even though he told me he was OK with it on IRC).

- I add it to my tree, and send you a pull request?

I'll let you choose.

-- Steve