I have a Linux
module which creates timers, some of which may add themselves again during their handler function.
In some other cases, the timer is removed (perhaps before it's gone off) using del_timer_sync()
.
In that case, do I need to do the init_timer()
call again on the struct before I next add_timer(
) or is that just a waste of (precious) interrupt latency?
To answer my own question, I believe I do need to init_timer() my struct after any del_timer() or del_timer_sync() if I ever intend to access the struct again - for example, when doing a timer_pending() or something during module cleanup.
I think in the case of writing a kernel module which potentially re-uses a timer, the best thing to do is:
Hope that helps someone else in future.