Skip to contentSkip to conversation

staging: atomisp: replace msleep with usleep_range in atomisp-gc2235.c

PATCH Superseded Oskar Ray-Frayssinet 2 participants 3 messages Mar 9 – Mar 10

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: atomisp: replace msleep with usleep_range in atomisp-gc2235.c

Replace msleep(5) with usleep_range(5000, 6000) to avoid sleeping longer than necessary. msleep() with values less than 20ms may sleep for up to 20ms due to timer granularity.

---
 drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +1 -1
index d3414312e1de..db5e007efc56 100644
@@ -433,7 +433,7 @@ static int power_up(struct v4l2_subdev *sd)
 			goto fail_power;
 	}
 
-	msleep(5);
+	usleep_range(5000, 6000);
 	return 0;
 
 fail_clk:
Signature · 1 line
2.43.0
#1 lore raw
Quoted 3 lines · Oskar Ray-Frayssinet

Replace msleep(5) with usleep_range(5000, 6000) to avoid sleeping longer than necessary. msleep() with values less than 20ms may sleep for up to 20ms due to timer granularity.

Use () in Subject, use fsleep() in the code.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

PATCH v2 1/1 staging: media: atomisp: replace msleep() with fsleep() in atomisp-gc2235.c

In reply to Oskar Ray-Frayssinet

Replace msleep(5) with fsleep(5000) to avoid sleeping longer than necessary. msleep() with values less than 20ms may sleep for up to 20ms due to timer granularity. fsleep() selects the appropriate sleep function automatically.

---
 drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +1 -1
index d3414312e1de..7999c8595a68 100644
@@ -433,7 +433,7 @@ static int power_up(struct v4l2_subdev *sd)
 			goto fail_power;
 	}
 
-	msleep(5);
+	fsleep(5000);
 	return 0;
 
 fail_clk:
Signature · 1 line
2.43.0