Skip to contentSkip to conversation

Char: sx, simplify timer logic

PATCH In review Jiri Slaby 1 participant 1 message Oct 31, 2006 Char and misc drivers

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 5/9 Char: sx, simplify timer logic

sx, simplify timer logic

Use kernel helpers for changing timer internals.

---
commit ff54cb9cb0f690ad9414bc8c800b8fdfb38199a2
tree e3af70b31ec8df40137157f21e0e7641b4e3bf15
parent 10fd13e67b848584d1553b524d2e925ad60a1b4f
author Jiri Slaby <[email protected]> Tue, 31 Oct 2006 00:43:49 +0100 committer Jiri Slaby <[email protected]> Tue, 31 Oct 2006 00:43:49 +0100

 drivers/char/sx.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)
drivers/char/sx.c +4 -11
index fe5fabb..3e71bf8 100644
@@ -1304,10 +1304,7 @@ static void sx_pollfunc(unsigned long da
 
 	sx_interrupt(0, board);
 
-	init_timer(&board->timer);
-
-	board->timer.expires = jiffies + sx_poll;
-	add_timer(&board->timer);
+	mod_timer(&board->timer, jiffies + sx_poll);
 	func_exit();
 }
 
@@ -2006,14 +2003,10 @@ static int sx_init_board(struct sx_board
 
 		/* The timer should be initialized anyway: That way we can
 		   safely del_timer it when the module is unloaded. */
-		init_timer(&board->timer);
+		setup_timer(&board->timer, sx_pollfunc, (unsigned long)board);
 
-		if (board->poll) {
-			board->timer.data = (unsigned long)board;
-			board->timer.function = sx_pollfunc;
-			board->timer.expires = jiffies + board->poll;
-			add_timer(&board->timer);
-		}
+		if (board->poll)
+			mod_timer(&board->timer, jiffies + board->poll);
 	} else {
 		board->irq = 0;
 	}