aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2010-01-15 20:01:17 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-01-16 15:15:38 -0500
commitd994ffc247f7c4a48b848f10c4c01c9b06411ada (patch)
tree1ccfe9997a504d556e368553c26661d0ce543f82 /include/linux
parenta5b9e2c1063046421ce01dcf5ddd7ec12567f3e1 (diff)
kfifo: add kfifo_initialized
Simple inline that checks if kfifo_init() has been executed on a fifo. This is useful for walking all per CPU fifos, when some of them might not have been brought up yet. Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Stefani Seibold <stefani@seibold.net> Cc: Roland Dreier <rdreier@cisco.com> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Andy Walls <awalls@radix.net> Cc: Vikram Dhillon <dhillonv10@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kfifo.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 7ad6d32dd673..c8618243ca5a 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -116,6 +116,16 @@ extern __must_check unsigned int kfifo_out(struct kfifo *fifo,
116extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo, 116extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo,
117 void *to, unsigned int len, unsigned offset); 117 void *to, unsigned int len, unsigned offset);
118 118
119/**
120 * kfifo_initialized - Check if kfifo is initialized.
121 * @fifo: fifo to check
122 * Return %true if FIFO is initialized, otherwise %false.
123 * Assumes the fifo was 0 before.
124 */
125static inline bool kfifo_initialized(struct kfifo *fifo)
126{
127 return fifo->buffer != 0;
128}
119 129
120/** 130/**
121 * kfifo_reset - removes the entire FIFO contents 131 * kfifo_reset - removes the entire FIFO contents