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


Groups > linux.kernel > #1411492 > unrolled thread

[PATCH v2] staging: iio: ad5933: fix order of cycle conditions

Started byLuis de Bethencourt <luisbg@osg.samsung.com>
First post2016-06-01 21:30 +0200
Last post2016-06-11 19:40 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] staging: iio: ad5933: fix order of cycle conditions Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-06-01 21:30 +0200
    Re: [PATCH v2] staging: iio: ad5933: fix order of cycle conditions Jonathan Cameron <jic23@kernel.org> - 2016-06-11 19:00 +0200
      Re: [PATCH v2] staging: iio: ad5933: fix order of cycle conditions Lars-Peter Clausen <lars@metafoo.de> - 2016-06-11 19:30 +0200
        Re: [PATCH v2] staging: iio: ad5933: fix order of cycle conditions Jonathan Cameron <jic23@kernel.org> - 2016-06-11 19:40 +0200

#1411492 — [PATCH v2] staging: iio: ad5933: fix order of cycle conditions

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2016-06-01 21:30 +0200
Subject[PATCH v2] staging: iio: ad5933: fix order of cycle conditions
Message-ID<rFk02-488-21@gated-at.bofh.it>
Correctly handle the settling time cycles value. The else branch is an
impossible condition, > 1022 in the else branch of > 511. Flipping the order.

Based on the Table 13 at the bottom of Page 25 of the Data Sheet:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5933.pdf

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/staging/iio/impedance-analyzer/ad5933.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 9f43976..170ac98 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -444,10 +444,10 @@ static ssize_t ad5933_store(struct device *dev,
 		st->settling_cycles = val;
 
 		/* 2x, 4x handling, see datasheet */
-		if (val > 511)
-			val = (val >> 1) | (1 << 9);
-		else if (val > 1022)
+		if (val > 1022)
 			val = (val >> 2) | (3 << 9);
+		else if (val > 511)
+			val = (val >> 1) | (1 << 9);
 
 		dat = cpu_to_be16(val);
 		ret = ad5933_i2c_write(st->client,
-- 
2.5.1

[toc] | [next] | [standalone]


#1420020

FromJonathan Cameron <jic23@kernel.org>
Date2016-06-11 19:00 +0200
Message-ID<rIUql-5vU-1@gated-at.bofh.it>
In reply to#1411492
On 01/06/16 20:25, Luis de Bethencourt wrote:
> Correctly handle the settling time cycles value. The else branch is an
> impossible condition, > 1022 in the else branch of > 511. Flipping the order.
> 
> Based on the Table 13 at the bottom of Page 25 of the Data Sheet:
> http://www.analog.com/media/en/technical-documentation/data-sheets/AD5933.pdf
> 
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
While Lars did review, it I'm not seeing an email where he
gave this tag (my inbox may well have eaten it).

Lars, could you confirm that you are happy with the
patch as it now stands.

Certainly looks right to me!

Thanks, 
Jonathan
> ---
>  drivers/staging/iio/impedance-analyzer/ad5933.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
> index 9f43976..170ac98 100644
> --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
> +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
> @@ -444,10 +444,10 @@ static ssize_t ad5933_store(struct device *dev,
>  		st->settling_cycles = val;
>  
>  		/* 2x, 4x handling, see datasheet */
> -		if (val > 511)
> -			val = (val >> 1) | (1 << 9);
> -		else if (val > 1022)
> +		if (val > 1022)
>  			val = (val >> 2) | (3 << 9);
> +		else if (val > 511)
> +			val = (val >> 1) | (1 << 9);
>  
>  		dat = cpu_to_be16(val);
>  		ret = ad5933_i2c_write(st->client,
> 

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


#1420024

FromLars-Peter Clausen <lars@metafoo.de>
Date2016-06-11 19:30 +0200
Message-ID<rIUTn-5UG-3@gated-at.bofh.it>
In reply to#1420020
On 06/11/2016 06:50 PM, Jonathan Cameron wrote:
> On 01/06/16 20:25, Luis de Bethencourt wrote:
>> Correctly handle the settling time cycles value. The else branch is an
>> impossible condition, > 1022 in the else branch of > 511. Flipping the order.
>>
>> Based on the Table 13 at the bottom of Page 25 of the Data Sheet:
>> http://www.analog.com/media/en/technical-documentation/data-sheets/AD5933.pdf
>>
>> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
>> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
> While Lars did review, it I'm not seeing an email where he
> gave this tag (my inbox may well have eaten it).
> 
> Lars, could you confirm that you are happy with the
> patch as it now stands.
> 

All good, thanks.

> Certainly looks right to me!
> 
> Thanks, 
> Jonathan
>> ---
>>  drivers/staging/iio/impedance-analyzer/ad5933.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
>> index 9f43976..170ac98 100644
>> --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
>> +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
>> @@ -444,10 +444,10 @@ static ssize_t ad5933_store(struct device *dev,
>>  		st->settling_cycles = val;
>>  
>>  		/* 2x, 4x handling, see datasheet */
>> -		if (val > 511)
>> -			val = (val >> 1) | (1 << 9);
>> -		else if (val > 1022)
>> +		if (val > 1022)
>>  			val = (val >> 2) | (3 << 9);
>> +		else if (val > 511)
>> +			val = (val >> 1) | (1 << 9);
>>  
>>  		dat = cpu_to_be16(val);
>>  		ret = ad5933_i2c_write(st->client,
>>
> 

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


#1420025

FromJonathan Cameron <jic23@kernel.org>
Date2016-06-11 19:40 +0200
Message-ID<rIV33-5XW-13@gated-at.bofh.it>
In reply to#1420024
On 11/06/16 18:25, Lars-Peter Clausen wrote:
> On 06/11/2016 06:50 PM, Jonathan Cameron wrote:
>> On 01/06/16 20:25, Luis de Bethencourt wrote:
>>> Correctly handle the settling time cycles value. The else branch is an
>>> impossible condition, > 1022 in the else branch of > 511. Flipping the order.
>>>
>>> Based on the Table 13 at the bottom of Page 25 of the Data Sheet:
>>> http://www.analog.com/media/en/technical-documentation/data-sheets/AD5933.pdf
>>>
>>> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
>>> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
>> While Lars did review, it I'm not seeing an email where he
>> gave this tag (my inbox may well have eaten it).
>>
>> Lars, could you confirm that you are happy with the
>> patch as it now stands.
>>
> 
> All good, thanks.
Applied to the fixes-togreg branch.

Thanks,

Jonathan
> 
>> Certainly looks right to me!
>>
>> Thanks, 
>> Jonathan
>>> ---
>>>  drivers/staging/iio/impedance-analyzer/ad5933.c | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
>>> index 9f43976..170ac98 100644
>>> --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
>>> +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
>>> @@ -444,10 +444,10 @@ static ssize_t ad5933_store(struct device *dev,
>>>  		st->settling_cycles = val;
>>>  
>>>  		/* 2x, 4x handling, see datasheet */
>>> -		if (val > 511)
>>> -			val = (val >> 1) | (1 << 9);
>>> -		else if (val > 1022)
>>> +		if (val > 1022)
>>>  			val = (val >> 2) | (3 << 9);
>>> +		else if (val > 511)
>>> +			val = (val >> 1) | (1 << 9);
>>>  
>>>  		dat = cpu_to_be16(val);
>>>  		ret = ad5933_i2c_write(st->client,
>>>
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web