aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/getorder.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-02-20 17:39:18 -0500
committerH. Peter Anvin <hpa@zytor.com>2012-02-20 17:46:55 -0500
commite0891a9816316b5e05fd5b0453ffe9fd6a56f489 (patch)
tree3a600ed8fe7285749059d7fccf247d8ca910e0ac /include/asm-generic/getorder.h
parent7931d493051ea9b09e4fddee2dc40b2eb88d62b9 (diff)
bitops: Adjust the comment on get_order() to describe the size==0 case
Adjust the comment on get_order() to note that the result of passing a size of 0 results in an undefined value. Signed-off-by: David Howells <dhowells@redhat.com> Link: http://lkml.kernel.org/r/20120220223917.16199.9416.stgit@warthog.procyon.org.uk Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'include/asm-generic/getorder.h')
-rw-r--r--include/asm-generic/getorder.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/include/asm-generic/getorder.h b/include/asm-generic/getorder.h
index 67e7245dc9b3..76e9687a3c86 100644
--- a/include/asm-generic/getorder.h
+++ b/include/asm-generic/getorder.h
@@ -5,7 +5,28 @@
5 5
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7 7
8/* Pure 2^n version of get_order */ 8/**
9 * get_order - Determine the allocation order of a memory size
10 * @size: The size for which to get the order
11 *
12 * Determine the allocation order of a particular sized block of memory. This
13 * is on a logarithmic scale, where:
14 *
15 * 0 -> 2^0 * PAGE_SIZE and below
16 * 1 -> 2^1 * PAGE_SIZE to 2^0 * PAGE_SIZE + 1
17 * 2 -> 2^2 * PAGE_SIZE to 2^1 * PAGE_SIZE + 1
18 * 3 -> 2^3 * PAGE_SIZE to 2^2 * PAGE_SIZE + 1
19 * 4 -> 2^4 * PAGE_SIZE to 2^3 * PAGE_SIZE + 1
20 * ...
21 *
22 * The order returned is used to find the smallest allocation granule required
23 * to hold an object of the specified size.
24 *
25 * The result is undefined if the size is 0.
26 *
27 * This function may be used to initialise variables with compile time
28 * evaluations of constants.
29 */
9static inline __attribute_const__ int get_order(unsigned long size) 30static inline __attribute_const__ int get_order(unsigned long size)
10{ 31{
11 int order; 32 int order;