lkml.org 
[lkml]   [2003]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2/13] use cpu_relax() in busy loop
* 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);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.080 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site