Commit e9c43a75 authored by Muhammad Falak R Wani's avatar Muhammad Falak R Wani Committed by Greg Kroah-Hartman

staging: i4l: icn: use setup_timer() and mod_timer().

Use setup_timer() instead of init_timer(), being the preferred/standard
way to set a timer up.

Also, quoting the mod_timer() function comment:
-> mod_timer() is a more efficient way to update the expire field of an
   active timer (if the timer is inactive it will be activated).

Use setup_timer and mod_timer to setup and arm a timer, to make the code
cleaner and easier to read.
Signed-off-by: default avatarMuhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1735d9e9
...@@ -980,18 +980,17 @@ icn_loadproto(u_char __user *buffer, icn_card *card) ...@@ -980,18 +980,17 @@ icn_loadproto(u_char __user *buffer, icn_card *card)
card->secondhalf); card->secondhalf);
#endif #endif
spin_lock_irqsave(&card->lock, flags); spin_lock_irqsave(&card->lock, flags);
init_timer(&card->st_timer); setup_timer(&card->st_timer, icn_polldchan,
card->st_timer.expires = jiffies + ICN_TIMER_DCREAD; (unsigned long)card);
card->st_timer.function = icn_polldchan; mod_timer(&card->st_timer,
card->st_timer.data = (unsigned long) card; jiffies + ICN_TIMER_DCREAD);
add_timer(&card->st_timer);
card->flags |= ICN_FLAGS_RUNNING; card->flags |= ICN_FLAGS_RUNNING;
if (card->doubleS0) { if (card->doubleS0) {
init_timer(&card->other->st_timer); setup_timer(&card->other->st_timer,
card->other->st_timer.expires = jiffies + ICN_TIMER_DCREAD; icn_polldchan,
card->other->st_timer.function = icn_polldchan; (unsigned long)card->other);
card->other->st_timer.data = (unsigned long) card->other; mod_timer(&card->other->st_timer,
add_timer(&card->other->st_timer); jiffies + ICN_TIMER_DCREAD);
card->other->flags |= ICN_FLAGS_RUNNING; card->other->flags |= ICN_FLAGS_RUNNING;
} }
spin_unlock_irqrestore(&card->lock, flags); spin_unlock_irqrestore(&card->lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment