[PATCH 5/9] Char: sx, simplify timer logic

From: Jiri Slaby
Date: Mon Oct 30 2006 - 19:43:33 EST


sx, simplify timer logic

Use kernel helpers for changing timer internals.

Signed-off-by: Jiri Slaby <jirislaby@xxxxxxxxx>

---
commit ff54cb9cb0f690ad9414bc8c800b8fdfb38199a2
tree e3af70b31ec8df40137157f21e0e7641b4e3bf15
parent 10fd13e67b848584d1553b524d2e925ad60a1b4f
author Jiri Slaby <jirislaby@xxxxxxxxx> Tue, 31 Oct 2006 00:43:49 +0100
committer Jiri Slaby <jirislaby@xxxxxxxxx> Tue, 31 Oct 2006 00:43:49 +0100

drivers/char/sx.c | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index fe5fabb..3e71bf8 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -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;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/