iio:kfifo: Set update_needed to false after allocating a new buffer
authorLars-Peter Clausen <lars@metafoo.de>
Tue, 15 Oct 2013 08:30:00 +0000 (09:30 +0100)
committerJonathan Cameron <jic23@kernel.org>
Tue, 15 Oct 2013 18:20:55 +0000 (19:20 +0100)
update_needed is used to decide whether the kfifo buffer needs to be
re-allocated. It is set to true whenever the size of the buffer is changed. It
is never set to false though, causing the buffer to always be re-allocated.
Setting update_needed to false after the new buffer has been allocated fixes the
problem.

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

index d654f42e16aa381733a5c1c56410a4f6b2c5b766..95c6fc81c2c78f2d57598995753e342302c3cb3a 100644 (file)
@@ -38,6 +38,7 @@ static int iio_request_update_kfifo(struct iio_buffer *r)
                kfifo_free(&buf->kf);
                ret = __iio_allocate_kfifo(buf, buf->buffer.bytes_per_datum,
                                   buf->buffer.length);
+               buf->update_needed = false;
        } else {
                kfifo_reset_out(&buf->kf);
        }