media: dvb-usb-v2/gl861: use usleep_range() for short delay
authorAkihiro Tsukada <tskd08@gmail.com>
Sun, 8 Apr 2018 17:21:37 +0000 (13:21 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Sat, 5 May 2018 11:15:09 +0000 (07:15 -0400)
As the kernel doc "timers-howto.txt" reads,
short delay with msleep() can take much longer.
In a case of raspbery-pi platform where CONFIG_HZ_100 was set,
it actually affected the init of Friio devices
since it issues lots of i2c transactions with short delay.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/usb/dvb-usb-v2/gl861.c

index b1b09c547861c26c3672a7290a45486ce52c9e30..b1dbb9af380be78593e8bbbb57e48d8ab7fd0737 100644 (file)
@@ -43,7 +43,7 @@ static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
                return -EINVAL;
        }
 
-       msleep(1); /* avoid I2C errors */
+       usleep_range(1000, 2000); /* avoid I2C errors */
 
        return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type,
                               value, index, rbuf, rlen, 2000);