diff options
author | Andi Kleen <andi@firstfloor.org> | 2010-01-15 20:01:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-16 15:15:38 -0500 |
commit | 5dab600e6a153ceb64832f608069e6c08185411a (patch) | |
tree | 866d05be2255bd4f0c146534741b10c60afe9b79 | |
parent | d994ffc247f7c4a48b848f10c4c01c9b06411ada (diff) |
kfifo: document everywhere that size has to be power of two
On my first try using them I missed that the fifos need to be power of
two, resulting in a runtime bug. Document that requirement everywhere
(and fix one grammar bug)
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Stefani Seibold <stefani@seibold.net>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Andy Walls <awalls@radix.net>
Cc: Vikram Dhillon <dhillonv10@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/kfifo.h | 4 | ||||
-rw-r--r-- | kernel/kfifo.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index c8618243ca5a..6f6c5f300af6 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
@@ -67,7 +67,7 @@ struct kfifo { | |||
67 | /** | 67 | /** |
68 | * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer | 68 | * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer |
69 | * @name: name of the declared kfifo datatype | 69 | * @name: name of the declared kfifo datatype |
70 | * @size: size of the fifo buffer | 70 | * @size: size of the fifo buffer. Must be a power of two. |
71 | * | 71 | * |
72 | * Note1: the macro can be used inside struct or union declaration | 72 | * Note1: the macro can be used inside struct or union declaration |
73 | * Note2: the macro creates two objects: | 73 | * Note2: the macro creates two objects: |
@@ -91,7 +91,7 @@ union { \ | |||
91 | /** | 91 | /** |
92 | * DEFINE_KFIFO - macro to define and initialize a kfifo | 92 | * DEFINE_KFIFO - macro to define and initialize a kfifo |
93 | * @name: name of the declared kfifo datatype | 93 | * @name: name of the declared kfifo datatype |
94 | * @size: size of the fifo buffer | 94 | * @size: size of the fifo buffer. Must be a power of two. |
95 | * | 95 | * |
96 | * Note1: the macro can be used for global and local kfifo data type variables | 96 | * Note1: the macro can be used for global and local kfifo data type variables |
97 | * Note2: the macro creates two objects: | 97 | * Note2: the macro creates two objects: |
diff --git a/kernel/kfifo.c b/kernel/kfifo.c index 7384f120be87..32c5c15d750d 100644 --- a/kernel/kfifo.c +++ b/kernel/kfifo.c | |||
@@ -41,7 +41,7 @@ static void _kfifo_init(struct kfifo *fifo, void *buffer, | |||
41 | * kfifo_init - initialize a FIFO using a preallocated buffer | 41 | * kfifo_init - initialize a FIFO using a preallocated buffer |
42 | * @fifo: the fifo to assign the buffer | 42 | * @fifo: the fifo to assign the buffer |
43 | * @buffer: the preallocated buffer to be used. | 43 | * @buffer: the preallocated buffer to be used. |
44 | * @size: the size of the internal buffer, this have to be a power of 2. | 44 | * @size: the size of the internal buffer, this has to be a power of 2. |
45 | * | 45 | * |
46 | */ | 46 | */ |
47 | void kfifo_init(struct kfifo *fifo, void *buffer, unsigned int size) | 47 | void kfifo_init(struct kfifo *fifo, void *buffer, unsigned int size) |