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 /include | |
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 'include')
-rw-r--r-- | include/linux/kfifo.h | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index a893acda3964..1b59c4a0e85f 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
@@ -19,6 +19,25 @@ | |||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | |||
23 | /* | ||
24 | * Howto porting drivers to the new generic fifo API: | ||
25 | * | ||
26 | * - Modify the declaration of the "struct kfifo *" object into a | ||
27 | * in-place "struct kfifo" object | ||
28 | * - Init the in-place object with kfifo_alloc() or kfifo_init() | ||
29 | * Note: The address of the in-place "struct kfifo" object must be | ||
30 | * passed as the first argument to this functions | ||
31 | * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get | ||
32 | * into kfifo_out | ||
33 | * - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get | ||
34 | * into kfifo_out_locked | ||
35 | * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc | ||
36 | * must be passed now to the kfifo_in_locked and kfifo_out_locked | ||
37 | * as the last parameter. | ||
38 | * - All formerly name __kfifo_* functions has been renamed into kfifo_* | ||
39 | */ | ||
40 | |||
22 | #ifndef _LINUX_KFIFO_H | 41 | #ifndef _LINUX_KFIFO_H |
23 | #define _LINUX_KFIFO_H | 42 | #define _LINUX_KFIFO_H |
24 | 43 | ||
@@ -37,10 +56,10 @@ extern void kfifo_init(struct kfifo *fifo, unsigned char *buffer, | |||
37 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, | 56 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, |
38 | gfp_t gfp_mask); | 57 | gfp_t gfp_mask); |
39 | extern void kfifo_free(struct kfifo *fifo); | 58 | extern void kfifo_free(struct kfifo *fifo); |
40 | extern unsigned int kfifo_put(struct kfifo *fifo, | 59 | extern __must_check unsigned int kfifo_in(struct kfifo *fifo, |
41 | const unsigned char *buffer, unsigned int len); | 60 | const unsigned char *from, unsigned int len); |
42 | extern unsigned int kfifo_get(struct kfifo *fifo, | 61 | extern __must_check unsigned int kfifo_out(struct kfifo *fifo, |
43 | unsigned char *buffer, unsigned int len); | 62 | unsigned char *to, unsigned int len); |
44 | 63 | ||
45 | /** | 64 | /** |
46 | * kfifo_reset - removes the entire FIFO contents | 65 | * kfifo_reset - removes the entire FIFO contents |
@@ -65,7 +84,7 @@ static inline unsigned int kfifo_len(struct kfifo *fifo) | |||
65 | } | 84 | } |
66 | 85 | ||
67 | /** | 86 | /** |
68 | * kfifo_put_locked - puts some data into the FIFO using a spinlock for locking | 87 | * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking |
69 | * @fifo: the fifo to be used. | 88 | * @fifo: the fifo to be used. |
70 | * @from: the data to be added. | 89 | * @from: the data to be added. |
71 | * @n: the length of the data to be added. | 90 | * @n: the length of the data to be added. |
@@ -75,7 +94,7 @@ static inline unsigned int kfifo_len(struct kfifo *fifo) | |||
75 | * the FIFO depending on the free space, and returns the number of | 94 | * the FIFO depending on the free space, and returns the number of |
76 | * bytes copied. | 95 | * bytes copied. |
77 | */ | 96 | */ |
78 | static inline __must_check unsigned int kfifo_put_locked(struct kfifo *fifo, | 97 | static inline __must_check unsigned int kfifo_in_locked(struct kfifo *fifo, |
79 | const unsigned char *from, unsigned int n, spinlock_t *lock) | 98 | const unsigned char *from, unsigned int n, spinlock_t *lock) |
80 | { | 99 | { |
81 | unsigned long flags; | 100 | unsigned long flags; |
@@ -83,7 +102,7 @@ static inline __must_check unsigned int kfifo_put_locked(struct kfifo *fifo, | |||
83 | 102 | ||
84 | spin_lock_irqsave(lock, flags); | 103 | spin_lock_irqsave(lock, flags); |
85 | 104 | ||
86 | ret = kfifo_put(fifo, from, n); | 105 | ret = kfifo_in(fifo, from, n); |
87 | 106 | ||
88 | spin_unlock_irqrestore(lock, flags); | 107 | spin_unlock_irqrestore(lock, flags); |
89 | 108 | ||
@@ -91,7 +110,7 @@ static inline __must_check unsigned int kfifo_put_locked(struct kfifo *fifo, | |||
91 | } | 110 | } |
92 | 111 | ||
93 | /** | 112 | /** |
94 | * kfifo_get_locked - gets some data from the FIFO using a spinlock for locking | 113 | * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking |
95 | * @fifo: the fifo to be used. | 114 | * @fifo: the fifo to be used. |
96 | * @to: where the data must be copied. | 115 | * @to: where the data must be copied. |
97 | * @n: the size of the destination buffer. | 116 | * @n: the size of the destination buffer. |
@@ -100,7 +119,7 @@ static inline __must_check unsigned int kfifo_put_locked(struct kfifo *fifo, | |||
100 | * This function copies at most @len bytes from the FIFO into the | 119 | * This function copies at most @len bytes from the FIFO into the |
101 | * @to buffer and returns the number of copied bytes. | 120 | * @to buffer and returns the number of copied bytes. |
102 | */ | 121 | */ |
103 | static inline __must_check unsigned int kfifo_get_locked(struct kfifo *fifo, | 122 | static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo, |
104 | unsigned char *to, unsigned int n, spinlock_t *lock) | 123 | unsigned char *to, unsigned int n, spinlock_t *lock) |
105 | { | 124 | { |
106 | unsigned long flags; | 125 | unsigned long flags; |
@@ -108,7 +127,7 @@ static inline __must_check unsigned int kfifo_get_locked(struct kfifo *fifo, | |||
108 | 127 | ||
109 | spin_lock_irqsave(lock, flags); | 128 | spin_lock_irqsave(lock, flags); |
110 | 129 | ||
111 | ret = kfifo_get(fifo, to, n); | 130 | ret = kfifo_out(fifo, to, n); |
112 | 131 | ||
113 | /* | 132 | /* |
114 | * optimization: if the FIFO is empty, set the indices to 0 | 133 | * optimization: if the FIFO is empty, set the indices to 0 |