• Lars-Peter Clausen's avatar
    iio:kfifo: Empty buffer on update · 5b78e513
    Lars-Peter Clausen authored
    The kfifo's request_update callback will free the current buffer and allocate a
    new one if the size has changed. This will remove any samples that might still
    be left in the buffer. If the size has not changed the buffer content is
    left untouched though. This is a bit inconsistent and might cause an application
    to see data from a previous capture. This patch inserts a call to
    kfifo_reset_out() when the size did not change. This makes sure that any pending
    samples are removed from the buffer.
    
    Note, due to a different bug the buffer is currently always re-allocated, even
    if the size did not change. So this patch will not change the behavior. In the
    next patch the bug will be fixed and this patch makes sure that the current
    behavior is kept.
    Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
    5b78e513
kfifo_buf.c 4.08 KB