aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2011-07-26 03:35:26 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2011-07-26 05:17:07 -0400
commit36a26c69b4c70396ef569c3452690fba0c1dec08 (patch)
tree42b19666615bae3490c894bd0c2e78e1ac752f3a /include
parente48354ce078c079996f89d715dfa44814b4eba01 (diff)
kernel.h: Add DIV_ROUND_UP_ULL and DIV_ROUND_UP_SECTOR_T macro usage
Add new DIV_ROUND_UP_SECTOR_T macro usage for 32-bit architectures requiring a new DIV_ROUND_UP_ULL, and existing 64-bit usage with DIV_ROUND_UP. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Reported-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/kernel.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 567a6f7bbeed..2642497c36fb 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -56,6 +56,14 @@
56 56
57#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 57#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
58#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 58#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
59#define DIV_ROUND_UP_ULL(ll,d) \
60 ({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; })
61
62#if BITS_PER_LONG == 32
63# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d)
64#else
65# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP(ll,d)
66#endif
59 67
60/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */ 68/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
61#define roundup(x, y) ( \ 69#define roundup(x, y) ( \