mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] kernel.h: Add DIV_ROUND_UP_ULL usage
@ 2011-07-26  7:10 Nicholas A. Bellinger
  2011-07-26  7:10 ` [PATCH 2/2] target: Convert to DIV_ROUND_UP_ULL usage for sectors / dev_max_sectors Nicholas A. Bellinger
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Nicholas A. Bellinger @ 2011-07-26  7:10 UTC (permalink / raw)
  To: target-devel, linux-scsi, linux-kernel
  Cc: Christoph Hellwig, Andy Grover, Hannes Reinecke, Roland Dreier,
	James Bottomley, Andrew Morton, Linus Torvalds,
	Nicholas Bellinger

From: Nicholas Bellinger <nab@linux-iscsi.org>

Add new DIV_ROUND_UP_ULL macro usage for 32-bit architectures requiring
unsigned long long division of sectors * dev_max_sectors.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
 include/linux/kernel.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 953352a..016dcc9 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -56,6 +56,8 @@
 
 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+#define DIV_ROUND_UP_ULL(ll,d) \
+	({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; })
 
 /* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
 #define roundup(x, y) (					\
-- 
1.7.2.5


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-07-26 16:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-26  7:10 [PATCH 1/2] kernel.h: Add DIV_ROUND_UP_ULL usage Nicholas A. Bellinger
2011-07-26  7:10 ` [PATCH 2/2] target: Convert to DIV_ROUND_UP_ULL usage for sectors / dev_max_sectors Nicholas A. Bellinger
2011-07-26  7:36 ` [PATCH 1/2] kernel.h: Add DIV_ROUND_UP_ULL usage Nicholas A. Bellinger
2011-07-26  7:53 ` Joe Perches
2011-07-26  8:07   ` Nicholas A. Bellinger
2011-07-26 16:54     ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome