Skip to content

Commit

Permalink
[MIPS] time: Fix cevt-r4k.c for 64-bit kernel
Browse files Browse the repository at this point in the history
The expression "(long)(read_c0_count() - cnt)" can never be a negative
value on 64-bit kernel.  Cast to "int" before comparison.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Atsushi Nemoto authored and Ralf Baechle committed Oct 29, 2007
1 parent 11ca25a commit c637fec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/mips/kernel/cevt-r4k.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static int mips_next_event(unsigned long delta,
cnt = read_c0_count();
cnt += delta;
write_c0_compare(cnt);
res = ((long)(read_c0_count() - cnt ) > 0) ? -ETIME : 0;
res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0;
#ifdef CONFIG_MIPS_MT_SMTC
evpe(vpflags);
local_irq_restore(flags);
Expand Down Expand Up @@ -196,7 +196,7 @@ static int c0_compare_int_usable(void)
cnt += delta;
write_c0_compare(cnt);

while ((long)(read_c0_count() - cnt) <= 0)
while ((int)(read_c0_count() - cnt) <= 0)
; /* Wait for expiry */

if (!c0_compare_int_pending())
Expand Down

0 comments on commit c637fec

Please sign in to comment.