linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: light: apds9960: correct FIFO check condition
@ 2016-03-18  3:48 Matt Ranostay
  2016-03-20 10:34 ` Jonathan Cameron
       [not found] ` <1458272888-26146-2-git-send-email-mranostay@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Matt Ranostay @ 2016-03-18  3:48 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, dcb314, pmeerw, Matt Ranostay

Correct issue that the last entry in FIFO was being read twice due
to an incorrect decrement of entry count variable before condition
check.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
---
 drivers/iio/light/apds9960.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
index f6a07dc..a6af56a 100644
--- a/drivers/iio/light/apds9960.c
+++ b/drivers/iio/light/apds9960.c
@@ -769,7 +769,7 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data)
 	mutex_lock(&data->lock);
 	data->gesture_mode_running = 1;
 
-	while (cnt-- || (cnt = apds9660_fifo_is_empty(data) > 0)) {
+	while (cnt || (cnt = apds9660_fifo_is_empty(data) > 0)) {
 		ret = regmap_bulk_read(data->regmap, APDS9960_REG_GFIFO_BASE,
 				      &data->buffer, 4);
 
@@ -777,6 +777,7 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data)
 			goto err_read;
 
 		iio_push_to_buffers(data->indio_dev, data->buffer);
+		cnt--;
 	}
 
 err_read:
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: light: apds9960: correct FIFO check condition
  2016-03-18  3:48 [PATCH] iio: light: apds9960: correct FIFO check condition Matt Ranostay
@ 2016-03-20 10:34 ` Jonathan Cameron
       [not found] ` <1458272888-26146-2-git-send-email-mranostay@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2016-03-20 10:34 UTC (permalink / raw)
  To: Matt Ranostay; +Cc: linux-iio, dcb314, pmeerw

On 18/03/16 03:48, Matt Ranostay wrote:
> Correct issue that the last entry in FIFO was being read twice due
> to an incorrect decrement of entry count variable before condition
> check.
> 
> Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Applied to the fixes branch of iio.git.

Thanks,

Jonathan
> ---
>  drivers/iio/light/apds9960.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
> index f6a07dc..a6af56a 100644
> --- a/drivers/iio/light/apds9960.c
> +++ b/drivers/iio/light/apds9960.c
> @@ -769,7 +769,7 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data)
>  	mutex_lock(&data->lock);
>  	data->gesture_mode_running = 1;
>  
> -	while (cnt-- || (cnt = apds9660_fifo_is_empty(data) > 0)) {
> +	while (cnt || (cnt = apds9660_fifo_is_empty(data) > 0)) {
>  		ret = regmap_bulk_read(data->regmap, APDS9960_REG_GFIFO_BASE,
>  				      &data->buffer, 4);
>  
> @@ -777,6 +777,7 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data)
>  			goto err_read;
>  
>  		iio_push_to_buffers(data->indio_dev, data->buffer);
> +		cnt--;
>  	}
>  
>  err_read:
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: health: max30100: correct FIFO check condition
       [not found] ` <1458272888-26146-2-git-send-email-mranostay@gmail.com>
@ 2016-03-26  3:42   ` Matt Ranostay
  2016-03-28  9:10     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Ranostay @ 2016-03-26  3:42 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio@vger.kernel.org, David Binderman,
	Peter Meerwald-Stadler, Matt Ranostay

This get lost in the inbox? :)
Same fix as for APDS9660 issue in the FIFO

On Thu, Mar 17, 2016 at 8:48 PM, Matt Ranostay <mranostay@gmail.com> wrote:
> Correct issue that the last entry in FIFO was being read twice due
> to an incorrect decrement of entry count variable before condition
> check.
>
> Signed-off-by: Matt Ranostay <mranostay@gmail.com>
> ---
>  drivers/iio/health/max30100.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c
> index 09db893..90ab8a2d 100644
> --- a/drivers/iio/health/max30100.c
> +++ b/drivers/iio/health/max30100.c
> @@ -238,12 +238,13 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private)
>
>         mutex_lock(&data->lock);
>
> -       while (cnt-- || (cnt = max30100_fifo_count(data) > 0)) {
> +       while (cnt || (cnt = max30100_fifo_count(data) > 0)) {
>                 ret = max30100_read_measurement(data);
>                 if (ret)
>                         break;
>
>                 iio_push_to_buffers(data->indio_dev, data->buffer);
> +               cnt--;
>         }
>
>         mutex_unlock(&data->lock);
> --
> 2.7.0
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: health: max30100: correct FIFO check condition
  2016-03-26  3:42   ` [PATCH] iio: health: max30100: " Matt Ranostay
@ 2016-03-28  9:10     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2016-03-28  9:10 UTC (permalink / raw)
  To: Matt Ranostay
  Cc: linux-iio@vger.kernel.org, David Binderman,
	Peter Meerwald-Stadler

On 26/03/16 03:42, Matt Ranostay wrote:
> This get lost in the inbox? :)
> Same fix as for APDS9660 issue in the FIFO
> 
> On Thu, Mar 17, 2016 at 8:48 PM, Matt Ranostay <mranostay@gmail.com> wrote:
>> Correct issue that the last entry in FIFO was being read twice due
>> to an incorrect decrement of entry count variable before condition
>> check.
>>
>> Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Odd - disappeared without trace.  Well spotted.

Applied to the fixes-togreg-post-rc1 branch of iio.git

Thanks,

Jonathan
>> ---
>>  drivers/iio/health/max30100.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c
>> index 09db893..90ab8a2d 100644
>> --- a/drivers/iio/health/max30100.c
>> +++ b/drivers/iio/health/max30100.c
>> @@ -238,12 +238,13 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private)
>>
>>         mutex_lock(&data->lock);
>>
>> -       while (cnt-- || (cnt = max30100_fifo_count(data) > 0)) {
>> +       while (cnt || (cnt = max30100_fifo_count(data) > 0)) {
>>                 ret = max30100_read_measurement(data);
>>                 if (ret)
>>                         break;
>>
>>                 iio_push_to_buffers(data->indio_dev, data->buffer);
>> +               cnt--;
>>         }
>>
>>         mutex_unlock(&data->lock);
>> --
>> 2.7.0
>>
> --
> 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
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-28  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18  3:48 [PATCH] iio: light: apds9960: correct FIFO check condition Matt Ranostay
2016-03-20 10:34 ` Jonathan Cameron
     [not found] ` <1458272888-26146-2-git-send-email-mranostay@gmail.com>
2016-03-26  3:42   ` [PATCH] iio: health: max30100: " Matt Ranostay
2016-03-28  9:10     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).