2010-11-21 14:15:30

by Robert P. J. Day

[permalink] [raw]
Subject: cleaning up some inline kfifo docs


(primarily to stefani but others are free to jump in.)

a few things that can be tweaked in <linux/kfifo.h>, but i'd rather
leave that to the maintainer.

besides some pedantic typoes in kfifo.h, there is a mismatch in the
rounding info. kfifo.h reads:

"* The numer of elements will be rounded-up to a power of 2."

while kernel/kfifo.c makes it clear that it goes the other way:

int __kfifo_alloc(struct __kfifo *fifo, unsigned int size,
size_t esize, gfp_t gfp_mask)
{
/*
* round down to the next power of 2, since our 'let the indices
* wrap' technique works only in this case.
*/
if (!is_power_of_2(size))
size = rounddown_pow_of_two(size);


so the kfifo.h claim should be fixed. also, in a number of places,
kfifo.h claims that the size passed to the kfifo creation routine
*must* be a power of two when, clearly, it doesn't have to be; it will
simply be *rounded* to such a power as needed.

take it away, stefani ...

rday


--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
http://crashcourse.ca

Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================