diff options
author | Stefani Seibold <stefani@seibold.net> | 2009-12-21 17:37:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-22 17:17:56 -0500 |
commit | 7acd72eb85f1c7a15e8b5eb554994949241737f1 (patch) | |
tree | 76712bb9f38690d8cf9c2f91bef811e4413d1aa3 /kernel | |
parent | e64c026dd09b73faf20707711402fc5ed55a8e70 (diff) |
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kfifo.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/kernel/kfifo.c b/kernel/kfifo.c index 963ffde4af1a..d659442e73f2 100644 --- a/kernel/kfifo.c +++ b/kernel/kfifo.c | |||
@@ -100,20 +100,20 @@ void kfifo_free(struct kfifo *fifo) | |||
100 | EXPORT_SYMBOL(kfifo_free); | 100 | EXPORT_SYMBOL(kfifo_free); |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * kfifo_put - puts some data into the FIFO, no locking version | 103 | * kfifo_in - puts some data into the FIFO |
104 | * @fifo: the fifo to be used. | 104 | * @fifo: the fifo to be used. |
105 | * @buffer: the data to be added. | 105 | * @from: the data to be added. |
106 | * @len: the length of the data to be added. | 106 | * @len: the length of the data to be added. |
107 | * | 107 | * |
108 | * This function copies at most @len bytes from the @buffer into | 108 | * This function copies at most @len bytes from the @from buffer into |
109 | * the FIFO depending on the free space, and returns the number of | 109 | * the FIFO depending on the free space, and returns the number of |
110 | * bytes copied. | 110 | * bytes copied. |
111 | * | 111 | * |
112 | * Note that with only one concurrent reader and one concurrent | 112 | * Note that with only one concurrent reader and one concurrent |
113 | * writer, you don't need extra locking to use these functions. | 113 | * writer, you don't need extra locking to use these functions. |
114 | */ | 114 | */ |
115 | unsigned int kfifo_put(struct kfifo *fifo, | 115 | unsigned int kfifo_in(struct kfifo *fifo, |
116 | const unsigned char *buffer, unsigned int len) | 116 | const unsigned char *from, unsigned int len) |
117 | { | 117 | { |
118 | unsigned int l; | 118 | unsigned int l; |
119 | 119 | ||
@@ -128,10 +128,10 @@ unsigned int kfifo_put(struct kfifo *fifo, | |||
128 | 128 | ||
129 | /* first put the data starting from fifo->in to buffer end */ | 129 | /* first put the data starting from fifo->in to buffer end */ |
130 | l = min(len, fifo->size - (fifo->in & (fifo->size - 1))); | 130 | l = min(len, fifo->size - (fifo->in & (fifo->size - 1))); |
131 | memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), buffer, l); | 131 | memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), from, l); |
132 | 132 | ||
133 | /* then put the rest (if any) at the beginning of the buffer */ | 133 | /* then put the rest (if any) at the beginning of the buffer */ |
134 | memcpy(fifo->buffer, buffer + l, len - l); | 134 | memcpy(fifo->buffer, from + l, len - l); |
135 | 135 | ||
136 | /* | 136 | /* |
137 | * Ensure that we add the bytes to the kfifo -before- | 137 | * Ensure that we add the bytes to the kfifo -before- |
@@ -144,22 +144,22 @@ unsigned int kfifo_put(struct kfifo *fifo, | |||
144 | 144 | ||
145 | return len; | 145 | return len; |
146 | } | 146 | } |
147 | EXPORT_SYMBOL(kfifo_put); | 147 | EXPORT_SYMBOL(kfifo_in); |
148 | 148 | ||
149 | /** | 149 | /** |
150 | * kfifo_get - gets some data from the FIFO, no locking version | 150 | * kfifo_out - gets some data from the FIFO |
151 | * @fifo: the fifo to be used. | 151 | * @fifo: the fifo to be used. |
152 | * @buffer: where the data must be copied. | 152 | * @to: where the data must be copied. |
153 | * @len: the size of the destination buffer. | 153 | * @len: the size of the destination buffer. |
154 | * | 154 | * |
155 | * This function copies at most @len bytes from the FIFO into the | 155 | * This function copies at most @len bytes from the FIFO into the |
156 | * @buffer and returns the number of copied bytes. | 156 | * @to buffer and returns the number of copied bytes. |
157 | * | 157 | * |
158 | * Note that with only one concurrent reader and one concurrent | 158 | * Note that with only one concurrent reader and one concurrent |
159 | * writer, you don't need extra locking to use these functions. | 159 | * writer, you don't need extra locking to use these functions. |
160 | */ | 160 | */ |
161 | unsigned int kfifo_get(struct kfifo *fifo, | 161 | unsigned int kfifo_out(struct kfifo *fifo, |
162 | unsigned char *buffer, unsigned int len) | 162 | unsigned char *to, unsigned int len) |
163 | { | 163 | { |
164 | unsigned int l; | 164 | unsigned int l; |
165 | 165 | ||
@@ -174,10 +174,10 @@ unsigned int kfifo_get(struct kfifo *fifo, | |||
174 | 174 | ||
175 | /* first get the data from fifo->out until the end of the buffer */ | 175 | /* first get the data from fifo->out until the end of the buffer */ |
176 | l = min(len, fifo->size - (fifo->out & (fifo->size - 1))); | 176 | l = min(len, fifo->size - (fifo->out & (fifo->size - 1))); |
177 | memcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)), l); | 177 | memcpy(to, fifo->buffer + (fifo->out & (fifo->size - 1)), l); |
178 | 178 | ||
179 | /* then get the rest (if any) from the beginning of the buffer */ | 179 | /* then get the rest (if any) from the beginning of the buffer */ |
180 | memcpy(buffer + l, fifo->buffer, len - l); | 180 | memcpy(to + l, fifo->buffer, len - l); |
181 | 181 | ||
182 | /* | 182 | /* |
183 | * Ensure that we remove the bytes from the kfifo -before- | 183 | * Ensure that we remove the bytes from the kfifo -before- |
@@ -190,4 +190,4 @@ unsigned int kfifo_get(struct kfifo *fifo, | |||
190 | 190 | ||
191 | return len; | 191 | return len; |
192 | } | 192 | } |
193 | EXPORT_SYMBOL(kfifo_get); | 193 | EXPORT_SYMBOL(kfifo_out); |