[PATCH] drivers/scsi: fix-up schedule_timeout() usage
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / scsi / NCR5380.c
index f8ec6fe..cba9655 100644 (file)
  */
 #include <scsi/scsi_dbg.h>
 
+#ifndef NDEBUG
+#define NDEBUG 0
+#endif
+#ifndef NDEBUG_ABORT
+#define NDEBUG_ABORT 0
+#endif
+
 #if (NDEBUG & NDEBUG_LISTS)
 #define LIST(x,y) {printk("LINE:%d   Adding %p to %p\n", __LINE__, (void*)(x), (void*)(y)); if ((x)==(y)) udelay(5); }
 #define REMOVE(w,x,y,z) {printk("LINE:%d   Removing: %p->%p  %p->%p \n", __LINE__, (void*)(w), (void*)(x), (void*)(y), (void*)(z)); if ((x)==(y)) udelay(5); }
@@ -359,7 +366,7 @@ static struct {
        {PHASE_UNKNOWN, "UNKNOWN"}
 };
 
-#ifdef NDEBUG
+#if NDEBUG
 static struct {
        unsigned char mask;
        const char *name;
@@ -599,10 +606,7 @@ static int __init NCR5380_probe_irq(struct Scsi_Host *instance, int possible)
        NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL);
 
        while (probe_irq == SCSI_IRQ_NONE && time_before(jiffies, timeout))
-       {
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
-       }
+               schedule_timeout_uninterruptible(1);
        
        NCR5380_write(SELECT_ENABLE_REG, 0);
        NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
@@ -1240,13 +1244,13 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
        case WRITE:
        case WRITE_6:
        case WRITE_10:
-               hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
+               hostdata->time_write[scmd_id(cmd)] += (jiffies - hostdata->timebase);
                hostdata->pendingw--;
                break;
        case READ:
        case READ_6:
        case READ_10:
-               hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
+               hostdata->time_read[scmd_id(cmd)] += (jiffies - hostdata->timebase);
                hostdata->pendingr--;
                break;
        }
@@ -1378,7 +1382,7 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
         * the host and target ID's on the SCSI bus.
         */
 
-       NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->device->id)));
+       NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << scmd_id(cmd))));
 
        /* 
         * Raise ATN while SEL is true before BSY goes false from arbitration,
@@ -1423,7 +1427,7 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
 
        udelay(1);
 
-       dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, cmd->device->id));
+       dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, scmd_id(cmd)));
 
        /* 
         * The SCSI specification calls for a 250 ms timeout for the actual 
@@ -1476,7 +1480,7 @@ part2:
 
        if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
                NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-               if (hostdata->targets_present & (1 << cmd->device->id)) {
+               if (hostdata->targets_present & (1 << scmd_id(cmd))) {
                        printk(KERN_DEBUG "scsi%d : weirdness\n", instance->host_no);
                        if (hostdata->restart_select)
                                printk(KERN_DEBUG "\trestart select\n");
@@ -1492,7 +1496,7 @@ part2:
                NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
                return 0;
        }
-       hostdata->targets_present |= (1 << cmd->device->id);
+       hostdata->targets_present |= (1 << scmd_id(cmd));
 
        /*
         * Since we followed the SCSI spec, and raised ATN while SEL 
@@ -2183,7 +2187,8 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
                                                 * If the watchdog timer fires, all future accesses to this
                                                 * device will use the polled-IO.
                                                 */
-                                               printk("scsi%d : switching target %d lun %d to slow handshake\n", instance->host_no, cmd->device->id, cmd->device->lun);
+                                               scmd_printk(KERN_INFO, cmd,
+                                                           "switching to slow handshake\n");
                                                cmd->device->borken = 1;
                                                NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
                                                sink = 1;
@@ -2422,9 +2427,11 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
                                                scsi_print_msg(extended_msg);
                                                printk("\n");
                                        } else if (tmp != EXTENDED_MESSAGE)
-                                               printk("scsi%d: rejecting unknown message %02x from target %d, lun %d\n", instance->host_no, tmp, cmd->device->id, cmd->device->lun);
+                                               scmd_printk(KERN_INFO, cmd,
+                                                       "rejecting unknown message %02x\n",tmp);
                                        else
-                                               printk("scsi%d: rejecting unknown extended message code %02x, length %d from target %d, lun %d\n", instance->host_no, extended_msg[1], extended_msg[0], cmd->device->id, cmd->device->lun);
+                                               scmd_printk(KERN_INFO, cmd,
+                                                       "rejecting unknown extended message code %02x, length %d\n", extended_msg[1], extended_msg[0]);
 
                                        msgout = MESSAGE_REJECT;
                                        NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);