Commit 5dab600e authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

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: default avatarAndi Kleen <ak@linux.intel.com>
Acked-by: default avatarStefani 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d994ffc2
...@@ -67,7 +67,7 @@ struct kfifo { ...@@ -67,7 +67,7 @@ struct kfifo {
/** /**
* DECLARE_KFIFO - macro to declare a kfifo and the associated buffer * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer
* @name: name of the declared kfifo datatype * @name: name of the declared kfifo datatype
* @size: size of the fifo buffer * @size: size of the fifo buffer. Must be a power of two.
* *
* Note1: the macro can be used inside struct or union declaration * Note1: the macro can be used inside struct or union declaration
* Note2: the macro creates two objects: * Note2: the macro creates two objects:
...@@ -91,7 +91,7 @@ union { \ ...@@ -91,7 +91,7 @@ union { \
/** /**
* DEFINE_KFIFO - macro to define and initialize a kfifo * DEFINE_KFIFO - macro to define and initialize a kfifo
* @name: name of the declared kfifo datatype * @name: name of the declared kfifo datatype
* @size: size of the fifo buffer * @size: size of the fifo buffer. Must be a power of two.
* *
* Note1: the macro can be used for global and local kfifo data type variables * Note1: the macro can be used for global and local kfifo data type variables
* Note2: the macro creates two objects: * Note2: the macro creates two objects:
......
...@@ -41,7 +41,7 @@ static void _kfifo_init(struct kfifo *fifo, void *buffer, ...@@ -41,7 +41,7 @@ static void _kfifo_init(struct kfifo *fifo, void *buffer,
* kfifo_init - initialize a FIFO using a preallocated buffer * kfifo_init - initialize a FIFO using a preallocated buffer
* @fifo: the fifo to assign the buffer * @fifo: the fifo to assign the buffer
* @buffer: the preallocated buffer to be used. * @buffer: the preallocated buffer to be used.
* @size: the size of the internal buffer, this have to be a power of 2. * @size: the size of the internal buffer, this has to be a power of 2.
* *
*/ */
void kfifo_init(struct kfifo *fifo, void *buffer, unsigned int size) void kfifo_init(struct kfifo *fifo, void *buffer, unsigned int size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment