]> Pileus Git - ~andy/linux/commit
iio: kfifo_buf: Implement data_available() callback
authorLars-Peter Clausen <lars@metafoo.de>
Mon, 25 Nov 2013 14:56:00 +0000 (14:56 +0000)
committerJonathan Cameron <jic23@kernel.org>
Tue, 3 Dec 2013 20:22:28 +0000 (20:22 +0000)
commit355c1a14d4009a43e4d1f9cb42a382f0a94d01c4
tree2c03c360371afe9e4704ea6d2437eb61e1cfbbc6
parent647cc7b9be861e01723a3183f5d06729a1613a97
iio: kfifo_buf: Implement data_available() callback

This patch implements the data_available() callback for the kfifo buffer instead
of using the stufftoread flag. The kfifo used by the buffer already knows
whether it is empty or not based on the position of its read and write pointer.
Using this makes it a lot easier to tell whether data is available or not and it
is not necessary to take special measures to ensure that no race conditions
between reading and writing from the buffer occur.

Note, that we still have to take the buffers lock to protect against concurrent
resizeing of the kfifo.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/kfifo_buf.c