Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / drivers / scsi / eata_pio.c
index 3c5151c..23beb48 100644 (file)
@@ -59,6 +59,8 @@
 #include <linux/interrupt.h>
 #include <linux/blkdev.h>
 #include <linux/spinlock.h>
+#include <linux/delay.h>
+
 #include <asm/io.h>
 
 #include <scsi/scsi.h>
@@ -382,7 +384,9 @@ static int eata_pio_queue(struct scsi_cmnd *cmd,
 
        cp->status = USED;      /* claim free slot */
 
-       DBG(DBG_QUEUE, printk(KERN_DEBUG "eata_pio_queue pid %ld, target: %x, lun:" " %x, y %d\n", cmd->pid, cmd->device->id, cmd->device->lun, y));
+       DBG(DBG_QUEUE, scmd_printk(KERN_DEBUG, cmd,
+               "eata_pio_queue pid %ld, y %d\n",
+               cmd->pid, y));
 
        cmd->scsi_done = (void *) done;
 
@@ -425,7 +429,9 @@ static int eata_pio_queue(struct scsi_cmnd *cmd,
 
        if (eata_pio_send_command(base, EATA_CMD_PIO_SEND_CP)) {
                cmd->result = DID_BUS_BUSY << 16;
-               printk(KERN_NOTICE "eata_pio_queue target %d, pid %ld, HBA busy, " "returning DID_BUS_BUSY, done.\n", cmd->device->id, cmd->pid);
+               scmd_printk(KERN_NOTICE, cmd,
+                       "eata_pio_queue pid %ld, HBA busy, "
+                       "returning DID_BUS_BUSY, done.\n", cmd->pid);
                done(cmd);
                cp->status = FREE;
                return (0);
@@ -438,7 +444,9 @@ static int eata_pio_queue(struct scsi_cmnd *cmd,
        for (x = 0; x < hd->cppadlen; x++)
                outw(0, base + HA_RDATA);
 
-       DBG(DBG_QUEUE, printk(KERN_DEBUG "Queued base %#.4lx pid: %ld target: %x " "lun: %x slot %d irq %d\n", (long) sh->base, cmd->pid, cmd->device->id, cmd->device->lun, y, sh->irq));
+       DBG(DBG_QUEUE, scmd_printk(KERN_DEBUG, cmd,
+               "Queued base %#.4lx pid: %ld "
+               "slot %d irq %d\n", (long) sh->base, cmd->pid, y, sh->irq));
 
        return (0);
 }
@@ -447,8 +455,9 @@ static int eata_pio_abort(struct scsi_cmnd *cmd)
 {
        uint loop = HZ;
 
-       DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_abort called pid: %ld " "target: %x lun: %x reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, cmd->abort_reason));
-
+       DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd,
+               "eata_pio_abort called pid: %ld\n",
+               cmd->pid));
 
        while (inb(cmd->device->host->base + HA_RAUXSTAT) & HA_ABUSY)
                if (--loop == 0) {
@@ -482,10 +491,15 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd)
        struct scsi_cmnd *sp;
        struct Scsi_Host *host = cmd->device->host;
 
-       DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" " %x lun: %x reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, cmd->abort_reason));
+       DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd,
+               "eata_pio_reset called pid:%ld\n",
+               cmd->pid));
+
+       spin_lock_irq(host->host_lock);
 
        if (HD(cmd)->state == RESET) {
                printk(KERN_WARNING "eata_pio_reset: exit, already in reset.\n");
+               spin_unlock_irq(host->host_lock);
                return FAILED;
        }
 
@@ -511,8 +525,7 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd)
        HD(cmd)->state = RESET;
 
        spin_unlock_irq(host->host_lock);
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(3 * HZ);
+       msleep(3000);
        spin_lock_irq(host->host_lock);
 
        DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: interrupts disabled, " "loops %d.\n", limit));
@@ -535,6 +548,8 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd)
 
        HD(cmd)->state = 0;
 
+       spin_unlock_irq(host->host_lock);
+
        if (success) {          /* hmmm... */
                DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: exit, success.\n"));
                return SUCCESS;
@@ -840,7 +855,7 @@ static void find_pio_EISA(struct get_conf *buf)
        u32 base;
        int i;
 
-#if CHECKPAL
+#ifdef CHECKPAL
        u8 pal1, pal2, pal3;
 #endif
 
@@ -848,7 +863,7 @@ static void find_pio_EISA(struct get_conf *buf)
                if (EISAbases[i]) {     /* Still a possibility ?          */
 
                        base = 0x1c88 + (i * 0x1000);
-#if CHECKPAL
+#ifdef CHECKPAL
                        pal1 = inb((u16) base - 8);
                        pal2 = inb((u16) base - 7);
                        pal3 = inb((u16) base - 6);
@@ -868,7 +883,7 @@ static void find_pio_EISA(struct get_conf *buf)
                                }
                                /* Nothing found here so we take it from the list */
                                EISAbases[i] = 0;
-#if CHECKPAL
+#ifdef CHECKPAL
                        }
 #endif
                }
@@ -929,7 +944,7 @@ static void find_pio_PCI(struct get_conf *buf)
                                        EISAbases[x] = 0;
                                }
                        }
-#if CHECK_BLINK
+#ifdef CHECK_BLINK
                        else if (check_blink_state(base)) {
                                printk("eata_pio: HBA is in BLINK state.\n" "Consult your HBAs manual to correct this.\n");
                        }