Commit 1afe2113 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

Char: moxa, fix and optimise empty timer

patch c4342205 in mainline.

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.

This fixes a lockup, because we wait for ourselves to finish forever.
(i.e.  sync called from the timer itself).
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 76d41df3
......@@ -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;
}
......
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