Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d994ffc2 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds
Browse files

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: default avatarAndi Kleen <ak@linux.intel.com>
Acked-by: default avatarStefani 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a5b9e2c1
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -116,6 +116,16 @@ extern __must_check unsigned int kfifo_out(struct kfifo *fifo,
extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo,
				void *to, unsigned int len, unsigned offset);

/**
 * kfifo_initialized - Check if kfifo is initialized.
 * @fifo: fifo to check
 * Return %true if FIFO is initialized, otherwise %false.
 * Assumes the fifo was 0 before.
 */
static inline bool kfifo_initialized(struct kfifo *fifo)
{
	return fifo->buffer != 0;
}

/**
 * kfifo_reset - removes the entire FIFO contents