]> git.hungrycats.org Git - linux/commitdiff
[PATCH] v850: make __delay function handle a loop count of zero
authorAndrew Morton <akpm@osdl.org>
Sun, 8 Feb 2004 01:41:31 +0000 (17:41 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Sun, 8 Feb 2004 01:41:31 +0000 (17:41 -0800)
From: <miles@mcspd15.ucom.lsi.nec.co.jp> (Miles Bader)

make __delay function handle a loop count of zero.  In practice, this only
seems to occur in odd debugging situations, but it's quite annoying then.

include/asm-v850/delay.h

index bad311ba44b533f16293e77989fd9d7b95083bb3..1ce65d48a7c5acb22df5c52690d6eafee2571154 100644 (file)
@@ -2,8 +2,8 @@
  * include/asm-v850/delay.h -- Delay routines, using a pre-computed
  *     "loops_per_second" value
  *
- *  Copyright (C) 2001  NEC Corporation
- *  Copyright (C) 2001  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,03  NEC Corporation
+ *  Copyright (C) 2001,03  Miles Bader <miles@gnu.org>
  *  Copyright (C) 1994 Hamish Macdonald
  *
  * This file is subject to the terms and conditions of the GNU General
@@ -18,8 +18,9 @@
 
 extern __inline__ void __delay(unsigned long loops)
 {
-       __asm__ __volatile__ ("1: add -1, %0; bnz 1b"
-                             : "=r" (loops) : "0" (loops));
+       if (loops)
+               __asm__ __volatile__ ("1: add -1, %0; bnz 1b"
+                                     : "=r" (loops) : "0" (loops));
 }
 
 /*