Skip to content

Commit

Permalink
Char: moxa, fix and optimise empty timer
Browse files Browse the repository at this point in the history
moxa, fix and optimise empty timer

don't wait and delete empty timer in empty timer function. Also fire next
empty timer at rounded jiffies to save power.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jiri Slaby authored and Linus Torvalds committed Oct 18, 2007
1 parent fc37449 commit c434220
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/char/moxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,14 +1040,14 @@ static void check_xmit_empty(unsigned long data)
struct moxa_port *ch;

ch = (struct moxa_port *) data;
del_timer_sync(&moxa_ports[ch->port].emptyTimer);
if (ch->tty && (ch->statusflags & EMPTYWAIT)) {
if (MoxaPortTxQueue(ch->port) == 0) {
ch->statusflags &= ~EMPTYWAIT;
tty_wakeup(ch->tty);
return;
}
mod_timer(&moxa_ports[ch->port].emptyTimer, jiffies + HZ);
mod_timer(&moxa_ports[ch->port].emptyTimer,
round_jiffies(jiffies + HZ));
} else
ch->statusflags &= ~EMPTYWAIT;
}
Expand Down

0 comments on commit c434220

Please sign in to comment.