mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@osdl.org>
To: Arjan van de Ven <arjanv@redhat.com>
Cc: Chris Wright <chrisw@osdl.org>,
	linux-kernel@vger.kernel.org, chas@cmf.nrl.navy.mil,
	torvalds@osdl.org, mitch@sfgoth.com
Subject: Re: [PATCH 2/13] use cpu_relax() in busy loop
Date: Fri, 19 Sep 2003 12:49:54 -0700	[thread overview]
Message-ID: <20030919124954.D27079@osdlab.pdx.osdl.net> (raw)
In-Reply-To: <1063956829.5394.1.camel@laptop.fenrus.com>; from arjanv@redhat.com on Fri, Sep 19, 2003 at 09:33:50AM +0200

* Arjan van de Ven (arjanv@redhat.com) wrote:
> ehmmm how about making this use mdelay instead ?
> (not to speak of maybe making it sleep, but that's a less obvious
> transformation)

I didn't want to change to sleep semantics of the call w/out better
review of spinlocks held/irq disabled, etc.  But, after feedback from
Mitch, looks like these were only called during module init/exit.  This
look ok?

thanks,
-chris

[PATCH 2/13] use schedule_timeout() instead of busy loop

Replace fore200e_spin() busy loops with schedule_timeout().

===== fore200e.c 1.19 vs edited =====
--- 1.19/drivers/atm/fore200e.c	Tue Sep  2 11:07:59 2003
+++ edited/fore200e.c	Fri Sep 19 12:24:15 2003
@@ -229,7 +229,8 @@
     u32 hb1, hb2;
 
     hb1 = fore200e->bus->read(&fore200e->cp_queues->heartbeat);
-    fore200e_spin(10);
+    set_current_state(TASK_UNINTERRUPTIBLE);
+    schedule_timeout(10 * HZ/1000);
     hb2 = fore200e->bus->read(&fore200e->cp_queues->heartbeat);
     
     if (hb2 <= hb1) {
@@ -244,14 +245,6 @@
 #endif 
 
 
-static void
-fore200e_spin(int msecs)
-{
-    unsigned long timeout = jiffies + MSECS(msecs);
-    while (time_before(jiffies, timeout));
-}
-
-
 static int
 fore200e_poll(struct fore200e* fore200e, volatile u32* addr, u32 val, int msecs)
 {
@@ -551,7 +544,8 @@
 fore200e_pca_reset(struct fore200e* fore200e)
 {
     writel(PCA200E_HCR_RESET, fore200e->regs.pca.hcr);
-    fore200e_spin(10);
+    set_current_state(TASK_UNINTERRUPTIBLE);
+    schedule_timeout(10 * HZ/1000);
     writel(0, fore200e->regs.pca.hcr);
 }
 
@@ -831,7 +825,8 @@
 fore200e_sba_reset(struct fore200e* fore200e)
 {
     fore200e->bus->write(SBA200E_HCR_RESET, fore200e->regs.sba.hcr);
-    fore200e_spin(10);
+    set_current_state(TASK_UNINTERRUPTIBLE);
+    schedule_timeout(10 * HZ/1000);
     fore200e->bus->write(0, fore200e->regs.sba.hcr);
 }
 

      reply	other threads:[~2003-09-19 19:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-18 23:25 [PATCH 1/13] " Chris Wright
2003-09-18 23:27 ` [PATCH 2/13] " Chris Wright
2003-09-18 23:29   ` [PATCH 3/13] " Chris Wright
2003-09-18 23:31     ` [PATCH 4/13] " Chris Wright
2003-09-18 23:33       ` [PATCH 5/13] " Chris Wright
2003-09-18 23:34         ` [PATCH 6/13] " Chris Wright
2003-09-18 23:35           ` [PATCH 7/13] " Chris Wright
2003-09-18 23:36             ` [PATCH 8/13] " Chris Wright
2003-09-18 23:37               ` [PATCH 9/13] " Chris Wright
2003-09-18 23:40                 ` [PATCH 10/13] " Chris Wright
2003-09-18 23:41                   ` [PATCH 11/13] " Chris Wright
2003-09-18 23:43                     ` [PATCH 12/13] " Chris Wright
2003-09-18 23:46                       ` [PATCH 13/13] " Chris Wright
2003-09-20  7:37                 ` [PATCH 9/13] " David S. Miller
2003-09-19  7:37             ` [PATCH 7/13] " Arjan van de Ven
2003-09-19 19:49               ` Chris Wright
2003-09-19  7:34       ` [PATCH 4/13] " Arjan van de Ven
2003-09-19 19:48         ` Chris Wright
2003-09-19 19:54           ` Arjan van de Ven
2003-09-19  7:33   ` [PATCH 2/13] " Arjan van de Ven
2003-09-19 19:49     ` Chris Wright [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030919124954.D27079@osdlab.pdx.osdl.net \
    --to=chrisw@osdl.org \
    --cc=arjanv@redhat.com \
    --cc=chas@cmf.nrl.navy.mil \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mitch@sfgoth.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®