Commit 012e52e1 authored by Linus Walleij's avatar Linus Walleij Committed by Linus Torvalds

drivers/rtc/rtc-ab8500.c: change msleep() to usleep_range()

The resolution of msleep is related to HZ, so with HZ set to 100 any
msleep of less than 10ms will become ~10ms.  This is not what we want.
Use the hrtimer-based usleep_range() and allow for some slack in the
non-critical path so we have more control of what is happening here.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Cc: Jonas Aaberg <jonas.aberg@stericsson.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b62581e6
...@@ -90,7 +90,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) ...@@ -90,7 +90,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm)
/* Early AB8500 chips will not clear the rtc read request bit */ /* Early AB8500 chips will not clear the rtc read request bit */
if (abx500_get_chip_id(dev) == 0) { if (abx500_get_chip_id(dev) == 0) {
msleep(1); usleep_range(1000, 1000);
} else { } else {
/* Wait for some cycles after enabling the rtc read in ab8500 */ /* Wait for some cycles after enabling the rtc read in ab8500 */
while (time_before(jiffies, timeout)) { while (time_before(jiffies, timeout)) {
...@@ -102,7 +102,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) ...@@ -102,7 +102,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm)
if (!(value & RTC_READ_REQUEST)) if (!(value & RTC_READ_REQUEST))
break; break;
msleep(1); usleep_range(1000, 5000);
} }
} }
...@@ -295,7 +295,7 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) ...@@ -295,7 +295,7 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev)
return err; return err;
/* Wait for reset by the PorRtc */ /* Wait for reset by the PorRtc */
msleep(1); usleep_range(1000, 5000);
err = abx500_get_register_interruptible(&pdev->dev, AB8500_RTC, err = abx500_get_register_interruptible(&pdev->dev, AB8500_RTC,
AB8500_RTC_STAT_REG, &rtc_ctrl); AB8500_RTC_STAT_REG, &rtc_ctrl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment