public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v2] staging: media: atomisp: use usleep_range instead of msleep for short delays
@ 2026-04-15 19:00 Ramon Watson Vilar
  2026-04-16  9:46 ` Sakari Ailus
  0 siblings, 1 reply; 2+ messages in thread
From: Ramon Watson Vilar @ 2026-04-15 19:00 UTC (permalink / raw)
  To: hansg, mchehab, gregkh
  Cc: sakari.ailus, linux-media, linux-staging, linux-kernel,
	Ramon Watson Vilar

The msleep() function is not precise for delays shorter than 20ms and
can sleep for significantly longer than requested. Replacing it with
usleep_range() improves accuracy and is the recommended practice
according to documentation.

Signed-off-by: Ramon Watson Vilar <watsonvilar@gmail.com>
---
 drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
index d3414312e1de..e0b0f09a5c26 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
@@ -433,7 +433,7 @@ static int power_up(struct v4l2_subdev *sd)
 			goto fail_power;
 	}
 
-	msleep(5);
+	usleep_range(5000, 10000);
 	return 0;
 
 fail_clk:
-- 
2.53.0


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

* Re: [PATCH v2] staging: media: atomisp: use usleep_range instead of msleep for short delays
  2026-04-15 19:00 [PATCH v2] staging: media: atomisp: use usleep_range instead of msleep for short delays Ramon Watson Vilar
@ 2026-04-16  9:46 ` Sakari Ailus
  0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2026-04-16  9:46 UTC (permalink / raw)
  To: Ramon Watson Vilar
  Cc: hansg, mchehab, gregkh, sakari.ailus, linux-media, linux-staging,
	linux-kernel

Hi Ramon,

On Wed, Apr 15, 2026 at 04:00:05PM -0300, Ramon Watson Vilar wrote:
> The msleep() function is not precise for delays shorter than 20ms and
> can sleep for significantly longer than requested. Replacing it with
> usleep_range() improves accuracy and is the recommended practice
> according to documentation.
> 
> Signed-off-by: Ramon Watson Vilar <watsonvilar@gmail.com>
> ---
>  drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
> index d3414312e1de..e0b0f09a5c26 100644
> --- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
> +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
> @@ -433,7 +433,7 @@ static int power_up(struct v4l2_subdev *sd)
>  			goto fail_power;
>  	}
>  
> -	msleep(5);
> +	usleep_range(5000, 10000);

A similar patch <20260319204242.2076191-1-abhai@protonmail.com> has already
been submitted.

>  	return 0;
>  
>  fail_clk:

-- 
Regards,

Sakari Ailus

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

end of thread, other threads:[~2026-04-16  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-15 19:00 [PATCH v2] staging: media: atomisp: use usleep_range instead of msleep for short delays Ramon Watson Vilar
2026-04-16  9:46 ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox