diff mbox

[RESEND,v2,05/13] eeprom: at24: replace msleep() with usleep_range()

Message ID 1460401049-25459-6-git-send-email-bgolaszewski@baylibre.com
State Accepted
Headers show

Commit Message

Bartosz Golaszewski April 11, 2016, 6:57 p.m. UTC
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>
---
 drivers/misc/eeprom/at24.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Wolfram Sang April 16, 2016, 8:58 p.m. UTC | #1
On Mon, Apr 11, 2016 at 11:57:21AM -0700, Bartosz Golaszewski wrote:
> 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>

Applied to for-next, thanks!
diff mbox

Patch

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 9e01428..bc5be1e 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -240,8 +240,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;
@@ -355,8 +354,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;