summaryrefslogtreecommitdiffstats
path: root/arch/microblaze
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2014-07-09 13:23:55 +0200
committerMichal Simek <michal.simek@xilinx.com>2014-07-09 13:24:50 +0200
commitad1d4358e0fdc16017a809ed54f532e68e3c26b6 (patch)
tree000d17a8a452e59aedab3954670a1b486c0a6096 /arch/microblaze
parent163e40743f730e0982b0df28e57e0bed71442a77 (diff)
downloadop-kernel-dev-ad1d4358e0fdc16017a809ed54f532e68e3c26b6.zip
op-kernel-dev-ad1d4358e0fdc16017a809ed54f532e68e3c26b6.tar.gz
microblaze: delay.h fix udelay and ndelay for 8 bit args
Based on: "asm-generic: delay.h fix udelay and ndelay for 8 bit args" (sha1: a87e553fabe8ceadc6f90889066559234cf194c7) Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'arch/microblaze')
-rw-r--r--arch/microblaze/include/asm/delay.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/arch/microblaze/include/asm/delay.h b/arch/microblaze/include/asm/delay.h
index 66fc24c..60cb39d 100644
--- a/arch/microblaze/include/asm/delay.h
+++ b/arch/microblaze/include/asm/delay.h
@@ -61,13 +61,29 @@ extern inline void __udelay(unsigned int x)
extern void __bad_udelay(void); /* deliberately undefined */
extern void __bad_ndelay(void); /* deliberately undefined */
-#define udelay(n) (__builtin_constant_p(n) ? \
- ((n) > __MAX_UDELAY ? __bad_udelay() : __udelay((n) * (19 * HZ))) : \
- __udelay((n) * (19 * HZ)))
+#define udelay(n) \
+ ({ \
+ if (__builtin_constant_p(n)) { \
+ if ((n) / __MAX_UDELAY >= 1) \
+ __bad_udelay(); \
+ else \
+ __udelay((n) * (19 * HZ)); \
+ } else { \
+ __udelay((n) * (19 * HZ)); \
+ } \
+ })
-#define ndelay(n) (__builtin_constant_p(n) ? \
- ((n) > __MAX_NDELAY ? __bad_ndelay() : __udelay((n) * HZ)) : \
- __udelay((n) * HZ))
+#define ndelay(n) \
+ ({ \
+ if (__builtin_constant_p(n)) { \
+ if ((n) / __MAX_NDELAY >= 1) \
+ __bad_ndelay(); \
+ else \
+ __udelay((n) * HZ); \
+ } else { \
+ __udelay((n) * HZ); \
+ } \
+ })
#define muldiv(a, b, c) (((a)*(b))/(c))
OpenPOWER on IntegriCloud