linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: health: max30100: use msleep() for long uncritical delays
@ 2017-01-16 15:35 Nicholas Mc Guire
  2017-01-17  2:00 ` Matt Ranostay
  0 siblings, 1 reply; 3+ messages in thread
From: Nicholas Mc Guire @ 2017-01-16 15:35 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Matt Ranostay, linux-iio, linux-kernel, Nicholas Mc Guire

ulseep_range() uses hrtimers and provides no advantage over msleep()
for larger delays. Fix up the 35ms delays here to use msleep() and
reduce the load on the hrtimer subsystem. 

Fixes: commit 4d33615df58b ("iio: light: add MAX30100 oximeter driver support")
Link: http://lkml.org/lkml/2017/1/11/377
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Problem located with coccinelle script

Patch was compile tested with: x86_64_defconfig + CONFIG_IIO=m + 
CONFIG_MAX30100=m

Patch is aginast 4.10-rc3 (localversion-next is next-20170116)

 drivers/iio/health/max30100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c
index 90ab8a2d..9648c69 100644
--- a/drivers/iio/health/max30100.c
+++ b/drivers/iio/health/max30100.c
@@ -378,7 +378,7 @@ static int max30100_get_temp(struct max30100_data *data, int *val)
 	if (ret)
 		return ret;
 
-	usleep_range(35000, 50000);
+	msleep(35);
 
 	return max30100_read_temp(data, val);
 }
-- 
2.1.4

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

* Re: [PATCH] iio: health: max30100: use msleep() for long uncritical delays
  2017-01-16 15:35 [PATCH] iio: health: max30100: use msleep() for long uncritical delays Nicholas Mc Guire
@ 2017-01-17  2:00 ` Matt Ranostay
  2017-01-21 14:20   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Ranostay @ 2017-01-17  2:00 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Matt Ranostay, linux-iio, linux-kernel

On Mon, Jan 16, 2017 at 7:35 AM, Nicholas Mc Guire <hofrat@osadl.org> wrote:
> ulseep_range() uses hrtimers and provides no advantage over msleep()
> for larger delays. Fix up the 35ms delays here to use msleep() and
> reduce the load on the hrtimer subsystem.

Ok makes sense.  Also long as it guaranteed to be at least 35 milliseconds.

Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>

>
> Fixes: commit 4d33615df58b ("iio: light: add MAX30100 oximeter driver support")
> Link: http://lkml.org/lkml/2017/1/11/377
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
> Problem located with coccinelle script
>
> Patch was compile tested with: x86_64_defconfig + CONFIG_IIO=m +
> CONFIG_MAX30100=m
>
> Patch is aginast 4.10-rc3 (localversion-next is next-20170116)
>
>  drivers/iio/health/max30100.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c
> index 90ab8a2d..9648c69 100644
> --- a/drivers/iio/health/max30100.c
> +++ b/drivers/iio/health/max30100.c
> @@ -378,7 +378,7 @@ static int max30100_get_temp(struct max30100_data *data, int *val)
>         if (ret)
>                 return ret;
>
> -       usleep_range(35000, 50000);
> +       msleep(35);
>
>         return max30100_read_temp(data, val);
>  }
> --
> 2.1.4
>
> --
> 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] 3+ messages in thread

* Re: [PATCH] iio: health: max30100: use msleep() for long uncritical delays
  2017-01-17  2:00 ` Matt Ranostay
@ 2017-01-21 14:20   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2017-01-21 14:20 UTC (permalink / raw)
  To: Matt Ranostay, Nicholas Mc Guire
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Matt Ranostay, linux-iio, linux-kernel

On 17/01/17 02:00, Matt Ranostay wrote:
> On Mon, Jan 16, 2017 at 7:35 AM, Nicholas Mc Guire <hofrat@osadl.org> wrote:
>> ulseep_range() uses hrtimers and provides no advantage over msleep()
>> for larger delays. Fix up the 35ms delays here to use msleep() and
>> reduce the load on the hrtimer subsystem.
> 
> Ok makes sense.  Also long as it guaranteed to be at least 35 milliseconds.
> 
> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
Fair enough. Applied to the togreg branch of iio.git and pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan
> 
>>
>> Fixes: commit 4d33615df58b ("iio: light: add MAX30100 oximeter driver support")
>> Link: http://lkml.org/lkml/2017/1/11/377
>> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
>> ---
>> Problem located with coccinelle script
>>
>> Patch was compile tested with: x86_64_defconfig + CONFIG_IIO=m +
>> CONFIG_MAX30100=m
>>
>> Patch is aginast 4.10-rc3 (localversion-next is next-20170116)
>>
>>  drivers/iio/health/max30100.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c
>> index 90ab8a2d..9648c69 100644
>> --- a/drivers/iio/health/max30100.c
>> +++ b/drivers/iio/health/max30100.c
>> @@ -378,7 +378,7 @@ static int max30100_get_temp(struct max30100_data *data, int *val)
>>         if (ret)
>>                 return ret;
>>
>> -       usleep_range(35000, 50000);
>> +       msleep(35);
>>
>>         return max30100_read_temp(data, val);
>>  }
>> --
>> 2.1.4
>>
>> --
>> 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] 3+ messages in thread

end of thread, other threads:[~2017-01-21 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 15:35 [PATCH] iio: health: max30100: use msleep() for long uncritical delays Nicholas Mc Guire
2017-01-17  2:00 ` Matt Ranostay
2017-01-21 14:20   ` 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).