Skip to content

Commit

Permalink
kfifo: document everywhere that size has to be power of two
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Stefani Seibold <[email protected]>
Cc: Roland Dreier <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: Andy Walls <[email protected]>
Cc: Vikram Dhillon <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Andi Kleen authored and torvalds committed Jan 16, 2010
1 parent d994ffc commit 5dab600
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/linux/kfifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct kfifo {
/**
* DECLARE_KFIFO - macro to declare a kfifo and the associated buffer
* @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
* Note2: the macro creates two objects:
Expand All @@ -91,7 +91,7 @@ union { \
/**
* DEFINE_KFIFO - macro to define and initialize a kfifo
* @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
* Note2: the macro creates two objects:
Expand Down
2 changes: 1 addition & 1 deletion kernel/kfifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static void _kfifo_init(struct kfifo *fifo, void *buffer,
* kfifo_init - initialize a FIFO using a preallocated buffer
* @fifo: the fifo to assign the buffer
* @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)
Expand Down

0 comments on commit 5dab600

Please sign in to comment.