Re: linux-2.1.102/drivers/scsi/fdomain.c as module hangs system

David B. Rees (dbr@oto.dyn.ml.org)
Tue, 19 May 1998 22:13:23 -0700 (PDT)


On 20-May-98 Linus Torvalds wrote:

> On Tue, 19 May 1998, David B. Rees wrote:

>> I've got an fdomain card and have the same problems as Jeffrey. However,
>> Linus' patch misses one thing (unistd.h) and it won't compile. Try this
>> patch
>> instead:
>
> No, change the "unistd.h" to a "delay.h", and change the "usleep()" to a
> "udelay()". Then it should work.

OK, one more try:

--- linux-2.1.102/drivers/scsi/fdomain.c Tue May 19 21:52:43 1998
+++ linux/drivers/scsi/fdomain.c Tue May 19 22:11:01 1998
@@ -272,6 +272,7 @@
#include <linux/proc_fs.h>
#include <linux/pci.h>
#include <linux/stat.h>
+#include <linux/delay.h>

#include <linux/config.h> /* for CONFIG_PCI */

@@ -553,9 +554,9 @@

static void do_pause( unsigned amount ) /* Pause for amount*10
milliseconds */
{
- unsigned long the_time = jiffies + amount; /* 0.01 seconds per jiffy */
-
- while (jiffies < the_time);
+ do {
+ udelay(10*1000);
+ } while (--amount);
}

inline static void fdomain_make_bus_idle( void )
@@ -1101,12 +1102,13 @@
outb( adapter_mask, port_base + SCSI_Data_NoACK ); /* Set our id bit */
outb( 0x04 | PARITY_MASK, TMC_Cntl_port ); /* Start arbitration */

- timeout = jiffies + 50; /* 500 mS */
- while (jiffies < timeout) {
+ timeout = 500;
+ do {
status = inb( TMC_Status_port ); /* Read adapter status */
if (status & 0x02) /* Arbitration complete */
- return 0;
- }
+ return 0;
+ udelay(1000); /* Wait one millisecond */
+ } while (--timeout);

/* Make bus idle */
fdomain_make_bus_idle();
@@ -1134,17 +1136,17 @@
/* Stop arbitration and enable parity */
outb( PARITY_MASK, TMC_Cntl_port );

- timeout = jiffies + 35; /* 350mS -- because of timeouts
- (was 250mS) */
+ timeout = 350; /* 350 msec */

- while (jiffies < timeout) {
+ do {
status = inb( SCSI_Status_port ); /* Read adapter status */
if (status & 1) { /* Busy asserted */
/* Enable SCSI Bus (on error, should make bus idle with 0) */
outb( 0x80, SCSI_Cntl_port );
return 0;
}
- }
+ udelay(1000); /* wait one msec */
+ } while (--timeout);
/* Make bus idle */
fdomain_make_bus_idle();
#if EVERY_ACCESS

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu