kfifo: rename kfifo_put... into kfifo_in... and kfifo_get... into kfifo_out...
rename kfifo_put... into kfifo_in... to prevent miss use of old non in kernel-tree drivers ditto for kfifo_get... -> kfifo_out... Improve the prototypes of kfifo_in and kfifo_out to make the kerneldoc annotations more readable. Add mini "howto porting to the new API" in kfifo.h Signed-off-by: Stefani Seibold <stefani@seibold.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Andi Kleen <ak@linux.intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
e64c026dd0
commit
7acd72eb85
@@ -100,20 +100,20 @@ void kfifo_free(struct kfifo *fifo)
|
||||
EXPORT_SYMBOL(kfifo_free);
|
||||
|
||||
/**
|
||||
* kfifo_put - puts some data into the FIFO, no locking version
|
||||
* kfifo_in - puts some data into the FIFO
|
||||
* @fifo: the fifo to be used.
|
||||
* @buffer: the data to be added.
|
||||
* @from: the data to be added.
|
||||
* @len: the length of the data to be added.
|
||||
*
|
||||
* This function copies at most @len bytes from the @buffer into
|
||||
* This function copies at most @len bytes from the @from buffer into
|
||||
* the FIFO depending on the free space, and returns the number of
|
||||
* bytes copied.
|
||||
*
|
||||
* Note that with only one concurrent reader and one concurrent
|
||||
* writer, you don't need extra locking to use these functions.
|
||||
*/
|
||||
unsigned int kfifo_put(struct kfifo *fifo,
|
||||
const unsigned char *buffer, unsigned int len)
|
||||
unsigned int kfifo_in(struct kfifo *fifo,
|
||||
const unsigned char *from, unsigned int len)
|
||||
{
|
||||
unsigned int l;
|
||||
|
||||
@@ -128,10 +128,10 @@ unsigned int kfifo_put(struct kfifo *fifo,
|
||||
|
||||
/* first put the data starting from fifo->in to buffer end */
|
||||
l = min(len, fifo->size - (fifo->in & (fifo->size - 1)));
|
||||
memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), buffer, l);
|
||||
memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), from, l);
|
||||
|
||||
/* then put the rest (if any) at the beginning of the buffer */
|
||||
memcpy(fifo->buffer, buffer + l, len - l);
|
||||
memcpy(fifo->buffer, from + l, len - l);
|
||||
|
||||
/*
|
||||
* Ensure that we add the bytes to the kfifo -before-
|
||||
@@ -144,22 +144,22 @@ unsigned int kfifo_put(struct kfifo *fifo,
|
||||
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL(kfifo_put);
|
||||
EXPORT_SYMBOL(kfifo_in);
|
||||
|
||||
/**
|
||||
* kfifo_get - gets some data from the FIFO, no locking version
|
||||
* kfifo_out - gets some data from the FIFO
|
||||
* @fifo: the fifo to be used.
|
||||
* @buffer: where the data must be copied.
|
||||
* @to: where the data must be copied.
|
||||
* @len: the size of the destination buffer.
|
||||
*
|
||||
* This function copies at most @len bytes from the FIFO into the
|
||||
* @buffer and returns the number of copied bytes.
|
||||
* @to buffer and returns the number of copied bytes.
|
||||
*
|
||||
* Note that with only one concurrent reader and one concurrent
|
||||
* writer, you don't need extra locking to use these functions.
|
||||
*/
|
||||
unsigned int kfifo_get(struct kfifo *fifo,
|
||||
unsigned char *buffer, unsigned int len)
|
||||
unsigned int kfifo_out(struct kfifo *fifo,
|
||||
unsigned char *to, unsigned int len)
|
||||
{
|
||||
unsigned int l;
|
||||
|
||||
@@ -174,10 +174,10 @@ unsigned int kfifo_get(struct kfifo *fifo,
|
||||
|
||||
/* first get the data from fifo->out until the end of the buffer */
|
||||
l = min(len, fifo->size - (fifo->out & (fifo->size - 1)));
|
||||
memcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)), l);
|
||||
memcpy(to, fifo->buffer + (fifo->out & (fifo->size - 1)), l);
|
||||
|
||||
/* then get the rest (if any) from the beginning of the buffer */
|
||||
memcpy(buffer + l, fifo->buffer, len - l);
|
||||
memcpy(to + l, fifo->buffer, len - l);
|
||||
|
||||
/*
|
||||
* Ensure that we remove the bytes from the kfifo -before-
|
||||
@@ -190,4 +190,4 @@ unsigned int kfifo_get(struct kfifo *fifo,
|
||||
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL(kfifo_get);
|
||||
EXPORT_SYMBOL(kfifo_out);
|
||||
|
Reference in New Issue
Block a user