linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Char: ds1286, eliminate busy waiting
@ 2008-07-25 17:49 Jiri Slaby
  2008-07-28 23:05 ` Ralf Baechle
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2008-07-25 17:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mips, linux-kernel, Jiri Slaby, Ralf Baechle

ds1286_get_time(); is not called from atomic context, sleep for 20 ms is
better choice than a (home-made) busy waiting for such a situation.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
---
 drivers/char/ds1286.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index fb58493..5329d48 100644
--- a/drivers/char/ds1286.c
+++ b/drivers/char/ds1286.c
@@ -443,7 +443,6 @@ static void ds1286_get_time(struct rtc_time *rtc_tm)
 {
 	unsigned char save_control;
 	unsigned long flags;
-	unsigned long uip_watchdog = jiffies;
 
 	/*
 	 * read RTC once any update in progress is done. The update
@@ -456,8 +455,7 @@ static void ds1286_get_time(struct rtc_time *rtc_tm)
 	 */
 
 	if (ds1286_is_updating() != 0)
-		while (time_before(jiffies, uip_watchdog + 2*HZ/100))
-			barrier();
+		msleep(20);
 
 	/*
 	 * Only the values that we read from the RTC are set. We leave
-- 
1.5.6.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] Char: ds1286, eliminate busy waiting
  2008-07-25 17:49 [PATCH 1/1] Char: ds1286, eliminate busy waiting Jiri Slaby
@ 2008-07-28 23:05 ` Ralf Baechle
  2008-07-29  9:42   ` Jiri Slaby
  0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2008-07-28 23:05 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Andrew Morton, linux-mips, linux-kernel

On Fri, Jul 25, 2008 at 07:49:58PM +0200, Jiri Slaby wrote:

> ds1286_get_time(); is not called from atomic context, sleep for 20 ms is
> better choice than a (home-made) busy waiting for such a situation.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>

Looks ok to me I guess.  Though I don't really think it matters ...

Acked-by: Ralf Baechle <ralf@linux-mips.org>

The same condition also appears in drivers/char/rtc.c and maybe a few
others.  Rtc.c has been copies and modified several times.

  Ralf

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] Char: ds1286, eliminate busy waiting
  2008-07-28 23:05 ` Ralf Baechle
@ 2008-07-29  9:42   ` Jiri Slaby
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2008-07-29  9:42 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Andrew Morton, linux-mips, linux-kernel

Ralf Baechle napsal(a):
> On Fri, Jul 25, 2008 at 07:49:58PM +0200, Jiri Slaby wrote:
> 
>> ds1286_get_time(); is not called from atomic context, sleep for 20 ms is
>> better choice than a (home-made) busy waiting for such a situation.

> Looks ok to me I guess.  Though I don't really think it matters ...

I think RT people has different opinion ;).

> The same condition also appears in drivers/char/rtc.c and maybe a few
> others.  Rtc.c has been copies and modified several times.

In rtc.c there is something completely different:
         while (rtc_is_updating() != 0 &&
                time_before(jiffies, uip_watchdog + 2*HZ/100))
                 cpu_relax();

It's a conditional busy-waiting. It reads the rtc status after each busy 
cycle while in the ds1286 there was
         if (ds1286_is_updating() != 0)
                 while (time_before(jiffies, uip_watchdog + 2*HZ/100))
                         barrier();

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-29  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-25 17:49 [PATCH 1/1] Char: ds1286, eliminate busy waiting Jiri Slaby
2008-07-28 23:05 ` Ralf Baechle
2008-07-29  9:42   ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).