Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1364019 > unrolled thread

[PATCH 1/1] iio: fix config watermark initial value

Started byIrina Tirdea <irina.tirdea@intel.com>
First post2016-03-24 10:20 +0100
Last post2016-03-28 12:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] iio: fix config watermark initial value Irina Tirdea <irina.tirdea@intel.com> - 2016-03-24 10:20 +0100
    Re: [PATCH 1/1] iio: fix config watermark initial value Lars-Peter Clausen <lars@metafoo.de> - 2016-03-24 10:30 +0100
      Re: [PATCH 1/1] iio: fix config watermark initial value Jonathan Cameron <jic23@kernel.org> - 2016-03-28 12:10 +0200

#1364019 — [PATCH 1/1] iio: fix config watermark initial value

FromIrina Tirdea <irina.tirdea@intel.com>
Date2016-03-24 10:20 +0100
Subject[PATCH 1/1] iio: fix config watermark initial value
Message-ID<rg9AS-p3-13@gated-at.bofh.it>
config structure is set to 0 when updating the buffers, so by
default config->watermark will be 0. When computing the minimum
between config->watermark and the buffer->watermark or
insert_buffer-watermark, this will always be 0 regardless of the
value set by the user for the buffer.

Set as initial value for config->watermark the maximum allowed
value so that the minimum value will always be set from one of the
buffers.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
 drivers/iio/industrialio-buffer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index b976332..90462fc 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -653,6 +653,7 @@ static int iio_verify_update(struct iio_dev *indio_dev,
 	unsigned int modes;
 
 	memset(config, 0, sizeof(*config));
+	config->watermark = ~0;
 
 	/*
 	 * If there is just one buffer and we are removing it there is nothing
-- 
1.9.1

[toc] | [next] | [standalone]


#1364021

FromLars-Peter Clausen <lars@metafoo.de>
Date2016-03-24 10:30 +0100
Message-ID<rg9Ky-u0-5@gated-at.bofh.it>
In reply to#1364019
On 03/24/2016 10:09 AM, Irina Tirdea wrote:
> config structure is set to 0 when updating the buffers, so by
> default config->watermark will be 0. When computing the minimum
> between config->watermark and the buffer->watermark or
> insert_buffer-watermark, this will always be 0 regardless of the
> value set by the user for the buffer.
> 
> Set as initial value for config->watermark the maximum allowed
> value so that the minimum value will always be set from one of the
> buffers.
> 
> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>

Looks good. This bug was my fault, sorry.

Fixes: f0566c0c405d ("iio: Set device watermark based on watermark of all
attached buffers")

> ---
>  drivers/iio/industrialio-buffer.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index b976332..90462fc 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -653,6 +653,7 @@ static int iio_verify_update(struct iio_dev *indio_dev,
>  	unsigned int modes;
>  
>  	memset(config, 0, sizeof(*config));
> +	config->watermark = ~0;
>  
>  	/*
>  	 * If there is just one buffer and we are removing it there is nothing
> 

[toc] | [prev] | [next] | [standalone]


#1365425

FromJonathan Cameron <jic23@kernel.org>
Date2016-03-28 12:10 +0200
Message-ID<rhCht-5v5-19@gated-at.bofh.it>
In reply to#1364021
On 24/03/16 09:23, Lars-Peter Clausen wrote:
> On 03/24/2016 10:09 AM, Irina Tirdea wrote:
>> config structure is set to 0 when updating the buffers, so by
>> default config->watermark will be 0. When computing the minimum
>> between config->watermark and the buffer->watermark or
>> insert_buffer-watermark, this will always be 0 regardless of the
>> value set by the user for the buffer.
>>
>> Set as initial value for config->watermark the maximum allowed
>> value so that the minimum value will always be set from one of the
>> buffers.
>>
>> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
> 
> Looks good. This bug was my fault, sorry.
> 
> Fixes: f0566c0c405d ("iio: Set device watermark based on watermark of all
> attached buffers")
Applied to the fixes-togreg-post-rc1 branch of iio.git and marked for stable.

Thanks,

Jonathan
> 
>> ---
>>  drivers/iio/industrialio-buffer.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
>> index b976332..90462fc 100644
>> --- a/drivers/iio/industrialio-buffer.c
>> +++ b/drivers/iio/industrialio-buffer.c
>> @@ -653,6 +653,7 @@ static int iio_verify_update(struct iio_dev *indio_dev,
>>  	unsigned int modes;
>>  
>>  	memset(config, 0, sizeof(*config));
>> +	config->watermark = ~0;
>>  
>>  	/*
>>  	 * If there is just one buffer and we are removing it there is nothing
>>
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web