Skip to content

Commit

Permalink
[PATCH] Char: sx, simplify timer logic
Browse files Browse the repository at this point in the history
Use kernel helpers for changing timer internals.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jiri Slaby authored and Linus Torvalds committed Dec 8, 2006
1 parent 15b611f commit c959464
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions drivers/char/sx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1353,10 +1353,7 @@ static void sx_pollfunc(unsigned long data)

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();
}

Expand Down Expand Up @@ -2134,14 +2131,10 @@ static int sx_init_board(struct sx_board *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;
}
Expand Down

0 comments on commit c959464

Please sign in to comment.