diff mbox

[RESEND,3/4] rtc/ab8500: change to mdelay

Message ID 1322067419-12536-1-git-send-email-linus.walleij@stericsson.com
State Rejected
Headers show

Commit Message

Linus Walleij Nov. 23, 2011, 4:56 p.m. UTC
From: Jonas Aaberg <jonas.aberg@stericsson.com>

The resolution of msleep is related to HZ, so with HZ set to
100 any msleep of less than 10ms will become ~10ms. This does
not work for us, so stick to mdelay(1).

Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/rtc/rtc-ab8500.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Comments

Andrew Morton Nov. 28, 2011, 11:12 p.m. UTC | #1
On Wed, 23 Nov 2011 17:56:59 +0100
Linus Walleij <linus.walleij@stericsson.com> wrote:

> From: Jonas Aaberg <jonas.aberg@stericsson.com>
> 
> The resolution of msleep is related to HZ, so with HZ set to
> 100 any msleep of less than 10ms will become ~10ms. This does
> not work for us, so stick to mdelay(1).

"this does not work for us" is unusefully vague.  If there was a
user-observable problem then please fully describe it.

> --- a/drivers/rtc/rtc-ab8500.c
> +++ b/drivers/rtc/rtc-ab8500.c
> @@ -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);
> +		mdelay(1);

Replacing a sleep with a busy wait is regrettable.  (Particularly when
we weren't told what's wrong with the sleep!).

Was the use of usleep_range() considered?
diff mbox

Patch

diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c
index 82a3480..326a1a5 100644
--- a/drivers/rtc/rtc-ab8500.c
+++ b/drivers/rtc/rtc-ab8500.c
@@ -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);
+		mdelay(1);
 	} 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);
+			mdelay(1);
 		}
 	}
 
@@ -295,7 +295,7 @@  static int __devinit ab8500_rtc_probe(struct platform_device *pdev)
 		return err;
 
 	/* Wait for reset by the PorRtc */
-	msleep(1);
+	mdelay(1);
 
 	err = abx500_get_register_interruptible(&pdev->dev, AB8500_RTC,
 		AB8500_RTC_STAT_REG, &rtc_ctrl);