diff options
author | Michal Simek <michal.simek@xilinx.com> | 2014-07-09 07:23:55 -0400 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2014-07-09 07:24:50 -0400 |
commit | ad1d4358e0fdc16017a809ed54f532e68e3c26b6 (patch) | |
tree | 000d17a8a452e59aedab3954670a1b486c0a6096 /arch/microblaze | |
parent | 163e40743f730e0982b0df28e57e0bed71442a77 (diff) |
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.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/arch/microblaze/include/asm/delay.h b/arch/microblaze/include/asm/delay.h index 66fc24c24238..60cb39deb533 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) | |||
61 | extern void __bad_udelay(void); /* deliberately undefined */ | 61 | extern void __bad_udelay(void); /* deliberately undefined */ |
62 | extern void __bad_ndelay(void); /* deliberately undefined */ | 62 | extern void __bad_ndelay(void); /* deliberately undefined */ |
63 | 63 | ||
64 | #define udelay(n) (__builtin_constant_p(n) ? \ | 64 | #define udelay(n) \ |
65 | ((n) > __MAX_UDELAY ? __bad_udelay() : __udelay((n) * (19 * HZ))) : \ | 65 | ({ \ |
66 | __udelay((n) * (19 * HZ))) | 66 | if (__builtin_constant_p(n)) { \ |
67 | if ((n) / __MAX_UDELAY >= 1) \ | ||
68 | __bad_udelay(); \ | ||
69 | else \ | ||
70 | __udelay((n) * (19 * HZ)); \ | ||
71 | } else { \ | ||
72 | __udelay((n) * (19 * HZ)); \ | ||
73 | } \ | ||
74 | }) | ||
67 | 75 | ||
68 | #define ndelay(n) (__builtin_constant_p(n) ? \ | 76 | #define ndelay(n) \ |
69 | ((n) > __MAX_NDELAY ? __bad_ndelay() : __udelay((n) * HZ)) : \ | 77 | ({ \ |
70 | __udelay((n) * HZ)) | 78 | if (__builtin_constant_p(n)) { \ |
79 | if ((n) / __MAX_NDELAY >= 1) \ | ||
80 | __bad_ndelay(); \ | ||
81 | else \ | ||
82 | __udelay((n) * HZ); \ | ||
83 | } else { \ | ||
84 | __udelay((n) * HZ); \ | ||
85 | } \ | ||
86 | }) | ||
71 | 87 | ||
72 | #define muldiv(a, b, c) (((a)*(b))/(c)) | 88 | #define muldiv(a, b, c) (((a)*(b))/(c)) |
73 | 89 | ||