Re: [PATCH 4/13] use cpu_relax() in busy loop

From: Chris Wright
Date: Fri Sep 19 2003 - 14:56:36 EST


* Arjan van de Ven (arjanv@xxxxxxxxxx) wrote:
>
> mdelay ?

Yeah, good point. For these subsecond pauses mdelay() makes more sense.
It'd be nice to get rid of long busy loops in general. Thanks for taking
a look.

-chris

[PATCH 4/13] use mdelay() instead of busy loop

Replace busy loop with mdelay().

===== drivers/cdrom/sonycd535.c 1.39 vs edited =====
--- 1.39/drivers/cdrom/sonycd535.c Tue Sep 9 07:41:30 2003
+++ edited/drivers/cdrom/sonycd535.c Fri Sep 19 10:36:18 2003
@@ -129,6 +129,7 @@
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/init.h>
+#include <linux/delay.h>

#define REALLY_SLOW_IO
#include <asm/system.h>
@@ -1520,13 +1521,12 @@

/* A negative sony535_irq_used will attempt an autoirq. */
if (sony535_irq_used < 0) {
- unsigned long irq_mask, delay;
+ unsigned long irq_mask;

irq_mask = probe_irq_on();
enable_interrupts();
outb(0, read_status_reg); /* does a reset? */
- delay = jiffies + HZ/10;
- while (time_before(jiffies, delay)) ;
+ mdelay(100);

sony535_irq_used = probe_irq_off(irq_mask);
disable_interrupts();

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/