Skip to content

Commit

Permalink
Input: hil-mlc - use del_timer_sync() when unloading the driver
Browse files Browse the repository at this point in the history
del_timer() does not wait for the timer to finish running before returning
and therefore is technically not safe. Also make sure to enable tasklet
before kicking timer that will schedule it.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Dmitry Torokhov committed Dec 12, 2009
1 parent 898d105 commit e40ec6f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/input/serio/hil_mlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,10 +993,8 @@ int hil_mlc_unregister(hil_mlc *mlc)

static int __init hil_mlc_init(void)
{
init_timer(&hil_mlcs_kicker);
hil_mlcs_kicker.expires = jiffies + HZ;
hil_mlcs_kicker.function = &hil_mlcs_timer;
add_timer(&hil_mlcs_kicker);
setup_timer(&hil_mlcs_kicker, &hil_mlcs_timer, 0);
mod_timer(&hil_mlcs_kicker, jiffies + HZ);

tasklet_enable(&hil_mlcs_tasklet);

Expand All @@ -1005,7 +1003,7 @@ static int __init hil_mlc_init(void)

static void __exit hil_mlc_exit(void)
{
del_timer(&hil_mlcs_kicker);
del_timer_sync(&hil_mlcs_kicker);

tasklet_disable(&hil_mlcs_tasklet);
tasklet_kill(&hil_mlcs_tasklet);
Expand Down

0 comments on commit e40ec6f

Please sign in to comment.