diff mbox series

[v9.2,9/9] fixes! [rdacm20]: Use usleep_range over mdelay(10)

Message ID 20200610124623.51085-10-kieran@bingham.xyz (mailing list archive)
State Superseded
Delegated to: Kieran Bingham
Headers show
Series GMSL fixups ready for v10. | expand

Commit Message

Kieran Bingham June 10, 2020, 12:46 p.m. UTC
From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

Prefer usleep_range rather than the busy looping mdelay for 10ms waits.

msleep( n < 20 ) may sleep up to 20 milliseconds, but in this instance I
don't think that's a issue here. All the same, use usleep_range between
10, 15 milliseconds.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
---
 drivers/media/i2c/rdacm20.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jacopo Mondi June 10, 2020, 1:20 p.m. UTC | #1
Hi Kieran,

On Wed, Jun 10, 2020 at 01:46:23PM +0100, Kieran Bingham wrote:
> From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
>
> Prefer usleep_range rather than the busy looping mdelay for 10ms waits.
>
> msleep( n < 20 ) may sleep up to 20 milliseconds, but in this instance I
> don't think that's a issue here. All the same, use usleep_range between
> 10, 15 milliseconds.

I think a rather conservative sleep interval like this one is fine, as
I don't have a characterization of the resest delay for this chip. The
10ms came from BSp code, and I'm not sure that was an empirical
measurement of was supported by some document.

Acked-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
   j

>
> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> ---
>  drivers/media/i2c/rdacm20.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c
> index cda3e6372ea9..1ed928c4ca70 100644
> --- a/drivers/media/i2c/rdacm20.c
> +++ b/drivers/media/i2c/rdacm20.c
> @@ -488,9 +488,9 @@ static int rdacm20_initialize(struct rdacm20_device *dev)
>  	 * MAX9271 GPIO1 and verify communication with the OV10635.
>  	 */
>  	max9271_clear_gpios(dev->serializer, MAX9271_GPIO1OUT);
> -	mdelay(10);
> +	usleep_range(10000, 15000);
>  	max9271_set_gpios(dev->serializer, MAX9271_GPIO1OUT);
> -	mdelay(10);
> +	usleep_range(10000, 15000);
>
>  again:
>  	ret = ov10635_read16(dev, OV10635_PID);
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c
index cda3e6372ea9..1ed928c4ca70 100644
--- a/drivers/media/i2c/rdacm20.c
+++ b/drivers/media/i2c/rdacm20.c
@@ -488,9 +488,9 @@  static int rdacm20_initialize(struct rdacm20_device *dev)
 	 * MAX9271 GPIO1 and verify communication with the OV10635.
 	 */
 	max9271_clear_gpios(dev->serializer, MAX9271_GPIO1OUT);
-	mdelay(10);
+	usleep_range(10000, 15000);
 	max9271_set_gpios(dev->serializer, MAX9271_GPIO1OUT);
-	mdelay(10);
+	usleep_range(10000, 15000);
 
 again:
 	ret = ov10635_read16(dev, OV10635_PID);