diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2013-10-17 02:42:16 +0400 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2014-01-14 10:19:53 -0800 |
commit | 01e3b3cb2d70ca9d95769e863ca71a85f84c3917 (patch) | |
tree | 1e29afd18198204a445a7d81bbd513441b74633f /arch/xtensa | |
parent | 5515daa9ca5a0992cc1c55d4c6c7ddb116e829b4 (diff) | |
download | blackbird-op-linux-01e3b3cb2d70ca9d95769e863ca71a85f84c3917.tar.gz blackbird-op-linux-01e3b3cb2d70ca9d95769e863ca71a85f84c3917.zip |
xtensa: fix __delay for small loop count
Avoid __delay counter underflow for loop counts < 2.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa')
-rw-r--r-- | arch/xtensa/include/asm/delay.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/xtensa/include/asm/delay.h b/arch/xtensa/include/asm/delay.h index 3899610c1dff..742b89f3ca2c 100644 --- a/arch/xtensa/include/asm/delay.h +++ b/arch/xtensa/include/asm/delay.h @@ -19,9 +19,12 @@ extern unsigned long loops_per_jiffy; static inline void __delay(unsigned long loops) { - /* 2 cycles per loop. */ - __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 2, 1b" - : "=r" (loops) : "0" (loops)); + if (__builtin_constant_p(loops) && loops < 2) + __asm__ __volatile__ ("nop"); + else if (loops >= 2) + /* 2 cycles per loop. */ + __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 2, 1b" + : "+r" (loops)); } /* For SMP/NUMA systems, change boot_cpu_data to something like |