]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/rtc/rtc-ab8500.c: change msleep() to usleep_range()
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 8 Dec 2011 04:42:30 +0000 (15:42 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 14 Dec 2011 05:52:02 +0000 (16:52 +1100)
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: Linus 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: Andrew Morton <akpm@linux-foundation.org>
drivers/rtc/rtc-ab8500.c

index 82a348095a715db522a024d9e0dc593e06783951..919b2e5cb7f03520857e10d5b959576d4e3727d3 100644 (file)
@@ -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 */
        if (abx500_get_chip_id(dev) == 0) {
-               msleep(1);
+               usleep_range(1000, 1000);
        } else {
                /* Wait for some cycles after enabling the rtc read in ab8500 */
                while (time_before(jiffies, timeout)) {
@@ -102,7 +102,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm)
                        if (!(value & RTC_READ_REQUEST))
                                break;
 
-                       msleep(1);
+                       usleep_range(1000, 5000);
                }
        }
 
@@ -295,7 +295,7 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev)
                return err;
 
        /* Wait for reset by the PorRtc */
-       msleep(1);
+       usleep_range(1000, 5000);
 
        err = abx500_get_register_interruptible(&pdev->dev, AB8500_RTC,
                AB8500_RTC_STAT_REG, &rtc_ctrl);