rtc: max77686: Use usleep_range() instead of msleep()
authorJavier Martinez Canillas <javier@osg.samsung.com>
Wed, 27 Jan 2016 03:36:39 +0000 (00:36 -0300)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 4 Feb 2016 22:42:07 +0000 (23:42 +0100)
Documentation/timers/timers-howto.txt suggest to use usleep_range()
instead of msleep() for small msec (1ms - 20ms) since msleep() will
often sleep for 20ms for any value in that range.

This is fine in this case since 16ms is the _minimum_ delay required
by max77686 for an RTC update but by using usleep_range() instead of
msleep(), the driver can support other RTC IP blocks with a shorter
minimum delay (i.e: in the range of usecs instead of msecs).

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-max77686.c

index d84a50c9f7f7574d2b6e79ac0fe0be1fa49a05b3..025a17a95da3195040b70cf1554190e6e7180bba 100644 (file)
@@ -41,7 +41,7 @@
 #define ALARM_ENABLE_SHIFT             7
 #define ALARM_ENABLE_MASK              (1 << ALARM_ENABLE_SHIFT)
 
-#define MAX77686_RTC_UPDATE_DELAY      16
+#define MAX77686_RTC_UPDATE_DELAY      16000
 
 enum {
        RTC_SEC = 0,
@@ -130,7 +130,8 @@ static int max77686_rtc_update(struct max77686_rtc_info *info,
                                __func__, ret, data);
        else {
                /* Minimum 16ms delay required before RTC update. */
-               msleep(MAX77686_RTC_UPDATE_DELAY);
+               usleep_range(MAX77686_RTC_UPDATE_DELAY,
+                            MAX77686_RTC_UPDATE_DELAY * 2);
        }
 
        return ret;
This page took 0.025668 seconds and 5 git commands to generate.