Commit 4a605357 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Jonathan Cameron

iio:iio_buffer_init(): Only set watermark if not already set

Only initialize the watermark field if it is still 0. This allows drivers
to provide a custom default watermark value. E.g. some driver might have a
fixed watermark or can only support watermarks within a certain range and
the initial value for the watermark should be within this range.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent f0566c0c
...@@ -193,7 +193,8 @@ void iio_buffer_init(struct iio_buffer *buffer) ...@@ -193,7 +193,8 @@ void iio_buffer_init(struct iio_buffer *buffer)
INIT_LIST_HEAD(&buffer->buffer_list); INIT_LIST_HEAD(&buffer->buffer_list);
init_waitqueue_head(&buffer->pollq); init_waitqueue_head(&buffer->pollq);
kref_init(&buffer->ref); kref_init(&buffer->ref);
buffer->watermark = 1; if (!buffer->watermark)
buffer->watermark = 1;
} }
EXPORT_SYMBOL(iio_buffer_init); EXPORT_SYMBOL(iio_buffer_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment