diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-10-13 18:10:25 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-10-25 14:50:42 +0100 |
commit | 4a60535726d90bfad16b5c52dcffaeede9fb84a9 (patch) | |
tree | a81823dc3641cf152b3235b1d7e54f59531a33b9 /drivers/iio/industrialio-buffer.c | |
parent | iio: Set device watermark based on watermark of all attached buffers (diff) | |
download | linux-4a60535726d90bfad16b5c52dcffaeede9fb84a9.tar.xz linux-4a60535726d90bfad16b5c52dcffaeede9fb84a9.zip |
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>
Diffstat (limited to 'drivers/iio/industrialio-buffer.c')
-rw-r--r-- | drivers/iio/industrialio-buffer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 7340922d367f..5f2c8c8c436e 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -193,7 +193,8 @@ void iio_buffer_init(struct iio_buffer *buffer) INIT_LIST_HEAD(&buffer->buffer_list); init_waitqueue_head(&buffer->pollq); kref_init(&buffer->ref); - buffer->watermark = 1; + if (!buffer->watermark) + buffer->watermark = 1; } EXPORT_SYMBOL(iio_buffer_init); |