Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1313384 > unrolled thread

[PATCH 2/8] rtc: max77686: Use usleep_range() instead of msleep()

Started byJavier Martinez Canillas <javier@osg.samsung.com>
First post2016-01-20 18:20 +0100
Last post2016-01-21 16:00 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/8] rtc: max77686: Use usleep_range() instead of msleep() Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-20 18:20 +0100
    Re: [PATCH 2/8] rtc: max77686: Use usleep_range() instead of msleep() Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-01-21 01:40 +0100
      Re: [PATCH 2/8] rtc: max77686: Use usleep_range() instead of msleep() Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-21 16:00 +0100

#1313384 — [PATCH 2/8] rtc: max77686: Use usleep_range() instead of msleep()

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-01-20 18:20 +0100
Subject[PATCH 2/8] rtc: max77686: Use usleep_range() instead of msleep()
Message-ID<qT4Ah-1fm-5@gated-at.bofh.it>
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
minium delay (i.e: in the range of usecs insted of msecs).

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/rtc/rtc-max77686.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 9599be257db4..ae4d61e7ce4b 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -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;
-- 
2.5.0

[toc] | [next] | [standalone]


#1313730

FromKrzysztof Kozlowski <k.kozlowski@samsung.com>
Date2016-01-21 01:40 +0100
Message-ID<qTbs7-5IQ-21@gated-at.bofh.it>
In reply to#1313384
On 21.01.2016 02:14, Javier Martinez Canillas wrote:
> 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
> minium delay (i.e: in the range of usecs insted of msecs).

s/minium/minimum/
s/insted/instead/

> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> ---
> 
>  drivers/rtc/rtc-max77686.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

[toc] | [prev] | [next] | [standalone]


#1314241

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-01-21 16:00 +0100
Message-ID<qToSl-6CC-11@gated-at.bofh.it>
In reply to#1313730
Hello Krzysztof,

On 01/20/2016 09:37 PM, Krzysztof Kozlowski wrote:
> On 21.01.2016 02:14, Javier Martinez Canillas wrote:
>> 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
>> minium delay (i.e: in the range of usecs insted of msecs).
>
> s/minium/minimum/
> s/insted/instead/
>

Fixed.

>>
>> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
>> ---
>>
>>   drivers/rtc/rtc-max77686.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>

Thanks a lot for your review.
  
> Best regards,
> Krzysztof
>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web