Skip to contentSkip to conversation

mmc: core: Use usleep_range for delays less than 20ms

PATCH New Sujit Reddy Thumma 1 participant 1 message Nov 9, 2011

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

PATCH 1/1 mmc: core: Use usleep_range for delays less than 20ms

msleep of any delay less than 20ms (or 2 jiffies) would give an unpredictable delay (most of the times as ~20ms). Use usleep_range in mmc_delay() for delays less than two jiffies.

---
 drivers/mmc/core/core.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/mmc/core/core.h +2 -0
index 14664f1..45a6a12 100644
@@ -50,6 +50,8 @@ static inline void mmc_delay(unsigned int ms)
 	if (ms < 1000 / HZ) {
 		cond_resched();
 		mdelay(ms);
+	} else if (ms < jiffies_to_msecs(2)) {
+		usleep_range(ms * 1000, (ms + 1) * 1000);
 	} else {
 		msleep(ms);
 	}
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.