Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

authored by

Lars-Peter Clausen and committed by
Jonathan Cameron
4a605357 f0566c0c

+2 -1
+2 -1
drivers/iio/industrialio-buffer.c
··· 193 193 INIT_LIST_HEAD(&buffer->buffer_list); 194 194 init_waitqueue_head(&buffer->pollq); 195 195 kref_init(&buffer->ref); 196 - buffer->watermark = 1; 196 + if (!buffer->watermark) 197 + buffer->watermark = 1; 197 198 } 198 199 EXPORT_SYMBOL(iio_buffer_init); 199 200