Skip to contentSkip to conversation

media: video-i2c: don't use msleep for 1ms - 20ms

PATCH In review Akinobu Mita 3 participants 3 messages Nov 21, 2018 – Nov 22, 2018

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

PATCH 1/1 media: video-i2c: don't use msleep for 1ms - 20ms

Documentation/timers/timers-howto.txt says:

"msleep(1~20) may not do what the caller intends, and will often sleep longer (~20 ms actual sleep for any value given in the 1~20ms range)."

So replace msleep(2) by usleep_range(2000, 3000).

Cc Matt Ranostay <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>

---
This fixes "[PATCH v4 6/6] media: video-i2c: support runtime PM" in the patchset "[PATCH v4 0/6] media: video-i2c: support changing frame interval and runtime PM".

 drivers/media/i2c/video-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/video-i2c.c +1 -1
index 0c82131..77080d7 100644
@@ -155,7 +155,7 @@ static int amg88xx_set_power_on(struct video_i2c_data *data)
 	if (ret)
 		return ret;
 
-	msleep(2);
+	usleep_range(2000, 3000);
 
 	ret = regmap_write(data->regmap, AMG88XX_REG_RST, AMG88XX_RST_FLAG);
 	if (ret)
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Akinobu Mita

Documentation/timers/timers-howto.txt says:

"msleep(1~20) may not do what the caller intends, and will often sleep longer (~20 ms actual sleep for any value given in the 1~20ms range)."

Quoted 8 lines

So replace msleep(2) by usleep_range(2000, 3000).

Cc Matt Ranostay <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Signature · 2 lines
Sakari Ailus
[email protected]
#2 lore raw
In reply to Akinobu Mita
Quoted 6 lines · Akinobu Mita

Documentation/timers/timers-howto.txt says:

"msleep(1~20) may not do what the caller intends, and will often sleep longer (~20 ms actual sleep for any value given in the 1~20ms range)."

So replace msleep(2) by usleep_range(2000, 3000).

Please just repost patch 6/6 with this change merged in.

Thanks!

Hans

Quoted 29 lines
Cc Matt Ranostay <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>

---
This fixes "[PATCH v4 6/6] media: video-i2c: support runtime PM" in the patchset "[PATCH v4 0/6] media: video-i2c: support changing frame interval and runtime PM".

 drivers/media/i2c/video-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/video-i2c.c +1 -1
index 0c82131..77080d7 100644
@@ -155,7 +155,7 @@ static int amg88xx_set_power_on(struct video_i2c_data *data)
 	if (ret)
 		return ret;
 
-	msleep(2);
+	usleep_range(2000, 3000);
 
 	ret = regmap_write(data->regmap, AMG88XX_REG_RST, AMG88XX_RST_FLAG);
 	if (ret)