• Lars-Peter Clausen's avatar
    iio: kfifo_buf: Implement data_available() callback · 355c1a14
    Lars-Peter Clausen authored
    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: default avatarLars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
    355c1a14
kfifo_buf.c 4.18 KB