Commit f6072896 authored by Takashi YOSHII's avatar Takashi YOSHII Committed by Paul Mundt

sh: heartbeat double 0 fix.

This implements stricter and more compliant knightrider strobing in the
heartbeat handler. While there still seems to be some debate as to
whether the double 0 is "more" correct or not, this updated version
appears to have general consensus. Fixes a long-term "bug".
Signed-off-by: default avatarTakashi YOSHII <takashi.yoshii.ze@hitachi.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent f987fc88
......@@ -40,16 +40,9 @@ static void heartbeat_timer(unsigned long data)
static unsigned bit = 0, up = 1;
ctrl_outw(1 << hd->bit_pos[bit], (unsigned long)hd->base);
if (up)
if (bit == (ARRAY_SIZE(hd->bit_pos) - 1)) {
bit--;
up = 0;
} else
bit++;
else if (bit == 0)
up = 1;
else
bit--;
bit += up;
if ((bit == 0) || (bit == ARRAY_SIZE(hd->bit_pos)-1))
up = -up;
mod_timer(&hd->timer, jiffies + (110 - ((300 << FSHIFT) /
((avenrun[0] / 5) + (3 << FSHIFT)))));
......
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