linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] ov9650: use msleep() for uncritical long delay
@ 2017-01-16 13:58 Nicholas Mc Guire
  2017-01-18 23:25 ` Laurent Pinchart
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2017-01-16 13:58 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Hans Verkuil, Laurent Pinchart, Guennadi Liakhovetski,
	Javier Martinez Canillas, linux-media, linux-kernel,
	Nicholas Mc Guire

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

Link: http://lkml.org/lkml/2017/1/11/377
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Problem found by coccinelle script

Patch was compile tested with: x86_64_defconfig + CONFIG_MEDIA_SUPPORT=m
CONFIG_MEDIA_ANALOG_TV_SUPPORT=y, CONFIG_MEDIA_CONTROLLER=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y, CONFIG_MEDIA_SUBDRV_AUTOSELECT=n
CONFIG_VIDEO_OV9650=m

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

 drivers/media/i2c/ov9650.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
index 502c722..2de2fbb 100644
--- a/drivers/media/i2c/ov9650.c
+++ b/drivers/media/i2c/ov9650.c
@@ -522,7 +522,7 @@ static void __ov965x_set_power(struct ov965x *ov965x, int on)
 	if (on) {
 		ov965x_gpio_set(ov965x->gpios[GPIO_PWDN], 0);
 		ov965x_gpio_set(ov965x->gpios[GPIO_RST], 0);
-		usleep_range(25000, 26000);
+		msleep(25);
 	} else {
 		ov965x_gpio_set(ov965x->gpios[GPIO_RST], 1);
 		ov965x_gpio_set(ov965x->gpios[GPIO_PWDN], 1);
@@ -1438,7 +1438,7 @@ static int ov965x_detect_sensor(struct v4l2_subdev *sd)
 
 	mutex_lock(&ov965x->lock);
 	__ov965x_set_power(ov965x, 1);
-	usleep_range(25000, 26000);
+	msleep(25);
 
 	/* Check sensor revision */
 	ret = ov965x_read(client, REG_PID, &pid);
-- 
2.1.4


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

* Re: [PATCH] [media] ov9650: use msleep() for uncritical long delay
  2017-01-16 13:58 [PATCH] [media] ov9650: use msleep() for uncritical long delay Nicholas Mc Guire
@ 2017-01-18 23:25 ` Laurent Pinchart
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2017-01-18 23:25 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Guennadi Liakhovetski,
	Javier Martinez Canillas, linux-media, linux-kernel

Hi Nicholas,

Thank you for the patch.

On Monday 16 Jan 2017 14:58:33 Nicholas Mc Guire wrote:
> ulseep_range() uses hrtimers and provides no advantage over msleep()
> for larger delays. Fix up the 25ms delays here to use msleep() and
> reduce the load on the hrtimer subsystem.
> 
> Link: http://lkml.org/lkml/2017/1/11/377
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

and applied to my tree. I'll send a pull request for v4.11.

> ---
> Problem found by coccinelle script
> 
> Patch was compile tested with: x86_64_defconfig + CONFIG_MEDIA_SUPPORT=m
> CONFIG_MEDIA_ANALOG_TV_SUPPORT=y, CONFIG_MEDIA_CONTROLLER=y
> CONFIG_VIDEO_V4L2_SUBDEV_API=y, CONFIG_MEDIA_SUBDRV_AUTOSELECT=n
> CONFIG_VIDEO_OV9650=m
> 
> Patch is aginast 4.10-rc3 (localversion-next is next-20170116)
> 
>  drivers/media/i2c/ov9650.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
> index 502c722..2de2fbb 100644
> --- a/drivers/media/i2c/ov9650.c
> +++ b/drivers/media/i2c/ov9650.c
> @@ -522,7 +522,7 @@ static void __ov965x_set_power(struct ov965x *ov965x,
> int on) if (on) {
>  		ov965x_gpio_set(ov965x->gpios[GPIO_PWDN], 0);
>  		ov965x_gpio_set(ov965x->gpios[GPIO_RST], 0);
> -		usleep_range(25000, 26000);
> +		msleep(25);
>  	} else {
>  		ov965x_gpio_set(ov965x->gpios[GPIO_RST], 1);
>  		ov965x_gpio_set(ov965x->gpios[GPIO_PWDN], 1);
> @@ -1438,7 +1438,7 @@ static int ov965x_detect_sensor(struct v4l2_subdev
> *sd)
> 
>  	mutex_lock(&ov965x->lock);
>  	__ov965x_set_power(ov965x, 1);
> -	usleep_range(25000, 26000);
> +	msleep(25);
> 
>  	/* Check sensor revision */
>  	ret = ov965x_read(client, REG_PID, &pid);

-- 
Regards,

Laurent Pinchart


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

end of thread, other threads:[~2017-01-18 23:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-16 13:58 [PATCH] [media] ov9650: use msleep() for uncritical long delay Nicholas Mc Guire
2017-01-18 23:25 ` Laurent Pinchart

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