eeprom: at24: replace msleep() with usleep_range()
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 11 Apr 2016 18:57:21 +0000 (11:57 -0700)
committerWolfram Sang <wsa@the-dreams.de>
Sat, 16 Apr 2016 20:57:22 +0000 (22:57 +0200)
We cannot expect msleep(1) to actually sleep for a period shorter than
20 ms. Replace all calls to msleep() with usleep_range().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/misc/eeprom/at24.c

index 001a9af8e36cd95a8f74ce166e75a12f12364a3f..6cc17b7779a513e7c2eb0321a24004ee5ac5ec50 100644 (file)
@@ -245,8 +245,7 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf,
                if (status == count)
                        return count;
 
-               /* REVISIT: at HZ=100, this is sloooow */
-               msleep(1);
+               usleep_range(1000, 1500);
        } while (time_before(read_time, timeout));
 
        return -ETIMEDOUT;
@@ -365,8 +364,7 @@ static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf,
                if (status == count)
                        return count;
 
-               /* REVISIT: at HZ=100, this is sloooow */
-               msleep(1);
+               usleep_range(1000, 1500);
        } while (time_before(write_time, timeout));
 
        return -ETIMEDOUT;