diff mbox series

[RFT/RFC,v2,28/47] staging: media: zoran: convert mdelay to udelay

Message ID 1601058657-14042-29-git-send-email-clabbe@baylibre.com (mailing list archive)
State New, archived
Headers show
Series staging: media: bring back zoran driver | expand

Commit Message

Corentin LABBE Sept. 25, 2020, 6:30 p.m. UTC
As asked by checkpath, let's use udelay.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/staging/media/zoran/zoran_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mauro Carvalho Chehab Oct. 1, 2020, 7:54 a.m. UTC | #1
Em Fri, 25 Sep 2020 18:30:38 +0000
Corentin Labbe <clabbe@baylibre.com> escreveu:

> As asked by checkpath, let's use udelay.
> 
> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  drivers/staging/media/zoran/zoran_device.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c
> index 0ecb044f8e8f..4c9f6eafd130 100644
> --- a/drivers/staging/media/zoran/zoran_device.c
> +++ b/drivers/staging/media/zoran/zoran_device.c
> @@ -1332,9 +1332,9 @@ void zoran_init_hardware(struct zoran *zr)
>  void zr36057_restart(struct zoran *zr)
>  {
>  	btwrite(0, ZR36057_SPGPPCR);
> -	mdelay(1);
> +	udelay(1000);
>  	btor(ZR36057_SPGPPCR_SoftReset, ZR36057_SPGPPCR);
> -	mdelay(1);
> +	udelay(1000);

Ok, this is still on staging, so I'm willing to accept it, but
why aren't you using usleep_range() instead?

mdelay/udelay should be used only when the delay time should
be as precise as possible, as what they do is to keep the CPU
busy during the wait time.

I doubt that this is the case here. So, I would use,
instead, something like:

	usleep_range(1000, 2000)

(assuming that 4ms is still a reasonable time for the soft
reset to happen).

>  
>  	/* assert P_Reset */
>  	btwrite(0, ZR36057_JPC);



Thanks,
Mauro
diff mbox series

Patch

diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c
index 0ecb044f8e8f..4c9f6eafd130 100644
--- a/drivers/staging/media/zoran/zoran_device.c
+++ b/drivers/staging/media/zoran/zoran_device.c
@@ -1332,9 +1332,9 @@  void zoran_init_hardware(struct zoran *zr)
 void zr36057_restart(struct zoran *zr)
 {
 	btwrite(0, ZR36057_SPGPPCR);
-	mdelay(1);
+	udelay(1000);
 	btor(ZR36057_SPGPPCR_SoftReset, ZR36057_SPGPPCR);
-	mdelay(1);
+	udelay(1000);
 
 	/* assert P_Reset */
 	btwrite(0, ZR36057_JPC);