linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: video-i2c: don't use msleep for 1ms - 20ms
@ 2018-11-20 15:27 Akinobu Mita
  2018-11-20 16:06 ` Sakari Ailus
  2018-11-22 12:34 ` Hans Verkuil
  0 siblings, 2 replies; 3+ messages in thread
From: Akinobu Mita @ 2018-11-20 15:27 UTC (permalink / raw)
  To: linux-media
  Cc: Akinobu Mita, Matt Ranostay, Sakari Ailus, Hans Verkuil,
	Mauro Carvalho Chehab

Documentation/timers/timers-howto.txt says:

"msleep(1~20) may not do what the caller intends, and will often sleep
longer (~20 ms actual sleep for any value given in the 1~20ms range)."

So replace msleep(2) by usleep_range(2000, 3000).

Reported-by: Hans Verkuil <hansverk@cisco.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Hans Verkuil <hansverk@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
This fixes "[PATCH v4 6/6] media: video-i2c: support runtime PM" in the
patchset "[PATCH v4 0/6] media: video-i2c: support changing frame interval
and runtime PM".

 drivers/media/i2c/video-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c
index 0c82131..77080d7 100644
--- a/drivers/media/i2c/video-i2c.c
+++ b/drivers/media/i2c/video-i2c.c
@@ -155,7 +155,7 @@ static int amg88xx_set_power_on(struct video_i2c_data *data)
 	if (ret)
 		return ret;
 
-	msleep(2);
+	usleep_range(2000, 3000);
 
 	ret = regmap_write(data->regmap, AMG88XX_REG_RST, AMG88XX_RST_FLAG);
 	if (ret)
-- 
2.7.4

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

* Re: [PATCH] media: video-i2c: don't use msleep for 1ms - 20ms
  2018-11-20 15:27 [PATCH] media: video-i2c: don't use msleep for 1ms - 20ms Akinobu Mita
@ 2018-11-20 16:06 ` Sakari Ailus
  2018-11-22 12:34 ` Hans Verkuil
  1 sibling, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2018-11-20 16:06 UTC (permalink / raw)
  To: Akinobu Mita
  Cc: linux-media, Matt Ranostay, Hans Verkuil, Mauro Carvalho Chehab

On Wed, Nov 21, 2018 at 12:27:40AM +0900, Akinobu Mita wrote:
> Documentation/timers/timers-howto.txt says:
> 
> "msleep(1~20) may not do what the caller intends, and will often sleep
> longer (~20 ms actual sleep for any value given in the 1~20ms range)."
> 
> So replace msleep(2) by usleep_range(2000, 3000).
> 
> Reported-by: Hans Verkuil <hansverk@cisco.com>
> Cc: Matt Ranostay <matt.ranostay@konsulko.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Hans Verkuil <hansverk@cisco.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

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

* Re: [PATCH] media: video-i2c: don't use msleep for 1ms - 20ms
  2018-11-20 15:27 [PATCH] media: video-i2c: don't use msleep for 1ms - 20ms Akinobu Mita
  2018-11-20 16:06 ` Sakari Ailus
@ 2018-11-22 12:34 ` Hans Verkuil
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Verkuil @ 2018-11-22 12:34 UTC (permalink / raw)
  To: Akinobu Mita, linux-media
  Cc: Matt Ranostay, Sakari Ailus, Hans Verkuil, Mauro Carvalho Chehab

On 11/20/2018 04:27 PM, Akinobu Mita wrote:
> Documentation/timers/timers-howto.txt says:
> 
> "msleep(1~20) may not do what the caller intends, and will often sleep
> longer (~20 ms actual sleep for any value given in the 1~20ms range)."
> 
> So replace msleep(2) by usleep_range(2000, 3000).

Please just repost patch 6/6 with this change merged in.

Thanks!

	Hans

> 
> Reported-by: Hans Verkuil <hansverk@cisco.com>
> Cc: Matt Ranostay <matt.ranostay@konsulko.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Hans Verkuil <hansverk@cisco.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> ---
> This fixes "[PATCH v4 6/6] media: video-i2c: support runtime PM" in the
> patchset "[PATCH v4 0/6] media: video-i2c: support changing frame interval
> and runtime PM".
> 
>  drivers/media/i2c/video-i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c
> index 0c82131..77080d7 100644
> --- a/drivers/media/i2c/video-i2c.c
> +++ b/drivers/media/i2c/video-i2c.c
> @@ -155,7 +155,7 @@ static int amg88xx_set_power_on(struct video_i2c_data *data)
>  	if (ret)
>  		return ret;
>  
> -	msleep(2);
> +	usleep_range(2000, 3000);
>  
>  	ret = regmap_write(data->regmap, AMG88XX_REG_RST, AMG88XX_RST_FLAG);
>  	if (ret)
> 

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

end of thread, other threads:[~2018-11-22 23:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-20 15:27 [PATCH] media: video-i2c: don't use msleep for 1ms - 20ms Akinobu Mita
2018-11-20 16:06 ` Sakari Ailus
2018-11-22 12:34 ` Hans Verkuil

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).